Looking for info about "$instantGroup"
by DavidRM · in Torque Game Engine · 12/10/2002 (10:18 am) · 2 replies
Is there someplace that (or someone who) can describe how to use $instantGroup?
From what I can see, newly create objects are added to whatever "group" $instantGroup is set to. Is this correct? Is there any information/documentation about the available "groups", like MissionCleanup, ServerGroup, etc.?
I'm still digging, and I'll post what I can find, but I would appreciate any assistance in this regard.
Many thanks!
-David
From what I can see, newly create objects are added to whatever "group" $instantGroup is set to. Is this correct? Is there any information/documentation about the available "groups", like MissionCleanup, ServerGroup, etc.?
I'm still digging, and I'll post what I can find, but I would appreciate any assistance in this regard.
Many thanks!
-David
Torque Owner DavidRM
First off, all of those are SimGroup objects. Which is somewhat obvious, but I mention it for completeness.
ServerGroup is server-side objects.
MissionGroup is created (under ServerGroup) from the mission (.mis) file when a mission is started.
MissionCleanup is created (also under ServerGroup) to hold all mission objects, like cameras and players and projectiles and so on.
There is also RootGroup, but I don't know that it gets used for much except ServerGroup.
$instantGroup is the SimGroup used whenever a new object is created in the script. The "default" SimGroup to use, so to speak. So you can set $instantGroup to a particular SimGroup before calling a set of functions, and all objects created in those functions will be put in that SimGroup.
The problem I was having as described in my "Off-by-one" thread stemmed from what $instantGroup was set to at the time the player logged in. Since Paintball Net has players on the server that aren't necessarily in a mission, I had to be more explicit about the SimGroup where objects were being created. If a player logged in while a mission was running, they were not put in the mission (they go to the Ready Room), but their inventory objects were being created in MissionCleanup (by default, from $instantGroup).
Anyway, that's what I've found, and was able to (really this time) fix the problem I was having with certain script objects getting "lost."
Hope this helps. If someone can provide more information about the SimGroups and $instantGroup (and maybe "Further Tips for Safe SimGroup Use in Scripts"), please feel free to contribute.
-David