Page 1 of 1

Replaying an animation?

Posted: Sat Jun 28, 2008 8:55 pm
by theITfactor
If i have an OnObjectKill that plays an animation, but want it so that when the animation is complete, killing the object again also restarts and replays the animation, what do i do? right now you can only play the animation once, it won't let you play it again if you kill the object a second time

Code: Select all

tur1 = OnObjectKill(
   function(object, killer)
      if GetEntityName(object) == "tat2_bldg_wall_40s" then
         PauseAnimation("tur1")
         RewindAnimation("tur1")
         PlayAnimation("tur1")
      end
   end
)
Offline that lets me retrigger the animation, but online it does not.

Re: Replaying an animation?

Posted: Sat Jun 28, 2008 9:06 pm
by Teancum
It's probably finding the same instance of the object. I'm not sure how you would do it in LUA, but essentially you may need to set "object" back to NULL or nothing. My guess is it's finding that object and it's already flagged as dead.

Re: Replaying an animation?

Posted: Sun Jun 29, 2008 10:30 am
by Maveritchell
An easy way around the problem Tean mentioned might just be to make the object be auto-regenerating and use OnObjectDamage instead of OnObjectKill.