Game Development Community

T2d Object Creation

by John Klotz · in Torque Game Builder · 06/26/2006 (7:24 am) · 6 replies

Does anyone know how to make an object spawn from another object? I've been trying various techniques but none of them seem to work out. All I am looking for is for an object to spawn or create another object on every few seconds or so. So i'm looking to incorporate a schedule into this as well. Any ideas or suggestions for going about this the correct way?

Thanks

#1
06/26/2006 (8:19 am)
There is an article on this in TDN however, TDN won't load for me right now so i can't give you a direct link. but its under the RTS example, and its about spawning units.
#2
06/26/2006 (8:53 am)
Thanks, just checked it out and it helped. Also, I want to spawn things on a schedule, every few seconds or so starting when the game is loaded. How would I go about doing this?
#3
06/26/2006 (9:27 am)
1) Open up your TGB Reference pdf
2) Press Ctrl-F
3) type in 'schedule'
#4
06/26/2006 (9:48 am)
0 instances found when I do that

I am using

schedule(2000, $plane, "launch");

for my function.

To my understanding that should have the $plane run the launch function every 2 seconds.

But all that does is have it run that function once after 2 seconds and not keep looping it. Should I put a condition statement in my launch function to run the schedule so it will keep running it until a certain condition is met?
#5
06/26/2006 (9:58 am)
If you want it to have rescheduled, the called function must reschedule it. It won't loop on its own (endless loop -> bad idea)
#6
06/26/2006 (10:33 am)
Im trying to call this function

function planegroup::createMissile(%this)

using this schedule

%this.schedule(1000, $plane, "plane.createmissile();");

and it won't recognize it at all, anyone know why this is?