Play animation when destroying an object notworking [Solved]

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
User avatar
CT108
Rebel Sergeant
Rebel Sergeant
Posts: 186
Joined: Mon Aug 22, 2016 6:20 am
Projects :: None
Games I'm Playing :: CS2
xbox live or psn: Captain CT108
Location: Xanadu

Play animation when destroying an object notworking [Solved]

Post 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
Last edited by CT108 on Thu Mar 30, 2017 12:01 pm, edited 1 time in total.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Trigger animation when destroying an object not working

Post by Marth8880 »

Try this code instead:

Code: Select all

animatetan4_prop_Console = OnObjectKillName(
	function(object, killer)
		PlayAnimation("shieldright")
	end,
"myg1_prop_energy_collector_shield3"
)
User avatar
CT108
Rebel Sergeant
Rebel Sergeant
Posts: 186
Joined: Mon Aug 22, 2016 6:20 am
Projects :: None
Games I'm Playing :: CS2
xbox live or psn: Captain CT108
Location: Xanadu

Re: Trigger animation when destroying an object not working

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