117 lines
3.4 KiB
Plaintext
117 lines
3.4 KiB
Plaintext
Scriptname defaultsetStageRefScript extends ObjectReference
|
|
{generic script for one-shot quest stage update on references}
|
|
|
|
import game
|
|
import debug
|
|
|
|
int property stage auto
|
|
{ stage to set}
|
|
|
|
quest Property myQuest auto
|
|
{ quest containing the stage you want to set}
|
|
|
|
int property prereqStageOPT = -1 auto
|
|
{ OPTIONAL: stage that must be set for this trigger to fire }
|
|
|
|
int testState ; for debugging
|
|
|
|
auto STATE waitingForPlayer
|
|
EVENT onActivate(objectReference triggerRef)
|
|
testForTrigger(triggerRef, 0)
|
|
endEVENT
|
|
|
|
;Event OnDeath(Actor akKiller) ;ACTOR ONLY EVENT
|
|
;testForTrigger(getPlayer(), 1)
|
|
;endEvent
|
|
|
|
Event OnHit(ObjectReference akAggressor, Form akWeapon, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
|
|
;trace(self + " OnHit in waitingForPlayer")
|
|
testForTrigger(akAggressor, 2)
|
|
endEvent
|
|
|
|
EVENT OnTriggerEnter(objectReference triggerRef)
|
|
testForTrigger(triggerRef, 3)
|
|
endEVENT
|
|
;ACTOR ONLY EVENT
|
|
;Event OnEquipped(Actor akActor)
|
|
; testForTrigger(akActor, 4)
|
|
;endEvent
|
|
;ACTOR ONLY EVENT
|
|
;Event OnCombatStateChanged(Actor akTarget, int aeCombatState)
|
|
; if aeCombatState != 0 ; 0 = not in combat, so non-zero means entered combat
|
|
; ; FOR NOW, don't care if its player
|
|
; testForTrigger(getPlayer(), 5)
|
|
; testForTrigger(akTarget, 5)
|
|
; endIf
|
|
;endEvent
|
|
|
|
Event OnCellLoad()
|
|
testForTrigger((Game.GetForm(0x14) as Actor), 6)
|
|
endEvent
|
|
|
|
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
|
|
; trigger if object is added to player's inventory
|
|
testForTrigger(akNewContainer, 7)
|
|
; trigger if object is removed from player's inventory
|
|
testForTrigger(akOldContainer, 8)
|
|
endEvent
|
|
|
|
Event OnOpen(ObjectReference akActionRef)
|
|
testForTrigger((Game.GetForm(0x14) as Actor), 9)
|
|
endEvent
|
|
|
|
Event onRead()
|
|
; debug.Trace(self + " has been read")
|
|
testForTrigger((Game.GetForm(0x14) as Actor), 10)
|
|
endEvent
|
|
|
|
endSTATE
|
|
|
|
STATE hasBeenTriggered
|
|
; this state doesn't do anything
|
|
EVENT onActivate(objectReference triggerRef)
|
|
endEvent
|
|
|
|
Event OnHit(ObjectReference akAggressor, Form akWeapon, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
|
|
;trace(self + " OnHit in hasBeenTriggered")
|
|
endEvent
|
|
|
|
EVENT onTriggerEnter(objectReference triggerRef)
|
|
endEvent
|
|
|
|
Event OnEquipped(Actor akActor)
|
|
endEvent
|
|
endSTATE
|
|
|
|
EVENT onActivate(objectReference triggerRef)
|
|
endEvent
|
|
|
|
function testForTrigger(objectReference triggerRef, int pTestTriggerType)
|
|
; debug.trace(self + " testForTrigger, triggerRef=" + triggerRef + ", triggerType=" + pTestTriggerType)
|
|
if TriggerType == pTestTriggerType
|
|
if triggerRef == getPlayer()
|
|
if prereqStageOPT == -1 || myQuest.IsStageDone(prereqStageOPT) == 1
|
|
; debug.trace(self + " testforTrigger SUCCEEDED")
|
|
myQuest.SetCurrentStageID(stage)
|
|
gotoState("hasBeenTriggered")
|
|
endif
|
|
endif
|
|
endif
|
|
endFunction
|
|
|
|
int Property TriggerType = 0 Auto
|
|
{0 = OnActivate
|
|
N/A = OnDeath (ACTOR ONLY - Must use "defaultSetStageActorRef" script)
|
|
N/A = OnHit (ACTOR ONLY - Must use "defaultSetStageActorRef" script)
|
|
3 = OnTriggerEnter
|
|
N/A = OnEquipped (ACTOR ONLY - Must use "defaultSetStageActorRef" script)
|
|
5 = OnCombatBegin
|
|
6 = OnCellLoad
|
|
7 = Added to player inventory
|
|
8 = Removed from player inventory
|
|
9 = OnOpen (for Doors and Containers)
|
|
10 = onRead (for books)
|
|
|
|
... etc...
|
|
TODO: Convert to enum when we have them
|
|
} |