AI death animation
by Eric Soyon · in Torque 3D Beginner · 08/14/2010 (11:46 pm) · 13 replies
In T3D There does not seem to be any existing death animations for AI
How would I go about implementing these?
How would I go about implementing these?
About the author
#2
08/17/2010 (12:15 am)
It's a scripting error that'll be fixed in the next release.
#3
08/21/2010 (6:17 am)
Add this funtion in your AI file.function AIPlayer::playDeathAnimation(%this)
{
%this.setActionThread("Death" @ getRandom(1, 11));
}
#4
08/21/2010 (8:05 am)
That's techinically a more elegant solution than a previous suggestion on a another thread to add a client/notClient check to the existing playDeathAnimation() function.
#5
08/21/2010 (3:58 pm)
I just tried to keep it similar to Player::playDeathAnimation
#6
The original playDeathAnimation for Torque was slightly busted and only used one death animation despite the coding for the client index. When I fixed that we had temporarily disabled AI so it didn't occur to me that I had overlooked animations for bots. At the time I had almost decided to make it into a random function (I do in my own projects) but went with fixing existing code as a guideline instead.
08/21/2010 (7:20 pm)
One could actually replace the innards of Player::playDeathAnimation() with what Jonathon posted...The original playDeathAnimation for Torque was slightly busted and only used one death animation despite the coding for the client index. When I fixed that we had temporarily disabled AI so it didn't occur to me that I had overlooked animations for bots. At the time I had almost decided to make it into a random function (I do in my own projects) but went with fixing existing code as a guideline instead.
#7
08/21/2010 (8:30 pm)
Awesome thanks!
#8
Anyway to put something together like that? The script from TribesII had a nice routine inside that function to choose which sequence to playback...I've hacked around with it[some time ago], got it semi-working...
08/22/2010 (9:11 am)
Be great if ::playDeathAnimation(), took the Damage data and location to make it's determination of which 'death' animation to play based upon hit location when moving into 'Destroyed' state; just like in TribesII.Anyway to put something together like that? The script from TribesII had a nice routine inside that function to choose which sequence to playback...I've hacked around with it[some time ago], got it semi-working...
#9
08/22/2010 (3:46 pm)
I was never sure that the T3D damage location works correctly. If someone could confirm this and maybe explain how it works exactly, then I could try to set up a function to do that.
#10
getDamageLocation() works by processing a percentage of damage coverage on the 3 different body regions (head, torso, legs) and quadrants (right_front, left_back, etc, etc) and returning the *probable* location that was hit -- which is not always correct! Then you just check the location and call the animation sequence that seems to fit with a series of if statements (or switch/case).
However, these sequences actually vary from project to project so it's not a general purpose solution. I have this working in a project of mine and it shouldn't take much to figure out which of Gideon's animations are appropriate to play for each location and I can post it as a Resource Example if anyone is interested. But, in the spirit of the thread topic, since my game is mulitplayer I never bothered to make it work for the AI.
08/23/2010 (6:06 pm)
It's actually rather simple to get the Tribes style dealthAnimation selection to work in Torque, just have to move the playDeathAnimation() call out of PlayerData::onDisabled() into GameConnection::onClientKilled() since it can process the information you'll need and onDisabled() can't by default. getDamageLocation() works by processing a percentage of damage coverage on the 3 different body regions (head, torso, legs) and quadrants (right_front, left_back, etc, etc) and returning the *probable* location that was hit -- which is not always correct! Then you just check the location and call the animation sequence that seems to fit with a series of if statements (or switch/case).
However, these sequences actually vary from project to project so it's not a general purpose solution. I have this working in a project of mine and it shouldn't take much to figure out which of Gideon's animations are appropriate to play for each location and I can post it as a Resource Example if anyone is interested. But, in the spirit of the thread topic, since my game is mulitplayer I never bothered to make it work for the AI.
#11
08/24/2010 (3:20 am)
If you post it, I could fix it up to make it work with AI.
#12
Oh, and I actually remembered to post a Improved playDeathAnimation() Resource. It uses the method I outlined above just like how Tribes used to do it and it works for the AI too. No more boring incremented lists or sometimes stupid random selection :)
09/08/2010 (5:55 pm)
Just to note that the lack of AI death animations has been fixed for the next release by doing the isObject(%client) check for players and simply picks an animation at random for AI players.Oh, and I actually remembered to post a Improved playDeathAnimation() Resource. It uses the method I outlined above just like how Tribes used to do it and it works for the AI too. No more boring incremented lists or sometimes stupid random selection :)
#13
09/09/2010 (5:28 am)
That's it Michael, especially the function which extracts the location and ties to the Player Global variables! Thanks! This is 'how it should be'...imho. My approach was fairly heavy-handed (with some help from a friend), got it working for the most part. Excellent Resource.
Eric Soyon