2024-01-09 22:00:18 +00:00
|
|
|
Scriptname WeaponRackTriggerSCRIPT extends ObjectReference Hidden
|
2023-12-04 15:02:58 +00:00
|
|
|
|
|
|
|
import game
|
|
|
|
import debug
|
|
|
|
import utility
|
|
|
|
|
|
|
|
Keyword Property WRackActivator Auto
|
|
|
|
|
|
|
|
;The activator we must disable if there is already something in this trigger
|
|
|
|
ObjectReference Property ActivatorRef Auto Hidden
|
2024-01-09 22:00:18 +00:00
|
|
|
|
2023-12-04 15:02:58 +00:00
|
|
|
;Reference that is currently in the trigger
|
|
|
|
ObjectReference Property RefCurrentlyInTrig Auto Hidden
|
|
|
|
|
|
|
|
;1 = if something is in this trigger, 0 = empty
|
|
|
|
Bool Property HasBeenTriggered Auto Hidden
|
|
|
|
|
|
|
|
Int Property numInTrig Auto Hidden
|
2024-01-09 22:00:18 +00:00
|
|
|
|
2023-12-04 15:02:58 +00:00
|
|
|
Bool Property AlreadyInit Auto Hidden
|
|
|
|
|
|
|
|
Bool Property IgnoreArmor = FALSE Auto
|
|
|
|
|
|
|
|
|
2024-01-09 22:00:18 +00:00
|
|
|
EVENT OnReset()
|
2023-12-04 15:02:58 +00:00
|
|
|
AlreadyInit = FALSE
|
2024-01-09 22:00:18 +00:00
|
|
|
;Trace("DARYL - " + self + " running OnReset() and AlreadyInit = " + AlreadyInit)
|
2023-12-04 15:02:58 +00:00
|
|
|
endEVENT
|
|
|
|
|
2024-01-09 22:00:18 +00:00
|
|
|
EVENT OnLoad()
|
|
|
|
;Trace("DARYL - " + self + " running OnLoad() and AlreadyInit = " + AlreadyInit)
|
|
|
|
if (AlreadyInit == FALSE) && (self.IsEnabled())
|
|
|
|
ActivatorRef = GetLinkedRef(WRackActivator)
|
|
|
|
if (ActivatorRef)
|
|
|
|
ActivatorRef.Enable()
|
|
|
|
endif
|
|
|
|
ActivatorRef = NONE
|
|
|
|
AlreadyInit = TRUE
|
|
|
|
;Trace("DARYL - " + self + " The Activator Ref is " + ActivatorRef)
|
|
|
|
else
|
|
|
|
;Do nothing
|
|
|
|
endif
|
|
|
|
;Trace("DARYL - " + self + " finishing OnLoad() and AlreadyInit = " + AlreadyInit)
|
2023-12-04 15:02:58 +00:00
|
|
|
endEVENT
|
|
|
|
|
2024-01-09 22:00:18 +00:00
|
|
|
;EVENT OnCellLoad()
|
|
|
|
; ;Trace("DARYL - " + self + " running OnCellLoad() and AlreadyInit = " + AlreadyInit)
|
|
|
|
; if (AlreadyInit == FALSE) && (self.IsEnabled())
|
|
|
|
; ActivatorRef = GetLinkedRef(WRackActivator)
|
|
|
|
; AlreadyInit = TRUE
|
|
|
|
; ;Trace("DARYL - " + self + " The Activator Ref is " + ActivatorRef)
|
|
|
|
; else
|
|
|
|
; ;Do nothing
|
|
|
|
; endif
|
|
|
|
; ;Trace("DARYL - " + self + " finishing OnCellLoad() and AlreadyInit = " + AlreadyInit)
|
|
|
|
;endEVENT
|
2023-12-04 15:02:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
auto STATE WaitingForReference
|
2024-01-09 22:00:18 +00:00
|
|
|
EVENT onTriggerEnter(objectReference triggerRef)
|
|
|
|
;Trace("DARYL - " + self + " Just OnTriggerEntered by " + triggerref)
|
|
|
|
|
|
|
|
if (IgnoreArmor == TRUE) && (triggerRef.GetBaseObject() as Armor)
|
|
|
|
;Trace("DARYL - " + self + " I'm ignoring armor, and this is armor, so I'm doing nothing.")
|
|
|
|
;Do Nothing
|
|
|
|
else
|
|
|
|
;Trace("DARYL - " + self + " I'm updating as normal")
|
|
|
|
;numInTrig = (numInTrig + 1)
|
|
|
|
HasBeenTriggered = TRUE
|
|
|
|
ActivatorRef = GetLinkedRef(WRackActivator)
|
|
|
|
if ActivatorRef
|
|
|
|
ActivatorRef.Disable()
|
|
|
|
endif
|
|
|
|
ActivatorRef = NONE
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2023-12-06 15:31:10 +00:00
|
|
|
endEVENT
|
2023-12-04 15:02:58 +00:00
|
|
|
EVENT OnTriggerLeave(objectReference triggerRef)
|
2024-01-09 22:00:18 +00:00
|
|
|
;Trace("DARYL - " + self + " A References has EXITED, refs in this trigger now = " + numInTrig)
|
|
|
|
|
|
|
|
if (IgnoreArmor == TRUE) && (triggerRef.GetBaseObject() as Armor)
|
|
|
|
;Trace("DARYL - " + self + " I'm ignoring armor, and this is armor, so I'm doing nothing.")
|
|
|
|
;Do Nothing
|
|
|
|
else
|
|
|
|
;Trace("DARYL - " + self + " I'm updating as normal")
|
|
|
|
;numInTrig = (numInTrig - 1)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if (GetTriggerObjectCount() == 0)
|
|
|
|
ActivatorRef = GetLinkedRef(WRackActivator)
|
|
|
|
|
|
|
|
HasBeenTriggered = FALSE
|
|
|
|
ActivatorRef.Enable()
|
2023-12-04 15:02:58 +00:00
|
|
|
|
|
|
|
ActivatorRef = NONE
|
|
|
|
|
2024-01-09 22:00:18 +00:00
|
|
|
endif
|
2023-12-04 15:02:58 +00:00
|
|
|
endEVENT
|
|
|
|
endSTATE
|
|
|
|
|
|
|
|
|