SCTX |
Scriptname SEHerdirScript
;Handles all variables and scripting for SEHerdir (used in SE05)
Short FollowPlayer ;set to 1 for following, 2 for waiting, 3 if players leaves Shivering Isles
Short TortureHold ;flag set in dialogue results for script package added to tortured NPCs
Short IdleCall ;flag set so target reference runs the proper idle when hit by the spell
Short ClearTorture ;flag set when stage 55 is hit, to clear Torture vars below
;the following are incremented each time the person is set as the target ref; used for tracking in dialogue
short KithlanTorture
short AnyaTorture
short NelreneTorture
short MuurineTorture
short MazaddhaTorture
short BerniceTorture
short CutterTorture
short UshnarTorture
short OtherTorture
Short TargetHit
Ref TargetRef
Ref LastTarget
Short CastSpell
Float CastTimer
Begin OnActivate
; Prevent him from being activated while he's supposed to be torturing someone
if ( CastSpell > 0 )
return
else
Activate
endif
End
Begin GameMode
;When player hits stage 55, clear Torture vars so he doesn't get a free pass on anyone he may have questioned before.
if ( ClearTorture == 0 )
if ( GetStage SE05 == 55 )
Set NelreneTorture to 0
set MuurineTorture to 0
set CutterTorture to 0
set BerniceTorture to 0
set ClearTorture to 1
endif
endif
;When CastSpell is set through dialogue choices, have Herdir cast spell at TargetRef and hold TargetRef in position
if ( CastSpell == 1 )
set SE05.HerdirTarget to TargetRef
Cast SE05HerdirTortureSpell1 TargetRef
set CastTimer to 10
SEHerdirRef.ModDisposition Player 10
if ( TargetRef.GetSitting == 0 )
TargetRef.AddScriptPackage SE05TortureHoldPosition
endif
set CastSpell to 2
endif
;If the spell hits the intended target (TargetRef) and is different than the last , clear OtherTorture and update LastTarget (used for tracking people who don't matter, so Herdir can say as much)
;Otherwise count down a timer and reset CastSpell to 1 so Herdir can try again
if ( CastSpell == 2 )
if ( TargetHit == 1 )
if ( TargetRef != LastTarget )
set LastTarget to TargetRef
set OtherTorture to 0
endif
elseif ( CastTimer <= 0 )
set CastSpell to 1
else
set CastTimer to ( CastTimer - GetSecondsPassed )
endif
endif
;When target is hit with spell, have them run the appropriate idle and update the corresponding var used for tracking in dialogue
;if target doesn't match any of the above (and is therefore useless) increment OtherTorture so Herdir can prompt player after a few zaps
if ( IdleCall == 0 )
if ( TargetRef.HasMagicEffect SEFF )
set IdleCall to 1
TargetRef.PickIdle
if ( TargetRef == SEKithlanRef )
if ( GetStage SE05 < 40 )
set KithlanTorture to ( KithlanTorture + 1 )
endif
elseif ( TargetRef == SEAnyaHerrickRef )
set AnyaTorture to ( AnyaTorture + 1 )
elseif ( TargetRef == SENelreneRef )
if ( GetStage SE05 >= 80 )
set NelreneTorture to ( NelreneTorture + 1 )
else
set OtherTorture to ( OtherTorture + 1 )
endif
elseif ( TargetRef == SEMuurineRef )
if ( GetStage SE05 >= 100 )
set MuurineTorture to ( MuurineTorture + 1 )
else
set OtherTorture to ( OtherTorture + 1 )
endif
elseif ( TargetRef == SEMazaddhaRef )
if ( GetStage SE05 >= 50 )
set MazaddhaTorture to ( MazaddhaTorture + 1 )
else
set OtherTorture to ( OtherTorture + 1 )
endif
elseif ( TargetRef == SESicklyBerniceRef )
if ( GetStage SE05 == 55 )
set BerniceTorture to ( BerniceTorture + 1 )
else
set OtherTorture to ( OtherTorture + 1 )
endif
elseif ( TargetRef == SECutterRef )
if ( GetStage SE05 == 55 )
set CutterTorture to ( CutterTorture + 1 )
else
set OtherTorture to ( OtherTorture + 1 )
endif
elseif ( TargetRef == SEUshnarGroShadborgobRef )
if ( GetStage SE05 < 40 )
set UshnarTorture to ( UshnarTorture + 1 )
endif
else
set OtherTorture to ( OtherTorture + 1 )
endif
endif
endif
;If player leaves Shivering Isles, set Herdir to stop following
; if ( FollowPlayer == 1 )
; if ( GetinCell SENS == 0 )
; set FollowPlayer to 3
; StartConversation Player
; endif
; endif
End
|