Game Development Community

Where in CH 7 code does it handle the dead state

by Jesse P · in Torque Game Engine · 11/17/2007 (5:47 pm) · 2 replies

Hey I was searching through the code for aiGuard from Chapter 7 and can't locate anywhere where it would handle the AI being dead. I am not much of a coder so I need some help. I need to add a death sound other than that of the players, I have an audio sound ready to put into the code as alxPlay(edie); but I don't see any place to put it. Also having another problem that I need to find the dead code in order to solve and that's the fact that my bad guy's dead body still shoots at me after he's dead. Any help with these problems would be much appreciated.

#1
11/17/2007 (6:15 pm)
Ok the bad guy still shoots at me when he is dead but I was able to get it to play a unique death sound for him when the player kills him by adding a function to a player2.cs I am using, I added

function Player::playDeathCry( %this )
{

alxPlay(edie);

}

which apparently overrides the playDeathCry in player.cs
I'm using a player2.cs in the server/scripts

Any help with getting the bad guy AIs to stop shooting at me when they die would be much appreciated, it's been bugging me for a while now. Thanks
#2
11/17/2007 (6:20 pm)
FIXED IT!
I added the following to the player2.cs:

function Player::playDeathAnimation(%this)
{
if (%this.deathIdx++ > 11)
%this.attention = 0;
%this.deathIdx = 1;
%this.setActionThread("Death" @ %this.deathIdx);
}


// added %this.attention = 0;