View unanswered posts | View active topics It is currently Mon Dec 30, 2024 9:25 pm



Reply to topic  [ 3 posts ] 
 Loop through all MOSRotatings? 
Author Message
User avatar

Joined: Sat Jun 19, 2010 5:02 pm
Posts: 331
Location: Mekkan
Reply with quote
Post Loop through all MOSRotatings?
How do you loop through all the MOSRotatings (well, anything with a sprite, like limbs, guns, grenades, etc.) on the map? Because I'd like to check if they're in a box and if so gib them.


Tue Aug 16, 2011 4:07 am
Profile
User avatar

Joined: Sat Jun 19, 2010 5:02 pm
Posts: 331
Location: Mekkan
Reply with quote
Post Re: Loop through all MOSRotatings?
Found it myself. In the mission Citadel, the dart's Lua uses it.
Code:
   for i = 1 , MovableMan:GetMOIDCount() - 2 do
      part = MovableMan:GetMOFromID(i);
      if part.ClassName ~= "MOPixel" then
         part = ToMovableObject(part);
         
         if part ~= nil then
            
            --Do stuff in here with it
            
         end
         
         
      end
   end


Assuming self in this script is an MOSRotating that's pinned and can't collide with things, how do you check if the part is inside the boundaries of yourself?


Oh, and is it possible to make an MOSRotating "On top"; as in it gets drawn after everything else it can?


Thu Aug 18, 2011 4:21 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Loop through all MOSRotatings?
To check for location extremely simply, set up a Box.

It's literally constructed just like that:
self.box = Box(Vector(pointx,pointy),Vector(pointx,pointy));

Then, just do self.box:WithinBox(part) or whatever you need.

Also, the draw order stacking is hardcoded, unfortunately.

Craft are always above actors which are always above guns which are always above magazines which are always above loose particles.


Thu Aug 18, 2011 2:28 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.019s | 14 Queries | GZIP : Off ]