Game Development Community

OnTargetEnterLOS

by Howard Dortch · in Torque Game Engine · 06/11/2004 (10:33 am) · 1 replies

Trying to figure out how this works.
I have a bot and I want it to chase me if it sees me. So onTargetEnterLOS is a callback in PlayerData. Now what all does it need to function?
I set this in as part of MyBot datablock but it never hits here

function MyBot::onTargetEnterLOS(%this,%obj)
{
%this.setMoveDestination($MYPLAYER.getTransform(), 0 );
echo ( " CHASE " );
}

#1
06/12/2004 (10:07 am)
You have to do setAimObject() to trigger this (look at engine/game/aiPlayer.cc). Note that this means your bot will always face the target even if the target is not in sight.

I looked at this approach to try to accomplish the same thing and decided that managing a state machine in "think" worked better.

For learning, I have been enhancing starter.fps. I now have Kork the Orc patrolling (i.e. following a path), chasing, and firing (w/ compensation for the drop of the bolt). Most of the work for this happens in AIManager::think().