Game Development Community

Swing animation

by Christian · in Technical Issues · 01/24/2007 (8:23 pm) · 4 replies

I am having an ai spawn through a non-aiPlayer script and doing many tasks through that script. How would I use an animation to have him swing, etc. For example in aiPlayer there is
function Actor::animate(%this,%seq)
{
   //%this.stopThread(0);
   //%this.playThread(0,%seq);
   %this.setActionThread(%seq);
}

Is that useable in another script somehow, and how would I put my animation into %seq? I have my animations for the playerbody correct and everything, just need to know how to get my AI to use them.

#1
01/25/2007 (6:11 am)
If you want all AIs to be able to use this code, try:
function AIPlayer::animate(%this,%seq)
{
   //%this.stopThread(0);
   //%this.playThread(0,%seq);
   %this.setActionThread(%seq);
}

Then all you have to do is call it.
Using anim "swing" as an example:

AIName.animate("swing");
#2
01/25/2007 (11:10 pm)
It works on my player, but says animate is an unknown command for an AI player, using dump, it was not on there. Is there a way to animate an aiPlayer?
#3
01/26/2007 (5:52 am)
Thats weird. When I put it in my script, It worked.
........................

function AIPlayer::animate(%this, %seq)
{
   %this.setActionThread(%seq);
}

........................
Make sure there are no errors in the console for your AI script.
#4
01/26/2007 (8:11 am)
The only error is when I switch from my %player to $bot1. Just says unknown command. No console errors. My %player works when it's on AIPlayer in the function above as well as just function Player::animate. But my $bot1 doesn't work with either.