Game Development Community

Loop through all objects ?

by Kevin Johnson · in Torque Game Engine · 06/22/2004 (12:56 pm) · 2 replies

This should prolly go in the scripting forum but here goes.
is there a quick way to loop through all the objects/players on the dedicated server, to do a gettransform to get where everyone is?

#1
06/22/2004 (1:13 pm)
Sure.. you can either go through MissionGroup, or go through the $InstantGroup mapping. Since they are groups, you could do something like:

%gID = MissionGroup.getId();

   // If group exists
   if (%gID != -1) {
      
      %gCount = MissionGroup.getCount();
      for (%idx = 0; %idx < %gCount; %idx++) {
         %obj = %gID.getObject(%idx);

         // Determine if it's a player

         // Get it's position
         %obj.getPosition();
      }
    }

Or something like that...

- Brett
#2
06/22/2004 (1:24 pm)
Kewl thanx..