4
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

46 lines
1.2 KiB

scriptName defaultActivateToggleLinkedRefOnce extends ObjectReference
{
- Toggles the state of the linked ref when this object is activated.
}
ObjectReference myLinkedRef
Keyword property linkKeyword Auto
bool property requirePlayer = False Auto
bool property requireNOTPlayer = False Auto
bool property fade = False Auto
bool property reset = True Auto
Event OnReset()
;USKP 2.0.4 - This should only return to pre-activation if the reference should be reset. Otherwise don't, because it makes messes of things.
if(reset)
gotoState("PreActivation")
Else
gotoState("DoNothing")
EndIf
EndEvent
Auto State PreActivation
Event OnActivate(ObjectReference triggerRef)
if ((!requirePlayer && !requireNOTPlayer) || (requirePlayer && triggerRef == (Game.GetForm(0x14) as Actor)) || (requireNOTPlayer && triggerRef != (Game.GetForm(0x14) as Actor)))
myLinkedRef = GetLinkedRef(linkKeyword) as ObjectReference
if (myLinkedRef.IsEnabled())
myLinkedRef.Disable(fade)
Else
myLinkedRef.Enable(fade)
EndIf
if (reset)
; Debug.Trace("Now awaiting reset.")
gotoState("PostActivation")
Else
gotoState("DoNothing")
EndIf
EndIf
EndEvent
EndState
STATE PostActivation
EndState
STATE DoNothing
;Do nothing
EndState