enderalse/source/scripts/_00e_nq34_startsc.psc

58 lines
1.3 KiB
Plaintext
Raw Normal View History

Scriptname _00E_NQ34_StartSC extends ObjectReference
Event OnCellLoad()
2024-01-10 14:08:24 +00:00
If MQ11a.GetCurrentStageID() >= 45 && MQ11a.GetCurrentStageID() <= 55 && NQ34.IsRunning() == False && NQ34.GetCurrentStageID() < 20 && !bDone
TryStartQuest()
EndIf
EndEvent
Event OnUpdate()
If Is3DLoaded()
TryStartQuest()
EndIf
EndEvent
Function TryStartQuest()
Float triggerDistance = 3072.0
Float distance = PlayerREF.GetDistance(self)
If distance <= triggerDistance
bDone = True
; Aggro the lost ones
Int Index = 0
While Index < LostOnes.Length
If LostOnes[Index].IsDead() == False
LostOnes[Index].StartCombat(PlayerREF)
EndIf
Index += 1
EndWhile
; If the entropist (the target of NQ34) has been killed
; before the quest, he is resurrected.
if NQ34_WildMageREF.IsDead()
NQ34_WildMageREF.Resurrect()
endif
2024-01-10 14:08:24 +00:00
NQ34.Start();SetCurrentStageID(5)
Else
; Try again a bit later
If distance <= (triggerDistance + 1024.0)
; Check more often if the player is close to the trigger distance
RegisterForSingleUpdate(0.1)
Else
RegisterForSingleUpdate(1)
EndIf
EndIf
EndFunction
bool bDone
Actor Property NQ34_WildMageREF Auto
Actor Property PlayerREF Auto
Actor[] Property LostOnes Auto
Quest Property NQ34 Auto
Quest Property MQ11a Auto