Game Development Community

structures and groups

by Ian Omroth Hardingham · in Torque Game Engine · 03/25/2002 (10:52 am) · 2 replies

Well, I'm pretty sure you can't just use any old struct command in script but can anyone tell me how to make my own Group?

I'm not sure what they are but they appear to be bins full of pointers with a getCount and a getObject command.

#1
03/25/2002 (2:26 pm)
The getCount and getObject script functions should be called on a SimSet or SimGroup object. A SimSet or SimGroup object is used to manage groups of other objects.

SimGroup is derived from SimSet. To tell you the truth I'm not exactly sure what the difference is between them, although I think that SimGroup uses a hash table to more quickly find objects in the group on findObject.

For an example of creating a SimGroup object (and SimSet should work the same way) just look at any mission file. The whole .mis file is an object creation statement for a SimGroup object named MissionGroup. Inside that statement a lot more object creation goes on, and those objects get added to MissionGroup since their creation statements are contained inside the MissionGroup creation statement. And MissionGroup can contain more SimGroup or SimSet objects, which themselves can contain other objects, etc.

You can also add to a SimGroup or SimSet after creating it, or remove from it. Check out the various ConsoleMethod declarations in console/simBase.cc for SimSet, to see all the functions you can call on SimSet and SimGroup objects.
#2
03/26/2002 (2:34 am)
cheers, it's a bit clearer now.