IsEmitting/EnableEmission problem
This script is attached to a particle.
That particle checks for emitters with a certain PresetName within range and is supposed to activate them.
This is the code:
Code:
function Update(self)
for emitter in MovableMan.Particles do
if (emitter.Pos.X >= self.Pos.X - 100) and (emitter.Pos.X <= self.Pos.X + 100) and (emitter.Pos.Y >= self.Pos.Y - 60) and (emitter.Pos.Y <= self.Pos.Y + 60) and emitter.ClassName == "AEmitter" and emitter.PresetName == "blahblahblah" then
if emitter:IsEmitting() == false then
emitter:EnableEmission(true);
end
end
end
end
What i'm getting is: 'attemt to call method 'IsEmitting' (a nil value)
I tried skipping the 'if emitter:IsEmitting()' part and going directly to 'emitter:EnableEmission()' and what I got is: 'attemt to call method 'EnableEmission' (a nil value)
Now, I know that there shouldn't be anything wrong with it, because if I attach it directly to the emitter, it works.
What is wrong with this damn thing and how do I fix it?