Replaying an animation?

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
theITfactor
Chief Warrant Officer
Chief Warrant Officer
Posts: 327
Joined: Wed Jun 28, 2006 12:56 pm
Projects :: The Pwnfest and Games Complex
Games I'm Playing :: SWTOR
xbox live or psn: You and I Know
Location: The Old Republic
Contact:

Replaying an animation?

Post 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.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Replaying an animation?

Post 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.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Replaying an animation?

Post 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.
Post Reply