Play effect on remotedroid spawn?
Moderator: Moderators
- authraw
- 1st Lieutenant

- Posts: 445
- Joined: Mon Jun 26, 2006 3:45 pm
Play effect on remotedroid spawn?
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

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Re: Play effect on remotedroid spawn?
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.
- authraw
- 1st Lieutenant

- Posts: 445
- Joined: Mon Jun 26, 2006 3:45 pm
Re: Play effect on remotedroid spawn?
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?)
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?)
- Maveritchell
- Jedi Admin

- Posts: 7366
- Joined: Mon Aug 21, 2006 11:03 pm
Re: Play effect on remotedroid spawn?
That goes in ScriptPostLoad of every .lua of every map you want to have that happen in.authraw wrote:Now... where do I put it? (Which lua do I put that in, and where do I call it?
Sides/Sidename/effects.authraw wrote:Where do I have to save the effect so that it will find it?)
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Re: Play effect on remotedroid spawn?
Edited the code - I was missing 'On' from OnCharacter...
- authraw
- 1st Lieutenant

- Posts: 445
- Joined: Mon Jun 26, 2006 3:45 pm
Re: Play effect on remotedroid spawn?
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! 
EDIT: Ok, I tried it, and I get this error in the log:
The effect does not play (and the map does not crash, either.)
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>-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Re: Play effect on remotedroid spawn?
Oops. Try this:
:then thisL
Code: Select all
OnCharacterDispenseControllable(
function (player, controllable)
AttachEffectToMatrix("effectname", GetEntityMatrix(controllable))
end
)
Code: Select all
OnCharacterDispenseControllable(
function (player, controllable)
AttachEffectToMatrix("effectname", GetEntityMatrix(GetEntityName(controllable)))
end
)
