Game Development Community

AI issue

by Dracola · in Torque Game Engine · 11/20/2005 (4:01 pm) · 2 replies

I have a dumbed down version of AIguard (I pretty much just removed the think cycle so it doesn't do anything.)

I try to get it to move to a location with this

function move(%marker, %x, %y, %z){
%location = %x@" "@%y@" "@%z;
echo("we're going to"@ %location);
%bot = %marker.player;
%bot.tacticaction = "move";
%bot.setAimLocation(%location);
%bot.setmovedestination(%location);
}

it moves and since the player class has almost no drag it orbits around the point which is good but then it just stops... I also have onreachdestination running

function AIGuard::onReachDestination(%this,%obj)
{
echo("reached it!!!!!!");
switch$(%obj.tacticaction){
case "move":
$tacticnumber++;
tacticstart(%obj);
}
}

this makes it so I move to the next point once I reach this destination but the echo never gets called. No console errors either. I have no Idea what the problem is or why the AI player is stopping.


So I have two questions why is it stopping and why isn't onreachdestination getting called.

#1
11/20/2005 (6:28 pm)
You seem to have reached a point where even Ben Garney wrote once :
Bot's don't like reaching destinations...

I've seen it also, but couldn't track the bug. I thougt it was related to the think method. So I spawned 1 method for every bot. It seemed to correct the problems, but since you disabled it...
#2
12/01/2005 (7:43 pm)
I looked in the c++ it is calling throwCallback but it just ignores conexecutef I think the reason is
getDataBlock() in
Con::executef(getDataBlock(), 2, name, scriptThis());
because if I take that out and change the function to
function onReachDestination(%obj)

then it works