Data Realms Fan Forums
http://45.55.195.193/

IsEmitting/EnableEmission problem
http://45.55.195.193/viewtopic.php?f=73&t=16067
Page 1 of 1

Author:  MaximDude [ Fri Jul 31, 2009 10:33 am ]
Post subject:  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?

Author:  piipu [ Fri Jul 31, 2009 11:27 am ]
Post subject:  Re: IsEmitting/EnableEmission problem

Replace emitter:[something] with ToAEmitter(emitter):[something]. Kyred explained the reason for this in length in that particle animation thread.

Author:  MaximDude [ Fri Jul 31, 2009 12:33 pm ]
Post subject:  Re: IsEmitting/EnableEmission problem

Ok, that works.
Thanks :D

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/