TX Feature Request: T2DSpawnObject default naming
by Jonathon Stevens · in Torque X 2D · 04/06/2007 (10:08 pm) · 8 replies
It would help incredibly if I could actually name objects that are being spawned from the spawn object. I dynamically spawn different things. If there is someone with an easy solution, do tell.
About the author
With a few casual games under his belt as CEO of Last Straw Productions, Jonathon created the increasingly popular Indie MMO Game Developers Conference.
#2
What I meant by a default name was exactly what you propsed which is I set 'lion' as the default name and then each one spawned would be 'lion0', 'lion1', 'lion2', etc.
I haven't checked but last time I checked I wasn't able to search an object's type other than it's first listed type. I could create a specific type per enemy, but figured I'd mention how I did it since I'm in a time crunch with the two games.

04/08/2007 (3:40 pm)
Two things come to mind with this. The first is that spawners are useless in a lot of cases unless we can get a name on the objects coming out. I have to use the autoname (ick) property right now just to tell which enemy I spawned. I use a spawner to spawn any type of enemy, not just a single type.What I meant by a default name was exactly what you propsed which is I set 'lion' as the default name and then each one spawned would be 'lion0', 'lion1', 'lion2', etc.
I haven't checked but last time I checked I wasn't able to search an object's type other than it's first listed type. I could create a specific type per enemy, but figured I'd mention how I did it since I'm in a time crunch with the two games.

#3
04/10/2007 (10:14 am)
@Jonathon - using name to determine type isn't really optimal. Better would be to simply give them a TorqueObjectType and search for that type in the container system.
#4
04/10/2007 (11:07 am)
I remember doing that originally and having it only detect the first type. I had given an object 2 types and it only ever found that object in the first type. Maybe that is fixed now and I will retry it later. I know it's not optimal to do it with the debugger autoname, but that's what I had for the timeframe I was looking for.
#5
04/10/2007 (11:15 am)
We use types to look things up pretty often and I don't think there's ever been a bug there. Are you setting one type then replacing with a new type? I.e., using = operator rather than += on the object type. The implementation of types is simply a mask, so nothing fancy going on there.
#6
04/10/2007 (12:06 pm)
No. I would set two types on an object inside TGBX. Then, I would search for the specific type using Owner.TestObjectType and it always found it to be the first type listed in TGBX, but never the second type. I'll test it some more later tonight and see if it's finding all types now. Maybe I just mistyped something at one point.
#7
04/10/2007 (12:15 pm)
@Jonathon: that sounds as if you aren't properly defining the mask to search for...as Clark mentioned, it's a mask, and therefore you would need to make sure you were using the proper technique to setting your mask in the FindObjects() parameters.
#8
04/10/2007 (12:56 pm)
I'll post how I go about it later tonight if I can't get it to work. Maybe I'm simply missing something stupid, which wouldn't be the first time ;).
Torque Owner Thomas Buscaglia