Page 1 of 1
Play effect on remotedroid spawn?
Posted: Mon Jan 14, 2008 10:43 pm
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)?
Re: Play effect on remotedroid spawn?
Posted: Thu Jan 17, 2008 10:43 pm
by Ace_Azzameen_5
Like this?
Code: Select all
OnCharacterDispenseControllable(
function (player, controllable)
AttachEffectToMatrix("effectname", GetEntityMatrix(GetEntityClassName(controllable)))
end
)
Re: Play effect on remotedroid spawn?
Posted: Fri Jan 18, 2008 7:01 pm
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?)
Re: Play effect on remotedroid spawn?
Posted: Fri Jan 18, 2008 7:30 pm
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.
Re: Play effect on remotedroid spawn?
Posted: Fri Jan 18, 2008 8:53 pm
by Ace_Azzameen_5
Edited the code - I was missing 'On' from OnCharacter...
Re: Play effect on remotedroid spawn?
Posted: Fri Jan 18, 2008 11:18 pm
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!
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.)
Re: Play effect on remotedroid spawn?
Posted: Sat Jan 19, 2008 8:51 am
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
)