Can an object belong to more than one SimGroup?
by Jeff Trier · in Torque Game Engine · 01/17/2004 (4:53 am) · 5 replies
I am using the newest RealmWars build to create a 2 player Board Game of sorts. In this game the players will need to be able to cycle through thier own pieces (player objects).
I was looking at SimGroups, and it seems that assigning the objects to say "Team1Group and Team2Group" might be the best way to go when dealing with this type of object cycling. The only problem is, when I try and have the player objects added via "Team1Group.add(%player);", it will remove the object from the missionCleanup group. So the options in my mind are:
1) Have a reference to the object in both missionCleanup and TeamxGroup if posible.
2) Have the object reside soley in TeamxGroup, then add TeamxGroup.delete() in "function resetMission"
3) Look for another way.
I am fairly new to the group idea, so any help would be great. Also, if there may be a cleaner way to achive my goal, please let me know.
Thanks,
-Jeff
I was looking at SimGroups, and it seems that assigning the objects to say "Team1Group and Team2Group" might be the best way to go when dealing with this type of object cycling. The only problem is, when I try and have the player objects added via "Team1Group.add(%player);", it will remove the object from the missionCleanup group. So the options in my mind are:
1) Have a reference to the object in both missionCleanup and TeamxGroup if posible.
2) Have the object reside soley in TeamxGroup, then add TeamxGroup.delete() in "function resetMission"
3) Look for another way.
I am fairly new to the group idea, so any help would be great. Also, if there may be a cleaner way to achive my goal, please let me know.
Thanks,
-Jeff
About the author
Originally a Classical/Metal musician, I've always been attracted to anything involving computers, including: Networking, PC Building and Repair, software design and coding. I've been involved with game design and development for over 10 years.
#2
Hmmm... I guess I need to read a little bit more on SimSets. I was under the impression that there could only be one SimSet at a time. Thanks for pointing that out.
Off for more reading!
-Jeff
01/17/2004 (6:58 am)
Thanks Ian,Hmmm... I guess I need to read a little bit more on SimSets. I was under the impression that there could only be one SimSet at a time. Thanks for pointing that out.
Off for more reading!
-Jeff
#3
I can get a list of the simSet objects to come up in console like so...
("Team" @ %shapeTeam @ "Set").listObjects();
...and it works fine. But when I try to put them into a variable like so...
%list = ("Team" @ %shapeTeam @ "Set").listObjects();
echo ("List: " @ %list);
...it doesn't work.
I still get a list in console, but the variable is empty and I get this error:
rw/server/scripts/commands.cs (101): Call to listObjects in serverCmdNextTeamUnit uses result of void function call.
Line 101 is where "%list = ("Team" @ %shapeTeam @ "Set").listObjects();" is entered in.
Now, I think this error means that the listObjects command doesn't return a value, although it still manages to send the list to console.
Am I approaching this the wrong way?
Thanks,
-Jeff
01/17/2004 (9:34 pm)
Welp, so far so good. The only problem I am having now is getting the list of the simSet objects into a variable. I can get a list of the simSet objects to come up in console like so...
("Team" @ %shapeTeam @ "Set").listObjects();
...and it works fine. But when I try to put them into a variable like so...
%list = ("Team" @ %shapeTeam @ "Set").listObjects();
echo ("List: " @ %list);
...it doesn't work.
I still get a list in console, but the variable is empty and I get this error:
rw/server/scripts/commands.cs (101): Call to listObjects in serverCmdNextTeamUnit uses result of void function call.
Line 101 is where "%list = ("Team" @ %shapeTeam @ "Set").listObjects();" is entered in.
Now, I think this error means that the listObjects command doesn't return a value, although it still manages to send the list to console.
Am I approaching this the wrong way?
Thanks,
-Jeff
#4
Try this:
%set = "Team" @ %shapeTeam @ "Set";
for(%i=0;%i<%set.getCount();%i++) {
%obj = %set.getObject(%i);
%obj.doWhateveryouWant();
}
set.listObjects() actually returns void and just outputs to the console..
-Pascal
01/17/2004 (10:13 pm)
Jeff:Try this:
%set = "Team" @ %shapeTeam @ "Set";
for(%i=0;%i<%set.getCount();%i++) {
%obj = %set.getObject(%i);
%obj.doWhateveryouWant();
}
set.listObjects() actually returns void and just outputs to the console..
-Pascal
Associate Ian Omroth Hardingham
Mode 7 Games