Game Development Community

T3D 1.1 Final - Dead Ai Call onMoveStuck w/Fix - RESOLVED (THREED-1976)

by Steve Acaster · in Torque 3D Professional · 06/06/2011 (10:54 am) · 3 replies

T3D 1.1 Final

win7 32bit

Target:
Ai scripts/code

Issue:
If an Ai is killed when moving they start to loop the "onMoveStuck" callback.

Repeat:
Make sure you have an echo in scripts/server/aiplayer.cs Funtion DemoPlayer::onMoveStuck. Spawn an Ai, have them run about and then kill them. Check the console for the onMoveStuck callback spamming the console until the Ai corpse is deleted.

Suggest:
In aiplayer.cpp, way down in getAiMove() add a check to see whether the Ai is enabled/alive before firing off callbacks saying that it's corpse can't move.

bool AIPlayer::getAIMove(Move *movePtr)
{
//...
         if (mMoveStuckTestCountdown > 0)
         {
            --mMoveStuckTestCountdown;
         }
         else
         {
            // We should check to see if we are stuck...
            F32 locationDelta = (location - mLastLocation).len();
            if (locationDelta < mMoveStuckTolerance && mDamageState == Enabled) {//yorks added damageState check
               mMoveState = ModeStuck;
               throwCallback("onMoveStuck");
            }
//...
}

#1
06/06/2011 (11:04 am)
Logged as THREED-1976.
#2
08/08/2011 (12:35 pm)
Good catch, Thanks Steve!
#3
10/08/2011 (10:58 am)
Fixed in 1.2