View unanswered posts | View active topics It is currently Sat Apr 27, 2024 12:58 pm



Reply to topic  [ 4 posts ] 
 Why is this affecting all particles? 
Author Message
User avatar

Joined: Thu May 28, 2009 3:59 pm
Posts: 209
Reply with quote
Post Why is this affecting all particles?
Starting a new topic since I do not believe this is a boxes related problem.
My logic must be flawed, but as far as I can tell this should only stop Particles with the specified PresetNames that are not within the defined box and not affect any other Particles.
Code:
   for p in MovableMan.Particles do
      if p.PresetName == "cube edge glow" or "cube edge glow2" then
         if not self.boxboundary:WithinBox(p.Pos) then
            p.Vel = Vector(0,0)
         end
      end
   end
When this script is running all bullets and shells that are not within the defined box hang in place a short distance from the muzzle and very very slowly drift down.


Wed Jul 08, 2009 4:47 am
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Why is this affecting all particles?
Code:
p.PresetName == "cube edge glow" or "cube edge glow2"

Err no, lua does not work like that. That checks if the name is "cube edge glow" or if the string "cube edge glow" can be converted to a true boolean.


Wed Jul 08, 2009 4:49 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Why is this affecting all particles?
To clarify you have to do the full logic statement for each check.

if particle.presetname == "whatever" or particle.presetname == "whatever"


Wed Jul 08, 2009 5:01 am
Profile
User avatar

Joined: Thu May 28, 2009 3:59 pm
Posts: 209
Reply with quote
Post Re: Why is this affecting all particles?
Ah, I imprecisely reproduced the code from my c4spray detonators... next time I'll remember(hahaha) to not rely on memory and look it up. Thanks.


Wed Jul 08, 2009 6:11 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.107s | 15 Queries | GZIP : Off ]