Game Development Community

Triggering animation on the fly

by Nmuta Jones · in Torque Game Engine · 07/27/2005 (11:43 am) · 5 replies

I understand how to do key bindings. I need to trigger a spontaneous player animation . I have already exported the .dsq and it's ready to go. I assume I need to put a command within my function that's tied to the key bind. Which function do I use , and what's the syntax? I know it's a simple question, but I don't seem to find the answer with my searches. Thanks.

#1
07/27/2005 (12:58 pm)
The function you are looking for is PlayThread

you would have a server side function that would call it..

ie


//play the animation
%player.playthread(0,"MyLameAnimation");
//stop and reset the animation for the next time
%palyer.schedule (500, "stopThread", 0) ;
#2
07/27/2005 (10:35 pm)
Thanks Kevin
#3
08/02/2005 (12:14 pm)
I am calling this script in server/commands.cs

function serverCmdDive(%client)
{

MessageAll('gotit','%1 will dive now',%client);
%client.player.playthread(0,'dive');


}

But when this is triggered, the %client variable is empty. (as evidenced in the message to server...it just says " will dive now"

so since the client variable is null, then the animation is not triggered. I assume that the default first parameter of a serverCmd function is the client the message was sent from.

What am I doing wrong?
#4
08/03/2005 (4:41 pm)
Anyone? anyone?...... Beuller?
#5
08/05/2005 (10:07 am)
OK, I solved it. for some reason, calling the command from client/config.cs doesn't work for some reason. calling from client/scripts/default.bind.cs does work. Weird, it should have no effect on whether the serverCmd receives its default %client parameter, but for some reason it did here.