enderalse/source/scripts/defaultenableenclinkedref.psc

48 lines
1.2 KiB
Plaintext

scriptName defaultEnableEncLinkedRef extends ObjectReference
{
- This script enables its linkedRef based on a the player's level compared to a global
}
bool Property PlayerOnly = TRUE auto
{Does this only trigger for the player? (DEFAULT = TRUE)}
bool Property Fade = FALSE auto
{Fade in/out when enabled (DEFAULT = FALSE)}
GlobalVariable Property EncounterGlobal auto
{usually will use global prefixed with LevelGate, for example LevelGateHagraven}
; ObjectReference myLinkedRef
;****************************
Event onCellLoad()
;myLinkedRef = getLinkedRef()
endEvent
;****************************
Auto State waiting
Event onTriggerEnter(ObjectReference triggerRef)
Actor playerRef = Game.GetPlayer()
if (PlayerOnly == False) || (triggerRef == playerRef)
if (EncounterGlobal == None) || (playerRef.getLevel() >= EncounterGlobal.getValue())
gotoState ("done")
;USKP 2.0.4 - Using the myLinkedRef variable is unreliable because OnCellLoad events suck.
getLinkedRef().enable(Fade)
endif
endif
endEvent
endState
;****************************
State done
Event onTriggerEnter(ObjectReference triggerRef)
;do nothing
endEvent
endState
;****************************