Trigger animation on destruction of object? (FAQ)

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

Jedi Admin
User avatar
Posts: 7420
Joined: Mon Aug 21, 2006 11:03 pm

Re: Trigger animation on destruction of object?

Postby Maveritchell » Thu Jan 03, 2008 6:46 pm

Code: Select all
animateobja = OnObjectKill(
   function(object, killer)
      if GetEntityName(object) == "objectBnameinZeroEditor" then
         PlayAnimation("whateveranimationgroup")
      end
   end
)


Edit: And here's that part about giving points when you kill an object:

Code: Select all
killobjc = OnObjectKill(
   function(object, killer)
      if killer and IsCharacterHuman(killer) and GetEntityName(object) == "objectbeingkillednameinZeroEditor" then
         AddAssaultDestroyPoints(killer)
      end
   end
)


That first part ("killobjc") is the variable name assigned to this event. It can be whatever (unrelated) name you want, so long as you don't use the same name for another event or variable. The line "if...etc." is the conditional statement for giving points. "if killer" is checking to see whether the killer exists. Always add this before you add the line IsCharacterHuman(killer), to prevent crashes if a human kills themselves. "IsCharacterHuman(killer)" checks to see whether the killer was human. This way only humans will recieve points for killing the object. Remove this if you want. The last part of the if statement checks to make sure that the object-being-killed's "name" matches the name you assigned in ZE. This is not the name of the .odf, but the name you assigned in ZE. Sometimes they are the same but not always.

Master Sergeant
User avatar
Posts: 172
Joined: Wed Jun 23, 2010 8:25 pm

Re: Trigger animation on destruction of object? (FAQ)

Postby ps2owner » Wed Sep 15, 2010 6:40 pm

sorry for the bumb but how would you rewind a animation when you fix an object

Master of the Force
User avatar
Posts: 6069
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Trigger animation on destruction of object? (FAQ)

Postby DarthD.U.C.K. » Thu Sep 16, 2010 1:51 pm

my guess:
Code: Select all
repairobja = OnObjectRepair(
   function(object, repairer/characterId?!)
      if GetEntityName(object) == "objectBnameinZeroEditor" then
         RespawnObject("reappearingobject")
         RewindAnimation("whateveranimationgroup")
      end
   end
)
Last edited by DarthD.U.C.K. on Sun Sep 19, 2010 5:40 am, edited 1 time in total.

Master Sergeant
User avatar
Posts: 172
Joined: Wed Jun 23, 2010 8:25 pm

Re: Trigger animation on destruction of object? (FAQ)

Postby ps2owner » Sat Sep 18, 2010 11:28 pm

wouldn't it be
repairobja = OnObjectRepair(
function(object, repairer/characterId?!)
if GetEntityName(object) == "objectBnameinZeroEditor" then
RespawnObject("reappearingobject")
RewindAnimation("whateveranimationgroup")
end
end
)

Master of the Force
User avatar
Posts: 6069
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Trigger animation on destruction of object? (FAQ)

Postby DarthD.U.C.K. » Sun Sep 19, 2010 5:39 am

yeah, you are right. i changed the code, thanks

Master Sergeant
User avatar
Posts: 172
Joined: Wed Jun 23, 2010 8:25 pm

Re: Trigger animation on destruction of object? (FAQ)

Postby ps2owner » Wed Oct 13, 2010 4:46 pm

just to check is objectBnameinZeroEditor the object you repair and is
reappearingobject the object with the animation?

Master of the Force
User avatar
Posts: 6069
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Trigger animation on destruction of object? (FAQ)

Postby DarthD.U.C.K. » Wed Oct 13, 2010 4:47 pm

its the object you repair

Master Sergeant
User avatar
Posts: 172
Joined: Wed Jun 23, 2010 8:25 pm

Re: Trigger animation on destruction of object? (FAQ)

Postby ps2owner » Tue Mar 01, 2011 6:41 pm

Sorry for the bump, but where and what file do I put this in.
(I got it working once, but I deleted that map, so I can't look through source files)

Gametoast Staff
User avatar
Posts: 4967
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA
Projects :: Naboo Selton

Re: Trigger animation on destruction of object? (FAQ)

Postby AQT » Wed Mar 02, 2011 3:47 am

In the game mode LUA file after
Code: Select all
function ScriptPostLoad()

but before
Code: Select all
function ScriptInit()

Return to SWBF2 Modding

Who is online

Users browsing this forum: No registered users and 1 guest