Game Development Community

Spawning bots with trigger?

by Denis Linardic · in Torque Game Engine · 10/06/2004 (12:43 am) · 4 replies

Hi. I've managed to spawn bots ingame using some keyboard key, now i wonder if it's possible (probably is) to initiate spawn when player activate a triger. For example:
Player is entering the house, there is trigger setup on the door and that trigger issue commands to aiplayer to spawn three bots on nerby hill.
If you know of any thread, or tutorial that could help me with that please let me know.
Thanks

#1
10/06/2004 (3:24 am)
In the Trigger on enter event just place the command that's in your key bind to spawn bots. You could use a counter to spawn the number of bots needed. Like this:

function myTrigger::onEnterTrigger( %this, %trigger, %obj )
{
  spawnBotLocation();
}

function spawnBotLocation()
{
 %pointCount = 0;
 for (%pointCount = 0;%pointCount < $pathCounter;%pointCount++)
 {
   if ($paths[%pointCount].botLevel !$= "")
	%botLevel = $paths[%pointCount].botLevel;
   else
      %botLevel = 1;

   %npcName = "Bot" @ $botCounter;
   $bots[$botCounter] = AIPlayer::spawnPlayer(%npcName, $paths[%pointCount].getName(), %botLevel);
   $botCounter++;
 }
 
}

If you have any questions just ask.

Marrion
#2
10/06/2004 (11:22 am)
Thanks for your help Marrion!

One more question. Do you know what function is used to see if bot is shoot.
Example: I shoot the bot and when my arrow hit him a command is called to lower his health....

I saw OnShoot function but that function controls shooting from the bot at me (at least i think)

Sorry I am not very good in English.
#3
10/06/2004 (12:29 pm)
You could use OnDeath (same as the player)
#4
10/07/2004 (4:02 am)
Thanks ACE!!!