Page 1 of 1

Multiple animation problem [solved]

Posted: Sat Feb 05, 2011 8:04 pm
by asleeponduty
In my capture-the flag map, I am trying to script several animations that will raise the cannons out of these cannon-pits I created, and when one gets destroyed it is lowered down into the pit, is given full health and raised.
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
		)

Re: Multiple animation problem

Posted: Sun Feb 06, 2011 1:41 pm
by DarthD.U.C.K.
the code looks good imho, what exactly doesnt work?

Re: Multiple animation problem

Posted: Wed Feb 09, 2011 5:36 pm
by asleeponduty
The problem was the animations wouldnt run, for one of the turrets


Edit: Solved. It was an animation munge error