Unique mission Object names.
by Peterjohn Griffiths · in Torque Game Engine · 12/10/2007 (12:42 pm) · 7 replies
I need to auto generate a name for each object in a mission when its created. This name needs to be unique. I also need any object that is loaded from a mission file that doesn't have a name to auto generate a name.
Can anyone point me in the directions of the code that is run when an object is created in a mission in the editor and when the mission is loaded in game. I can't seem to figure out how this is done.
Many thanks.
Can anyone point me in the directions of the code that is run when an object is created in a mission in the editor and when the mission is loaded in game. I can't seem to figure out how this is done.
Many thanks.
#2
I know all objects are given an ID when the mission is loaded but they change each time the mission is loaded so I wanted to make the name field to auto populate and have to be unique. This would fix the problem and when the missions are loaded the child / parent relationships would be intact.
This is currently causing a crash when missions are unloaded as the child / parent relationships were not established on mission load.
If these relationships are set manualy through console with objects that have unique names set, it all works fine.
I believe that if I do the following, it will cure my problem.
1) Make torque give every object a unique name when they are created.
2) When an object is given a name, make sure its unique or make is unique.
3) When an object is given a null name, make a unique name for it.
However I am unsure where to start.
12/11/2007 (12:06 am)
I am trying to fix a problem with child / parent relationships. The problem I have is when a mission is saved, the relationship is lost if the name of the object isn't set or isn't unique.I know all objects are given an ID when the mission is loaded but they change each time the mission is loaded so I wanted to make the name field to auto populate and have to be unique. This would fix the problem and when the missions are loaded the child / parent relationships would be intact.
This is currently causing a crash when missions are unloaded as the child / parent relationships were not established on mission load.
If these relationships are set manualy through console with objects that have unique names set, it all works fine.
I believe that if I do the following, it will cure my problem.
1) Make torque give every object a unique name when they are created.
2) When an object is given a name, make sure its unique or make is unique.
3) When an object is given a null name, make a unique name for it.
However I am unsure where to start.
#3
those relationships work pretty well for SimGroups, including saving & loading,
but perhaps you're introducing a new type of p/c relationship ? like making say a DIF be a container ?
12/11/2007 (8:35 am)
What sort of child/parent relationships ?those relationships work pretty well for SimGroups, including saving & loading,
but perhaps you're introducing a new type of p/c relationship ? like making say a DIF be a container ?
#4
TGE lacks this and the closest mod I have found for this is "Attachable SceneObjects in Hierarchical Coordinate Spaces" by "Anthony Lovell". As good as this is, there are a lot of problems with this mod.
I have been doing a lot with this mod, but I need unique names for mission objects to fix a bug.
12/11/2007 (11:58 am)
Most game engines allow you to attach child objects to parent objects. Imagine a player running around who gets shot with an arrow. You should be able to attach an arrow to the player making it a child of the player object so it will follow the player and keep its relative position to the player.TGE lacks this and the closest mod I have found for this is "Attachable SceneObjects in Hierarchical Coordinate Spaces" by "Anthony Lovell". As good as this is, there are a lot of problems with this mod.
I have been doing a lot with this mod, but I need unique names for mission objects to fix a bug.
#5
I can make this work at the same time the ID is created in simbase.
Basicaly I will grab the date/time and add the id to the end.
This should do the job. Very basic.
12/12/2007 (6:16 pm)
I think I may have a solution, however I need someone to confirm that simbase is related to scene objects.I can make this work at the same time the ID is created in simbase.
Basicaly I will grab the date/time and add the id to the end.
This should do the job. Very basic.
#6
12/12/2007 (6:36 pm)
Pretty much everything derives from simbase
#7
Thanks for your help.
This has been bugging me for a while.
Nice to get some headway.
Thanks again.
12/13/2007 (12:28 am)
Thats great.Thanks for your help.
This has been bugging me for a while.
Nice to get some headway.
Thanks again.
Associate Orion Elenzil
Real Life Plus
assigning names as you go along.
but the fact that you want to require a unique name for every object in the mission sounds like symptom of a design you might want to re-think.
what are you trying to achieve ?
perhaps folks here could suggest some alternatives.