Data Realms Fan Forums http://45.55.195.193/ |
|
Why is this affecting all particles? http://45.55.195.193/viewtopic.php?f=73&t=15758 |
Page 1 of 1 |
Author: | Asatruer [ Wed Jul 08, 2009 4:47 am ] |
Post subject: | 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 |
Author: | mail2345 [ Wed Jul 08, 2009 4:49 am ] |
Post subject: | 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. |
Author: | Grif [ Wed Jul 08, 2009 5:01 am ] |
Post subject: | 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" |
Author: | Asatruer [ Wed Jul 08, 2009 6:11 am ] |
Post subject: | 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. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |