Game Development Community

Detecting player death in a bot (AIPlayer)

by Vijay · in Torque Game Engine · 11/30/2002 (10:00 pm) · 4 replies

When my AIPlayer based bot recognizes a human player and starts firing at him, firing doesn't stop even after the player is dead. Is there a clean method of detecting the player death from my bot so that I can stop firing?

#1
12/16/2002 (1:52 am)
any ideas, please?
#2
12/16/2002 (2:31 am)
Vijay,

Take a look at the function GameConnection::onDeath in the script example\fps\server\scripts\game.cs. You should be able to do something like:
if ((%sourceClient.isAIControlled()) && (!%this.isAIControlled()))
   {
   // Tell AIPlayer to stop firing
   }
I don't have AIPlayers firing at human players in my game, but I believe this is correct.

Rich
#3
12/16/2002 (3:05 pm)
The technique I use is that when I tell the bot to fire, I schedule a ceasefire a few milliseconds later. Upon the ceasefire, I schedule a call to check for threats again...

If a player dies, they don't show on the next threat assessment.
#4
12/16/2002 (3:56 pm)
Ken,

A much better solution than mine. Thank you for posting it!

Rich