Game Development Community

Adding a timer to spawnpoints

by Jonas · in Torque 3D Professional · 02/24/2011 (4:57 am) · 3 replies

Hi!

Anyone have a tutorial or a guide to do this?

What im looking for is a Game mode: deathmatch and team deathmatch specific
rotation checking if the spawn point was used for 6 seconds if so dont spawn there and check for another spawn point.

Cheers!
Jonas

About the author

Freelance 3D artist at day scripter/coder on Enduring Life at night. Lover of all things TorqueScript.


#1
02/24/2011 (5:50 am)
You could add a dynamic var to the spawnpoint (I use a made up var 'spawntime' below) then check it in your 'pickplayerspawnpoint' function as I illustrate: [coded from memory - may need tweaks]


if (isObject(%spawnPoint)){
    if( (getSimTime() - %spawnpoint.spawntime) > %whateveryourwaitis )
    {
      %spawnpoint.spawntime = getSimTime();
      return %spawnPoint;
    }
  }
#2
02/24/2011 (10:18 am)
Jameson's example is pretty much what I had been using too.
#3
03/17/2011 (12:20 am)
Sorry for the lack of a response to this one, time isent really on my side lately.

Thanks for the example im gonna test it out later on today i just wanna add a couple of words and a few ideas to the concept of spawn timer.

It is very important that the gamer or in this case the server creater have control of all of the variables that in turn controls how the game is played so i wanted to use a $pref::Server:: variable to control the spawn time how i planned this is quite simple:

if (isObject(%spawnPoint)){
if( (getSimTime() - %spawnpoint.spawntime) > %MPSpawntimer )
{
%spawnpoint.spawntime = getSimTime();
return %spawnPoint;
}
}

function spawntimer(%game)
{
%game.DefaultSpawnTimer = 5000; //(milliseconds)

if ($Pref::Server::Spawntimer == 0)
{
%MPSpawnTimer = %DefaultSpawnTimer;
}
else
{
%MPSpawnTimer = $Pref::Server::Spawntimer;
}
}

Thoughts and/or things i have missed?

Best regards
Jonas