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



Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
 ATTN: Boxes 
Author Message
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post Re: ATTN: Boxes
Woops. yeah it's "y" Must've been not paying attention.


Tue Jul 07, 2009 11:43 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: ATTN: Boxes
Code:
function Update(self)
   self.boxTL = Vector(self.Pos.X - 24 , self.Pos.Y - 24);
   self.boxBR = Vector(self.Pos.X + 24 , self.Pos.Y + 24);
   self.boxboundary = Box(self.boxTL , self.boxBR);
   for p in MovableMan.Particles do
      if p.PresetName == "cube edge glow" then
         if not self.boxboundary:WithinBox(p.Pos) then
            p.ToDelete = True;
         end
      end
   end
end


"p" is what you're calling all particles in movableman. WithinBox is a function based on the box, NOT on your particle; you have to use "boxname":WithinBox(vector to check), not "particletocheck:WithinBox(boxname)". It seems counterintuitive but it actually isn't. Also, you can use if not, rather than if then do nothing else do something.

And CC's vector coordinates are all based as if the entire scene were the fourth quadrant of a graph; more Y pushes you down and more X pushes you right.


Wed Jul 08, 2009 12:39 am
Profile
User avatar

Joined: Thu May 28, 2009 3:59 pm
Posts: 209
Reply with quote
Post Re: ATTN: Boxes
Grif wrote:
you have to use "boxname":WithinBox(vector to check)

Thanks. I had started working from that direction, but all the overloads I was getting turned me to flipping it around where at least I was only getting nils. It is at least giving me no errors now, more testing and tweaking is now in order to see if I can get it to do what I want it to do.


Wed Jul 08, 2009 3:04 am
Profile
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post Re: ATTN: Boxes
Code:
self.tripwire = Box(Vector(self.Pos.X - 100, self.Pos.Y),Vector(self.Pos.X + 100, self.Pos.Y + 500));
for actor in MovableMan.Actors do
   if self.tripwire:WithinBox(actor.Pos) then
      actor:GibThis();
   end
end


Um just trying to get boxes working, and it's not working sadly. Does it look like anything here is wrong? The script is attached to a pinned object and this is in update.


Tue Jul 28, 2009 10:49 pm
Profile
User avatar

Joined: Sun May 31, 2009 1:04 am
Posts: 308
Reply with quote
Post Re: ATTN: Boxes
What kind of errors does the console give?

Humor me and try doing ToActor(actor):GibThis(); instead of actor:GibThis(); and see if that works.


Tue Jul 28, 2009 11:01 pm
Profile
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post Re: ATTN: Boxes
So sorry, it was my error. Nothing was really wrong with it :)


Edit: So lua can't work on bunker modules, correct?


Tue Jul 28, 2009 11:45 pm
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: ATTN: Boxes
Mind wrote:
So lua can't work on bunker modules, correct?

Not unless you put in a MOSRotating or something as a ChildObject.


Wed Jul 29, 2009 12:04 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 22 posts ]  Go to page Previous  1, 2

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.060s | 13 Queries | GZIP : Off ]