Game Development Community

Problem with scheduled spawning

by Nicolai Dutka · in Torque Game Builder · 03/28/2008 (5:35 pm) · 1 replies

I am using TGB 1.7.2

I have a template object and another object with a spawn area behavior. It spawns my objects just fine using:

spawner1.spawn();"

but when I try something like:

spawner1.schedule(500,spawn);

it always ends up spawning 2 of them! I don't understand why scheduling them makes any difference...

#1
03/28/2008 (5:40 pm)
EDIT:

This works:
function spawnEnemies(%spawn, %num)
{
  while(%loop<%num)
  {
    %time=500*(%loop+1);
    schedule(%time,0,spawner,%spawn);
    %loop++;
  }
}

function spawner(%spawner)
{
  %spawner.spawn();
}