No, the method is fine, you are using an array and therefore you do NOT have to have different names...
The problem is your coding...
Code: Select all
lamp_effects()
{
lamps = getentarray("lamps","targetname");
for(i=0;i<lamps.size;i++)
lamps[i] thread lamps_fx ();
}
Ok, so above, we no have an array of lamps and every lamp now is threaded to a function.
Code: Select all
lamps_fx()
{
lamps = getent("lamps","targetname");
level._effect["fire"] = loadfx ("fx/fire/flame_small_em.efx");
maps\mp\_fx::loopfx("fire", ("lamps"), 0.6);
}
Now, for some reason, you have chosen to detect the lamp again, you do not need to, you threaded the lamp above...
Also, the "level._effect" should be put in your main, not your function.
And another thing, is your "loopfx" function is wrong... This is what it should be referring to...
loopfx(fxId, fxPos, waittime, fxPos2, fxStart, fxStop, timeout)
fxId = Name of FX
fxPos = Origin
waittime = how many times a second should the fx be played
fxPos2 = direction origin
The last 3, you can ignore...
So, change this code to the following...
Code: Select all
lamps_fx()
{
maps\mp\_fx::loopfx("fire", self.origin, 0.6, (self.origin + (0,0,1));
}
Or you can rewrite the entire thing to..
Code: Select all
lamp_effects()
{
lamps = getentarray("lamps","targetname");
for(i=0;i<lamps.size;i++)
maps\mp\_fx::loopfx("fire", lamps[i].origin, 0.6, (lamps[i].origin + (0,0,1));
}
Although, this entire script would be more map efficient if you did not use the script_origins and just used numbered origins
