Game Development Community

ADDING custom animation Liking pressing P will play celwave

by Sventhors · in Torque Game Engine · 07/27/2005 (9:30 am) · 8 replies

I want to play an animation when I press a key. Like when I press p it will play the celwave.dsq animation. The Celwave animation works in Show Tool.

I have gone through the forum and I havent found clear answer.

I have tried this and put it in default.bind.cs
MoveMap.bindCmd(keyboard, "ctrl p", "$model.playThread(0, \"celwave\");", "");
//Also tried this
MoveMap.bindCmd(keyboard, p, "$model.playThread(0, \"celwave\");", "");
I have put it in several places in default.bind.cs and it didnt work. SNIFF...

I have also, tried this and put it in the Movement keys. I Know it is terrible wrong:)
function playCelwave(%val)
{
   $mvCelwaveAction = %val * $movementSpeed;
}

moveMap.bind( keyboard, p, celwave );

Is there other files I have to change this. I remebered reading in the forum that someone mentioned that there are several places were you have to change?

In addition -----> (0, \"celwave\");", ""); where you have "" do have to do something to this?

Can someone tell me how make this work. Thanks.

#1
07/27/2005 (9:31 am)
Put it in default.bind.cs

then go up one directory and delete config.cs and config.cs.dso... those are generated when you run Torque :)
#2
07/27/2005 (9:59 am)
I tried that... I deleted config.cs and config.cs.dso and nothing happened and I put it in default.bind.cs.

I noticed that when I deleted config.cs file when I pressed ctrl p it took photos of the seen. Before it didnt. Kwel.

Im still stuck. I have tried to put it config.cs(I put it back to orginal place) also and nothing happens. Is there anything else I should do.
#3
07/27/2005 (10:05 am)
I tried that... I deleted config.cs and config.cs.dso and nothing happened and I put it in default.bind.cs.

I noticed that when I deleted config.cs file when I pressed ctrl p it took photos of the seen. Before it didnt. Kwel.

Im still stuck. I have tried to put it config.cs(I put it back to orginal place) also and nothing happens. Is there anything else I should do.
#4
07/27/2005 (10:10 am)
If you put it in default.bind.cs and delete config.cs and config.cs.dso then it should work... unless the key conflicts with something, try using another key.
#5
07/27/2005 (11:04 am)
Also you should first try the command in the console, if it works in the console then most likely the key you chose conflicts with another.
#6
07/27/2005 (2:41 pm)
Thanks for all the help:)
I tried it in starter.fps and it works there. However, I forgot to mention that I was using the tutrioal.base.
And I cant find config.cs file in there. I get this in console window when I choose this command(tutrioal.base)
moveMap.bindCmd(keyboard, "ctrl 1", "commandToServer('playCel',\"wave\");", "");

serverCmdplayCel: Unkown command

I have copied directly from starter.fps. Do I have do something differently in tutrioal.base

I am getting little confused about the naming in Torque. Like when it says Cel front of wave and salute. What is Cel? Is this command like col or collison?
Also, If I want to play a certain animation like my own animation like dance. Do I have name it celdance? as .dsq file.?

Inaddition, if I want to play fall or play death3 or tauntimp.dsq in the player folder. How do I do that. I have tried this and didnt work

moveMap.bindCmd(keyboard, "ctrl 2", "commandToServer('playCel',\"tauntimp\");", "");
//and
moveMap.bindCmd(keyboard, "ctrl 2", "commandToServer('tauntimp',\"\");", "");
//and others

Thanks again for all the help:)
#7
06/13/2007 (9:50 am)
Here is a process that I've been playing with... so far it will work if you are just wanting to trigger full body animations :

// Triggers the function and sends the name of the animation you want to play

moveMap.bindCmd(keyboard, "g", "commandToServer('playAnim',\"wave\");", "");

// Calls the function attached to the Player object to play your input animation

function serverCmdPlayAnim(%client,%anim)
{
if (isObject(%client.player))
%client.player.playAnimation(%anim);
}

// Plays the given animation (note: the false indicates that it should not remain in this current animation sequence and should return to whatever it should next.. this obviously should be changed if it's a death sequence)

function Player::playAnimation(%this,%anim)
{
%this.setActionThread(%anim,false);
}
#8
06/14/2007 (12:53 am)
You should load your .dsq and give it a symbolic name before you can play it. The easiest way to do so is to add it to your player.cs file. Look at the file data/shapes/player/player.cs in starter.fps to get an idea how to do it. Just add a new line with a new sequence number, the name of your .dsq and the name you want to give it, then you'll be able to play it.

And in case you're doing seperate client/server architecture, this change has to be done server side in order to work.