Play effect on remotedroid spawn?

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
authraw
1st Lieutenant
1st Lieutenant
Posts: 445
Joined: Mon Jun 26, 2006 3:45 pm

Play effect on remotedroid spawn?

Post by authraw »

I would like to play an effect that I made with the particleeditor whenever my unit uses the remote droid. Is it possible to get this effect to play either as soon as the weapon is used or as soon as the remotedroid spawns (in the location of the remotedroid)?
Ace_Azzameen_5
Jedi
Jedi
Posts: 1119
Joined: Sat Apr 23, 2005 8:52 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: Play effect on remotedroid spawn?

Post by Ace_Azzameen_5 »

Like this?

Code: Select all

OnCharacterDispenseControllable(
 function (player, controllable)
AttachEffectToMatrix("effectname", GetEntityMatrix(GetEntityClassName(controllable)))
end
)
Last edited by Ace_Azzameen_5 on Fri Jan 18, 2008 8:54 pm, edited 1 time in total.
User avatar
authraw
1st Lieutenant
1st Lieutenant
Posts: 445
Joined: Mon Jun 26, 2006 3:45 pm

Re: Play effect on remotedroid spawn?

Post by authraw »

Yes, exactly like that! ;)

Now... where do I put it? (Which lua do I put that in, and where do I call it? Where do I have to save the effect so that it will find it?)
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Play effect on remotedroid spawn?

Post by Maveritchell »

authraw wrote:Now... where do I put it? (Which lua do I put that in, and where do I call it?
That goes in ScriptPostLoad of every .lua of every map you want to have that happen in.
authraw wrote:Where do I have to save the effect so that it will find it?)
Sides/Sidename/effects.
Ace_Azzameen_5
Jedi
Jedi
Posts: 1119
Joined: Sat Apr 23, 2005 8:52 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: Play effect on remotedroid spawn?

Post by Ace_Azzameen_5 »

Edited the code - I was missing 'On' from OnCharacter...
User avatar
authraw
1st Lieutenant
1st Lieutenant
Posts: 445
Joined: Mon Jun 26, 2006 3:45 pm

Re: Play effect on remotedroid spawn?

Post by authraw »

Ah, now it makes a little more sense. I was wondering where I was supposed to call it--but now I see it's a listener. ;) Haven't tried it yet, but I'm sure it will work. If not, I'll be back with questions! :D

EDIT: Ok, I tried it, and I get this error in the log:

Code: Select all

Message Severity: 3
.\Source\LuaHelper.cpp(312)
CallProc failed: bad argument #1 to `GetEntityMatrix' (string expected, got nil)
stack traceback:
	[C]: in function `GetEntityMatrix'
	(none): in function <(none):39>
The effect does not play (and the map does not crash, either.)
Ace_Azzameen_5
Jedi
Jedi
Posts: 1119
Joined: Sat Apr 23, 2005 8:52 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: Play effect on remotedroid spawn?

Post by Ace_Azzameen_5 »

Oops. Try this:

Code: Select all

OnCharacterDispenseControllable(
function (player, controllable)
AttachEffectToMatrix("effectname", GetEntityMatrix(controllable))
end
)
:then thisL

Code: Select all

OnCharacterDispenseControllable(
function (player, controllable)
AttachEffectToMatrix("effectname", GetEntityMatrix(GetEntityName(controllable)))
end
)
Post Reply