View unanswered posts | View active topics It is currently Thu Dec 26, 2024 6:12 pm



Reply to topic  [ 3 posts ] 
 IsEmitting/EnableEmission problem 
Author Message
User avatar

Joined: Wed Nov 22, 2006 3:19 pm
Posts: 2073
Reply with quote
Post 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?


Fri Jul 31, 2009 10:33 am
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: IsEmitting/EnableEmission problem
Replace emitter:[something] with ToAEmitter(emitter):[something]. Kyred explained the reason for this in length in that particle animation thread.


Fri Jul 31, 2009 11:27 am
Profile
User avatar

Joined: Wed Nov 22, 2006 3:19 pm
Posts: 2073
Reply with quote
Post Re: IsEmitting/EnableEmission problem
Ok, that works.
Thanks :D


Fri Jul 31, 2009 12:33 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.086s | 13 Queries | GZIP : Off ]