Heres an example:
Destroy object -> all turrets go up. Kill one turret-> busted turret goes on its animation -> Give full health to turret -> turret goes up and repeat
Heres my code so far:
Code: Select all
Command1 = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "panel1" then
PlayAnimation("turret1") -- opens up the tunnel
PlayAnimation("opengun2") -- opens up side1's cannon
PlayAnimation("openthehatch") -- opens up side2's cannon
UnblockPlanningGraphArcs(1)
end
end
)
---------------------------------------------------------------------------
-- this is side 1's code, side2's code is pretty
-- much the same thing but with different anims
Command2 = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "gunside1" then
PauseAnimation("turret1") -- <- thats a bad idea, i know.
PauseAnimation("closegun1")
RewindAnimation("closegun1")
PlayAnimation("closegun1")
-- <-closegun1 sends the turret and its platform into the ground
firstgun = CreateTimer("firstgun")
SetTimerValue(firstgun, (30))
StartTimer(firstgun)
OnTimerElapse(
function(timer)
SetProperty("gunside1", "CurHealth", 800)
PauseAnimation("openthehatch")
RewindAnimation("openthehatch")
PlayAnimation("openthehatch")
DestroyTimer(timer)
end,
firstgun)
end
end
)

