enderalse/scripts/source/_00e_jesparfollowtriggersc.psc

129 lines
3.6 KiB
Plaintext
Raw Normal View History

Scriptname _00E_JesparFollowTriggerSC 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.SetValue((TravelStateVariable.GetValue()+1))
EndIf
if ((TravelStateVariable.GetValue() == 0) || bWasZero) && !bIsStartBox
bWasZero = False
if _00E_JesparEntriggerFollowNotif != None
_00E_JesparEntriggerFollowNotif.Show()
endif
If CompanionIsTalking == NONE
CompanionIsTalking = Game.GetForm(0x000250BB) as GlobalVariable
EndIf
If CompanionIsTalking.GetValueInt() == 0
CompanionIsTalking.SetValueInt(1)
_00E_MC_JesparREF.Say(JesparDialogue_Misc_PlayerReentersFollowTrigger)
EndIf
EndIf
_00E_MC_JesparREF.EvaluatePackage()
EndIf
Return
EndFunction
Function SendExitEvent()
If (CurrentQuest.GetStage() >= ValidStageMin) && (CurrentQuest.GetStage() < ValidStageMax )
If InTrigger == True
TravelStateVariable.SetValue((TravelStateVariable.GetValue() - 1))
_00E_MC_JesparREF.EvaluatePackage()
InTrigger = False
EndIf
If (TravelStateVariable.GetValue() == 0) && !bIsStartBox
If _00E_JesparEntriggerStopNotif != None
_00E_JesparEntriggerStopNotif.Show()
EndIf
If CompanionIsTalking == NONE
CompanionIsTalking = Game.GetForm(0x000250BB) as GlobalVariable
EndIf
If CompanionIsTalking.GetValueInt() == 0
CompanionIsTalking.SetValueInt(1)
_00E_MC_JesparREF.Say(JesparDialogue_Misc_PlayerLeavesFollowTrigger)
EndIf
_00E_MC_JesparREF.EvaluatePackage()
EndIf
Endif
Return
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
bool InTrigger
bool bHasEntered
bool Property bIsStartBox = False Auto
int Property ValidStageMax Auto
int Property ValidStageMin Auto
Actor Property PlayerREF Auto
Actor Property _00E_MC_JesparREF Auto
Quest Property CurrentQuest Auto
GlobalVariable Property TravelStateVariable Auto
GlobalVariable Property CompanionIsTalking Auto
Topic Property JesparDialogue_Misc_PlayerLeavesFollowTrigger Auto
Topic Property JesparDialogue_Misc_PlayerReentersFollowTrigger Auto
Message Property _00E_JesparEntriggerFollowNotif Auto
Message Property _00E_JesparEntriggerStopNotif Auto