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.
 
 
 

44 lines
1.1 KiB

scriptname defaultSetStageOnUnload extends objectReference
{Sets a stage when this object unloads.}
import game
import debug
quest property myQuest auto
{ quest to call SetStage on}
int property stage auto
{ stage to set}
int property prereqStageOPT = -1 auto
{ OPTIONAL: stage that must be set for this trigger to fire }
bool property disableWhenDone = true auto
{ disable myself after I've been triggered. Defaults to true }
auto STATE waitingForPlayer
Event OnUnload()
if prereqStageOPT == -1 || MyQuest.IsStageDone(prereqStageOPT) == 1
; Start the quest just in case it isn't already running.
if myQuest.isRunning() == FALSE
bool check = myQuest.start()
; do a quick check in case the quest could not be started
if !check
; debug.trace("ERROR: "+myQuest+" not started by "+self)
endif
endif
; do the actual business of setting the stage we want
myQuest.SetCurrentStageID(stage)
gotoState("hasBeenTriggered")
if disableWhenDone
Disable()
EndIf
endif
EndEvent
endSTATE
STATE hasBeenTriggered
; this is an empty state.
endSTATE