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.
 
 
 

69 lines
1.7 KiB

scriptName TrapPoisonGasCough extends ActiveMagicEffect
{used to make the player cough when they are poisoned
by gas and to throw detection events}
;===========================================================
float property fCoughTime = 5.0 auto
float property fCoughRand = 2.0 auto
float property afSmallMotorStrength = 0.2 auto
float property afBigMotorStrength = 0.2 auto
float property afDuration = 1.0 auto
actor myActor
sound property tempSound Auto
{temp sound till we can have the player "say" a line}
bool stateActive = false
float coughTime
topic property DialogueGenericPoisonCoughBranchTopic auto
bool myActorIsPlayer = false
auto State Waiting
Event OnEffectStart(Actor akTarget, Actor akCaster)
myActor = akTarget
goToState("active")
endEvent
endState
state active
event onBeginState()
stateActive = TRUE
if myActor == game.getPlayer()
myActorIsPlayer = True
endif
CoughLoop()
endEvent
event OnEffectFinish(Actor akTarget, Actor akCaster)
stateActive = FALSE
goToState("Waiting")
endEvent
endState
function coughLoop()
while stateActive
utility.wait(randTimerFloat())
DoCough()
endWhile
endFunction
function DoCough()
;game.getPlayer().say(cough)
;tempSound.play(myActor)
myActor.say(DialogueGenericPoisonCoughBranchTopic)
if myActorIsPlayer
myActor.createDetectionEvent(myActor, 30)
game.ShakeController(afSmallMotorStrength, afBigMotorStrength, afDuration)
endif
endFunction
float function randTimerFloat()
float fReturn = fCoughTime + utility.RandomFloat((0-fCoughRand), fCoughRand)
return fReturn
endFunction
Event OnEffectStart(Actor akTarget, Actor akCaster)
endEvent
event OnEffectFinish(Actor akTarget, Actor akCaster)
endEvent