enderalse/scripts/source/_00e_mq15_failsavesc.psc

133 lines
3.0 KiB
Plaintext

Scriptname _00E_MQ15_FailsaveSC extends ObjectReference
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnTriggerEnter(ObjectReference akActionRef)
If !bDone && akActionRef == PlayerREF
If bYuslan
iNPCsToPort += 1
PortToPlayerIfNotNearby(MQ15.akYuslan)
EndIf
If bCompanion
iNPCsToPort += 1
PortToPlayerIfNotNearby(MQ15.akCompanion)
EndIf
If bTealor
iNPCsToPort += 1
PortToPlayerIfNotNearby(MQ15.akTealor)
EndIf
bDone = True
EndIf
EndEvent
Event OnUpdate()
If bCompanion && !PlayerREF.HasLOS(MQ15.akCompanion)
MQ15.akCompanion.MoveTo(akSpawnPoint)
bPortedNPC01 = True
EndIf
If bYuslan && !PlayerREF.HasLOS(MQ15.akYuslan)
MQ15.akYuslan.MoveTo(akSpawnPoint)
bPortedNPC02 = True
EndIf
If bTealor && !PlayerREF.HasLOS(MQ15.akTealor)
MQ15.akTealor.MoveTo(akSpawnPoint)
bPortedNPC03 = True
EndIf
If iNPCsToPort == 1
If bPortedNPC01
CleanUp()
Else
RegisterForSingleUpdate(2)
EndIf
ElseIf iNPCsToPort == 2
If bPortedNPC01 && bPortedNPC02
CleanUp()
Else
RegisterForSingleUpdate(2)
EndIf
ElseIf iNPCsToPort == 3
If bPortedNPC01 && bPortedNPC02 && bPortedNPC03
CleanUp()
Else
RegisterForSingleUpdate(2)
EndIf
EndIf
EndEvent
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function CleanUp()
Self.Delete()
akSpawnPoint.Delete()
EndFunction
Function PortToPlayerIfNotNearby(Actor akPortTarget)
If !__Config_bDistanceCheck
akPortTarget.MoveTo(PlayerREF)
Elseif __Config_bDistanceCheck && (akPortTarget.GetDistance(PlayerREF) >= __Config_fDistanceCheck) && !bUpdating
objSpawnMarker = PlayerREF.PlaceAtMe(XMarkerHeading, 1)
objSpawnMarker.MoveTo(PlayerRef, -250.0 * Math.Sin(PlayerRef.GetAngleZ()), -250.0 * Math.Cos(PlayerRef.GetAngleZ()), PlayerRef.GetHeight())
akSpawnPoint = objSpawnMarker.PlaceActorAtMe(_00E_NPCOorbayaInvisibeActor, 1)
objSpawnMarker.Delete()
iNPCsToPort = 0
bUpdating = True
RegisterForSingleUpdate(1)
Else
Return
EndIf
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
float Property __Config_fDistanceCheck = 1000.0 Auto
_00E_MQ15_Functions Property MQ15 Auto
int iNPCsToPort
bool bDone
bool bPortedNPC01
bool bPortedNPC02
bool bPortedNPC03
bool bUpdating
bool Property bYuslan Auto
bool Property bTealor Auto
bool Property bCompanion Auto
bool Property __Config_bDistanceCheck = False Auto
ObjectReference objSpawnMarker
Actor akSpawnPoint
Static Property XMarkerHeading Auto
Actor Property PlayerREF Auto
ActorBase Property _00E_NPCOorbayaInvisibeActor Auto