Game Development Community

AI Tracking

by Alexander Porter · in Torque Game Engine · 08/30/2002 (5:31 pm) · 0 replies

Ok, I am looking for Ai to track a player even if the player is out of the bot's LOS. I would like to know how to define a position as a first position so that I can have the player run to where he last saw the playet, Then i want him to look around him (or do a radial search) and try and find him- if he sees the player he'll update the target and go to it. but if he doesn't see the player, he'll head in the direction the player was facing last time he was seen. how would i do this?

function TrackTarget(%client)
{
if (isObject(%client.player))
{
for(%i = 0; %i < $botCounter; %i++)
{
$thePlayer = %client.player;
%iSeeHim = aiPlayer::isObjectInView(%this, $thePlayer);
%PlayerPOS = %client.player.getPosition();
if(%iSeeHim)
{
if(isObject($bots[%i]))
$bots[%i].setMoveDestination(%PlayerPos);
$bots[%i].move(); // send the bots away
}


}
}
}


The Above- if it works- will get the bot to the player- and if it was repeated- the bot would keep going if the player was in sight. how can I either have the bot rotate, look around or do a container search. and how can I find the player's last direction he was facing and set the bot to that?

i'd like to get the player to track the player with guesses