Script triggered cel animations
by Sam Horton · in Technical Issues · 02/22/2006 (10:45 pm) · 5 replies
So I'm attempting to fire off an attack animation from script and I have everything set up using the obj.playCelAnimation() function. My problem is that I'm having trouble finding a handle to the player object. I'm still using the tutorial.base as opposed to the starter.fps as I think fps has way more than I need to worry about right now.
I'm trying to do something like this in defaultBind.cs
from the documentation I also found a player function called setActionThread() that looked like it might be what I'm looking for.
I'm trying to do something like this in defaultBind.cs
function doBash(%val)
{
//playerHandle.playCelAnimation(bash);//how can I get the handle to the player?
echo("BASH");
}
//trigger bash animation
moveMap.bind( keyboard, r, doBash );from the documentation I also found a player function called setActionThread() that looked like it might be what I'm looking for.
About the author
#2
in defaultBind.cs I now have:
Now I'm looking for a way to keep the run/straffe animations from interrupting the bash animation. Someone suggested locking the keyboard input for a second or 2 while playing the bash animation, but when I added this line to the above function It had no effect on the keyboard.
Any ideas on a way to override all animations temporarily?
02/23/2006 (6:22 pm)
Thanks Anthony, That was exactly what I needed to know in regards to getting a propper handle to the player. I couldn't get playThread() to fire off the animation, but setActionThread() worked pretty well. in defaultBind.cs I now have:
//trigger bash animation
moveMap.bind( keyboard, r, startBash );
function startbash(){
commandtoserver('DoBash');
}
function serverCmdDoBash(%this){
//%this.player.playThread(0,"bash");//not working (tried using tagged string like above example, same result)
%this.player.setActionThread("bash",0,0);//works
}Now I'm looking for a way to keep the run/straffe animations from interrupting the bash animation. Someone suggested locking the keyboard input for a second or 2 while playing the bash animation, but when I added this line to the above function It had no effect on the keyboard.
$Pref::Input::KeyboardEnabled = 0; //lock keyboard?
Any ideas on a way to override all animations temporarily?
#3
02/27/2006 (5:19 pm)
Just giving this one a bump!
#4
02/27/2006 (5:54 pm)
Best to have a BOOL like bIsBashingGoingOn = true and then when the player tries to straff / run only allow them to do so if bIsBashingGoingOn == false. That should stop the animation from starting.
#5
That is working perfect. I'm using the animationDone() event to set the variable back to false, but it doesn't seem to fire every time. I'm going to try and schedule a custom function to zero out the var after a small amount of time has passed.
Thanks again
02/27/2006 (8:25 pm)
Thanks Andy,That is working perfect. I'm using the animationDone() event to set the variable back to false, but it doesn't seem to fire every time. I'm going to try and schedule a custom function to zero out the var after a small amount of time has passed.
Thanks again
Associate Anthony Rosenbaum
moveMap.bind( keyboard, r, startBash ); function startbash(){ commandtoserver('dobash'); } function serverCmdDoBash(%this){ //%this is the client which pressed the key %this.player.playthread(0,'bash'); }I am pretty sure that will work
things to remeber
1) clients trigger keys
2) tell the server what to do with a serverCmd function
3) serveCmd will had the client who called the cmd as the first parameter
4) the server will then do the action
5) playthread(); is the appropriate choice for playing random threads