enderalse/scripts/source/_00e_caliafollowtriggerscript.psc

137 lines
3.2 KiB
Plaintext

Scriptname _00E_CaliaFollowTriggerScript extends ObjectReference
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnTriggerEnter(ObjectReference akActionRef)
If (akActionRef == PlayerREF)
SendEnterEvent()
EndIf
EndEvent
Event OnTriggerLeave(ObjectReference akActionRef)
If (akActionRef == PlayerREF)
SendExitEvent()
EndIf
EndEvent
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function SendEnterEvent()
If (CurrentQuest.GetStage() >= ValidStageMin ) && (CurrentQuest.GetStage() < ValidStageMax )
bool bWasZero
If TravelStateVariable.GetValue() == 0
bWasZero = True
EndIf
If InTrigger == False
InTrigger = True
TravelStateVariable.Mod(1)
EndIf
If ((TravelStateVariable.GetValue() == 0) || bWasZero) && !bIsStartBox
bWasZero = False
If !bIsTransitionBox
If _00E_CaliaEntriggerFollowNotif != None
_00E_CaliaEntriggerFollowNotif.Show()
EndIf
If CompanionIsTalking == NONE
CompanionIsTalking = Game.GetForm(0x000250BB) as GlobalVariable
EndIf
If CompanionIsTalking.GetValueInt() == 0
CompanionIsTalking.SetValueInt(1)
_00E_MC_CaliaREF.Say(CaliaDialogue_PlayerReenters)
EndIf
EndIf
_00E_MC_CaliaREF.EvaluatePackage()
EndIf
EndIf
Return
EndFunction
Function SendExitEvent()
If (CurrentQuest.GetStage() >= ValidStageMin ) && (CurrentQuest.GetStage() < ValidStageMax )
If InTrigger == True
TravelStateVariable.Mod(-1)
_00E_MC_CaliaREF.EvaluatePackage()
InTrigger = False
EndIf
If (TravelStateVariable.GetValue() == 0)
If !bIsTransitionBox
If _00E_CaliaEntriggerStopNotif != None
_00E_CaliaEntriggerStopNotif.Show()
EndIf
If CompanionIsTalking == NONE
CompanionIsTalking = Game.GetForm(0x000250BB) as GlobalVariable
EndIf
If CompanionIsTalking.GetValueInt() == 0
CompanionIsTalking.SetValueInt(1)
_00E_MC_CaliaREF.Say(CaliaDialogue_PlayerLeaves)
EndIf
EndIf
_00E_MC_CaliaREF.EvaluatePackage()
EndIf
EndIf
Return
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
bool InTrigger
bool bHasEntered
int Property ValidStageMin Auto
int Property ValidStageMax Auto
bool Property bIsStartBox = False Auto
bool Property bIsTransitionBox Auto
Actor Property PlayerREF Auto
Actor Property _00E_MC_CaliaREF Auto
Quest Property CurrentQuest Auto
GlobalVariable Property TravelStateVariable Auto
GlobalVariable Property CompanionIsTalking Auto
Topic Property CaliaDialogue_PlayerLeaves Auto
Topic Property CaliaDialogue_PlayerReenters Auto
Message Property _00E_CaliaEntriggerFollowNotif Auto
Message Property _00E_CaliaEntriggerStopNotif Auto