Page 1 of 1

Re: Trigger animation on destruction of object?

Posted: Thu Jan 03, 2008 6:46 pm
by Maveritchell

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.

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

Posted: Wed Sep 15, 2010 6:40 pm
by ps2owner
sorry for the bumb but how would you rewind a animation when you fix an object

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

Posted: Thu Sep 16, 2010 1:51 pm
by DarthD.U.C.K.
my guess:

Code: Select all

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

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

Posted: Sat Sep 18, 2010 11:28 pm
by ps2owner
wouldn't it be
repairobja = OnObjectRepair(
function(object, repairer/characterId?!)
if GetEntityName(object) == "objectBnameinZeroEditor" then
RespawnObject("reappearingobject")
RewindAnimation("whateveranimationgroup")
end
end
)

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

Posted: Sun Sep 19, 2010 5:39 am
by DarthD.U.C.K.
yeah, you are right. i changed the code, thanks

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

Posted: Wed Oct 13, 2010 4:46 pm
by ps2owner
just to check is objectBnameinZeroEditor the object you repair and is
reappearingobject the object with the animation?

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

Posted: Wed Oct 13, 2010 4:47 pm
by DarthD.U.C.K.
its the object you repair

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

Posted: Tue Mar 01, 2011 6:41 pm
by ps2owner
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)

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

Posted: Wed Mar 02, 2011 3:47 am
by AQT
In the game mode LUA file after

Code: Select all

function ScriptPostLoad()
but before

Code: Select all

function ScriptInit()