Page 1 of 1

Play animation when destroying an object notworking [Solved]

Posted: Tue Mar 28, 2017 1:56 pm
by CT108
Hi GT

I try to play an animation when an object is destroyed but nothing works :(

Here's the code I found on GT :
Hidden/Spoiler:
[code]animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "objectBnameinZeroEditor" then
PlayAnimation("whateveranimationgroup")
end
end
)[/code]
Here's the code of my .lua :
Hidden/Spoiler:
[code]function ScriptPostLoad()
animatetan4_prop_Console = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "myg1_prop_energy_collector_shield3" then
PlayAnimation("shieldright")
end
end
)[/code]
And the animation pics from Zero Editor :
Hidden/Spoiler:
Image
Image
Thanks for the help :D

Re: Trigger animation when destroying an object not working

Posted: Wed Mar 29, 2017 4:08 am
by Marth8880
Try this code instead:

Code: Select all

animatetan4_prop_Console = OnObjectKillName(
	function(object, killer)
		PlayAnimation("shieldright")
	end,
"myg1_prop_energy_collector_shield3"
)

Re: Trigger animation when destroying an object not working

Posted: Thu Mar 30, 2017 11:33 am
by CT108
Marth8880 wrote:Try this code instead:

Code: Select all

animatetan4_prop_Console = OnObjectKillName(
	function(object, killer)
		PlayAnimation("shieldright")
	end,
"myg1_prop_energy_collector_shield3"
)
It has not worked :(
Are the pics showed ? Cuz I can't see them sometimes :/

EDIT : I fixed the problem, I have inverted tan4_prop_Console and myg1_prop_energy_collector_shield3 .... yep we can call that a fail.