130 lines
3.4 KiB
Plaintext
130 lines
3.4 KiB
Plaintext
Scriptname _00E_MQ11c_OorbayaBallistaScript extends TrapBase
|
|
|
|
;Dart Trap extending TrapBase
|
|
;integrated with the TrapTriggerBase
|
|
;
|
|
;================================================================
|
|
|
|
import debug
|
|
import utility
|
|
import custom
|
|
|
|
int property shotCount = 3 auto
|
|
{This property track the ammo that the ballista has, and starts with}
|
|
;int numShots = 20 ;might want to make this a property
|
|
float fireRate = 0.1
|
|
float property initialDelay = 0.0 auto
|
|
weapon property ballistaWeaponM auto
|
|
weapon property ballistaWeaponL auto
|
|
weapon property ballistaWeaponR auto
|
|
Ammo Property _00E_MQ11c_OorbayaBallistBolt Auto
|
|
GlobalVariable Property _00E_MQ11c_BallistaFired Auto
|
|
Actor Property MQ11c_SC10_RyneusOorbaya Auto
|
|
bool property isFiring auto hidden
|
|
bool property isLoaded auto hidden
|
|
bool property shotFired = false auto hidden
|
|
bool property weaponResolved = false auto hidden
|
|
Quest Property MQ11c Auto
|
|
ReferenceAlias Property Oorbaya Auto
|
|
|
|
Function initialize()
|
|
|
|
endFunction
|
|
|
|
|
|
Function ResetLimiter()
|
|
shotFired = false ;shotCount is scoped outside of the OnActivate blocks. This will reset scopecount to 0, extending the firing time.
|
|
EndFunction
|
|
|
|
|
|
Function fireTrap()
|
|
if !TrapDisarmed
|
|
_00E_MQ11c_BallistaFired.SetValue(1)
|
|
Oorbaya.GetActorReference().SetGhost(False)
|
|
isFiring = True
|
|
objectReference TrapSelf = self as objectReference
|
|
;TRACE("fireTrap called")
|
|
WindupSound.play( self as ObjectReference) ;play windup sound
|
|
wait( initialDelay ) ;wait for windup
|
|
; if (fireOnlyOnce == True) ;If this can be fired only once then disarm
|
|
; trapDisarmed = True
|
|
; endif
|
|
while(shotcount > 0) && !shotfired && isLoaded
|
|
if shotCount == 3
|
|
playAnimation("Trigger01") ;fire anim 01
|
|
ballistaWeaponM.fire( TrapSelf, _00E_MQ11c_OorbayaBallistBolt ) ;fire 01
|
|
shotcount -= 1
|
|
WaitForAnimationEvent("FTrans01")
|
|
playAnimationAndWait("Reset01","RTrans01") ;reset anim 01
|
|
elseIf ShotCount == 2
|
|
playAnimation("Trigger02") ;fire anim 02
|
|
ballistaWeaponL.fire( TrapSelf, _00E_MQ11c_OorbayaBallistBolt ) ;fire 02
|
|
shotcount -= 1
|
|
WaitForAnimationEvent("FTrans02")
|
|
playAnimationAndWait("Reset02","RTrans02") ;reset anim 02
|
|
elseIf ShotCount == 1
|
|
playAnimation("Trigger03") ;fire anim 03
|
|
ballistaWeaponR.fire( TrapSelf, _00E_MQ11c_OorbayaBallistBolt ) ;fire 03
|
|
shotcount -= 1
|
|
WaitForAnimationEvent("FTrans03")
|
|
;playAnimationAndWait("Reset03","RTrans03") ;reset anim 03
|
|
endIf
|
|
shotFired = True
|
|
Wait(1)
|
|
if (loop == TRUE) ;Reset Limiter
|
|
resetLimiter()
|
|
endif
|
|
endWhile
|
|
|
|
if isLoaded
|
|
isFiring = false
|
|
;playAnimation("idle")
|
|
goToState("Reset")
|
|
endif
|
|
|
|
endif
|
|
|
|
endFunction
|
|
|
|
State Reset
|
|
|
|
Event OnBeginState()
|
|
;TRACE("State Reset")
|
|
if shotcount > 0
|
|
;shotCount = 3
|
|
GoToState ( "Idle" )
|
|
Else
|
|
TrapDisarmed = True
|
|
GoToState ("Reset")
|
|
endif
|
|
|
|
endEvent
|
|
|
|
Event OnActivate( objectReference activateRef )
|
|
;TRACE("Reset trigger")
|
|
EndEvent
|
|
|
|
endState
|
|
|
|
;-----------------------------------------------
|
|
|
|
event onLoad()
|
|
isLoaded = TRUE
|
|
if isFiring == True
|
|
fireTrap()
|
|
endif
|
|
if shotCount == 3
|
|
playAnimationAndWait("Reset03","RTrans03") ;reset anim 01
|
|
elseIf ShotCount == 2
|
|
playAnimationAndWait("Reset01","RTrans01") ;reset anim 02
|
|
elseIf ShotCount == 1
|
|
playAnimationAndWait("Reset02","RTrans02") ;reset anim 02
|
|
endIf
|
|
EndEvent
|
|
|
|
event onUnload()
|
|
; debug.Trace(self + " has recieved onUnload event")
|
|
isLoaded = FALSE
|
|
endEvent
|
|
|