Custom typemask in torquescript? [resolved]
by Scott Zarnke · in Torque Game Engine Advanced · 08/11/2009 (1:12 pm) · 2 replies
Hey, guys,
I'm transitioning from TorqueX to T3D (I know, just a liiiiittle bit of a jump up ;). In TX it was so easy to define custom types and add them to objects to distinguish, for instance, things that were the same kind of object but on different teams.
As far as I can tell, there doesn't seem to be any way to do this in TorqueScript. You can get the type, but not set it. Is manipulating the engine really the only way to do this now? Please let me know if anyone has been able to use custom types in TorqueScript.
Thanks.
I'm transitioning from TorqueX to T3D (I know, just a liiiiittle bit of a jump up ;). In TX it was so easy to define custom types and add them to objects to distinguish, for instance, things that were the same kind of object but on different teams.
As far as I can tell, there doesn't seem to be any way to do this in TorqueScript. You can get the type, but not set it. Is manipulating the engine really the only way to do this now? Please let me know if anyone has been able to use custom types in TorqueScript.
Thanks.
#2
08/12/2009 (5:41 pm)
Thanks for the reply. After thinking about this for a while, what I did was just to modify the SimObject.h and .cpp files to have setType(U32), addType(U32), and removeType(U32) and expose them as ConsoleMethods. Then I was able to define custom Typemasks and add them to an object and subsequently use the new type as a filter for searching. Just had to be sure to use a bit not currently used as defined in ObjectTypes.h. Thanks again for the suggestion.
Torque 3D Owner Mark Dynna
However, there are many other ways to store information on an object in TorqueScript. For instance, you could simply assign a variable called "team" to all of the Player objects as they get created and assigned to a team. Then you would simply need to do a search for all Player objects, iterate through them, and check the team value on each one.