Jump to content

Home

JK2 Animation Thread


razorace

Recommended Posts

  • 1 month later...
  • Replies 117
  • Created
  • Last Reply

Back to the animations thread, there's another way to call animations that is seen in the Jedi_DodgeEvasion function. I'm not really certain how it exactly works but it seems to run torso based (upper) animations. I'm still playing with it by it also seems to have a very low priorty with the certain setting. (I.E. It rarely activates unless you have your saber out and disactived.)

Link to comment
Share on other sites

  • 4 weeks later...

Ok, I've figured out a easier way to doing animations with the forceHandExtend stuff. I've gotten the basics down pat.

 

However, I'm trying to do some more advanced animation merging (seperate torso and leg animation control) with the current system but I can't figure out where the heck the animations are directly controlled. The code SEEMS to be near the top of static void PM_Weapon( void ) inside the

 

"else if (pm->ps->forceHandExtend != HANDEXTEND_NONE)"

 

but I've discovered that it doesn't seem to do ANYTHING. It looks like it's suppose to do the actual animation control, but I can comment out the whole section and have it STILL work! It doesn't make any sense to me. :p Any help with this would be great. :) I just need a location and I can take it from there. :)

Link to comment
Share on other sites

Torso and leg control is already separated. The section you are looking at returns desiredAnim, which is called after the fact in a couple of if/elsed PM_SetAnims

 

so, if you chunked out all of the 'cased out desiredAnim's you should get an error when compiling.

 

Are you using a weapon when you try to use those forcepowers?

 

Oh, and because I love y'all, I wrote a little diddy that goes like

http://users.sisna.com/tokyopop/jk2anim.html

 

Well, it's less a diddy and more about PM_SetAnim, really ... ;P

Link to comment
Share on other sites

Thank you for the detailed PM_SetAnim analysis but you didn't answer my, but lucky I figured it out. I didn't know that some of the bg code have to be duplicated in the cgame component for them to visually work.

 

See, I've altered the the PM_weapon to allow "quickdrawing" for after a dodge animation. This worked when I only altered it for the game side. However, my most recent attempts are trying to make attack animations play during the dodge animations (sort of like attacking during a wall walk or a side flip). It looks like it's possible since you can do it in many other situations and the fact that animations are animations. :D

Link to comment
Share on other sites

Well, I tried to answer your question, but that required asking you a question. So, in order for your bg_panimate changes, you had to change g_ or cg_

 

I'm very curious as to the nature of the solution, as we will all come across this problem eventually.

 

I updated my page, because I know how razorace is about credit ;P

Link to comment
Share on other sites

As long as he properly checks his animation states during dodge and counter attack, it'll be fine. I don't think he's attacking *during* the dodge, that's not really techinically feasable.

 

Ever see Enter the Dragon? There's a lot of fluid dodge and attack in Kung Fu.

Link to comment
Share on other sites

I was talking attacking WHILE dodging. Herr is correct that Dodge is a BOTH animation, but running attack animations on the torso and dodge animations on the legs actually looks pretty good. I got it working yesterday but I somehow totally screwed up my code and had to go back to a very recent code backup.

 

The solution to makes bg_ changes work is to recompile both the game and cgame files. And, yes, that PM_weapon function does actually handle the forceHandExtend animations. It just doesn't change some stuff visually unless the client has the correct cgame files.

 

What's this about me and credit? I just feel that everyone who works on a project deserves credit based on their involvement. :) For example, Sid Meier's Civ 3 should only have the Sid Meier tag IF he did MOST of the work. Which he didn't. In fact, if you check the Play the World credits, he's not in there at all.

Link to comment
Share on other sites

ive been reading this thread a few times , great one btw

 

from the loveandpeace example

i 'test' the anims i want like this

 

else if (Q_stricmp ( cmd, "testanim" ) == 0){

StandardSetBodyAnim(ent, BOTH_HEADNOD, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_HOLDLESS);

ent->client->ps.saberMove = LS_NONE;

ent->client->ps.saberBlocked = 0; ent->client->ps.saberBlocking = 0;

}

 

here its the 'no' anim

 

fooling around i tryed BOTH_SIT2 also

 

oh prob its the one i want but how to i 'stick' it

i mean not just run the anim then restart

run the anim and stay in the final position

 

any tips/pointer ? thx

Link to comment
Share on other sites

can i set it infinite ?

so that i could do something like

 

else if (Q_stricmp ( cmd, "testanim" ) == 0)

{

if (?not on?)

{

StandardSetBodyAnim(ent, BOTH_SIT2, SETANIM_FLAG_HOLD);

ent->client->ps.saberMove = LS_NONE;

ent->client->ps.saberBlocked = 0;

ent->client->ps.saberBlocking = 0;

ent->client->ps.legsTimer = ???;

ent->client->ps.torsoTimer = ???;

} else {

undo it

}

}

 

im thinking of a way ...... but hummmm, safe this is ?

 

else if (Q_stricmp ( cmd, "testanim" ) == 0)

{

if (ent->client->ps.legstimer > 0)

{

ent->client->ps.legsTimer = 0;

ent->client->ps.torsoTimer = 0;

} else {

StandardSetBodyAnim(ent, BOTH_SIT2, SETANIM_FLAG_HOLD);

ent->client->ps.saberMove = LS_NONE;

ent->client->ps.saberBlocked = 0;

ent->client->ps.saberBlocking = 0;

ent->client->ps.legsTimer = 100000000;

ent->client->ps.torsoTimer = 100000000;

}

Link to comment
Share on other sites

since i wanted to test all the BOTH_SOMETHING anims

i created a little perl script to generate the test cmd

 

i though this might help

 

a test package is hosted here

 

this zip contain the perl script and a test mod

from testanim0 to testanim1090

 

it might not b always hosted so here is the perl script i made :)

 

#!perl -w

#################################

# generate the C code for anims #

# u should run this from dos #

#################################

use strict;

####################

# edit stuff below #

####################

# path to your anims.h file we gonna read it u must esc the \ so replace them by \\

my $pathtoread = "D:\\jk2\\GameData\\code\\game\\anims.h";

####################

# dont touch below #

####################

my @storer = ();

my $newf = 0;

if (-e $pathtoread) {

open (F, "$pathtoread") || die "DEAD : $!";

while (my $line = <F>) { chomp($line); push(@storer,$line); }

close (F) || die "DEAD : $!";

foreach (@storer) {

if (/BOTH/) {

my @junk = split(/ /,$_);

$junk[0] =~ tr/\t/ /;

$junk[0] =~ s/\s//g;

if ($junk[0] =~ /^BOTH/) {

my @final = split(/,/,$junk[0]);

print "Generating C for $final[0] ... ";

open (FF, ">>generated_cmds.c") || die "DEAD : $!";

print FF "\n\t// ";

print FF $final[0];

print FF " test cmd\n";

print FF "\telse if (Q_stricmp ( cmd, \"testanim";

print FF $newf;

print FF "\" ) == 0)\n\t{\n\t\tStandardSetBodyAnim(ent, ";

print FF $final[0];

print FF ", SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_HOLDLESS);\n\t\tent->client->ps.saberMove = LS_NONE;\n\t\tent->client->ps.saberBlocked = 0;\n\t\tent->client->ps.saberBlocking = 0;\n\t}\n";

close (FF) || die "DEAD : $!";

print "done\n";

$newf++;

}

}

}

print "\ndone generating generated_cmds.c\nGenerating generated_traps.c ... ";

my $i = 0;

open (FFF, ">generated_traps.c") || die "DEAD : $!";

print FFF "// trap_AddCommands\n";

while ($i < $newf) {

print FFF "\ttrap_AddCommand (\"testanim";

print FFF $i;

print FFF "\");\n";

$i++;

}

close (FFF) || die "DEAD : $!";

print "done";

exit;

} else { print "Cannot read Animations : $pathtoread not found"; exit; }

Link to comment
Share on other sites

What is he trying to do anyway? Visually play each animation? You can do that in Modview to a limited degree (there's no seperatation between the animations or any animation labeling). If you want a better view, you could just whip up a command that does whatever animation you want.

 

As for the first question about making an animation hold perminately, it's very possible. What you gotta do is make the leg/torso timers refresh as long as you still want the animation to hold (wait for a command, a time limit, a certain situation, etc)

 

For a good example, I suggest you check out the forceHandExtend animation controls in PM_Weapon in the bg_pmove (they are near the top of the function).

 

You'll notice that the leg/torso timers are only ever set to 1. This is due to PM_Weapon being run at or above (I'm not sure which) the speed of the leg/torso timer. Basically, the timer is being constently updated faster than the timer can run out. Otherwise, the animations would be reseting faster than they could play.

 

Anyway, the thing you want to examine is the overall structure of the function with its concept of reupkeeping the leg/torso timers until the your exit state is reached (in this case, the forceHandExtendTime. This is actually controlled inside of WP_ForcePowersUpdate in w_force.c)

 

I hope this helps. :)

 

Razor Ace

 

P.S. Boy, when did I become one of the knowledgable ones around here? :D

Link to comment
Share on other sites

Well, on the left, when you open up a GLM it'll show a tree that has bones tags and sequences, and what not. If I expand sequences, it'll show me the names of all the animations. Or, if I have my window very very large (fullscreen), (and I'm in 1024x768), when the anims are playing, I can see the names all the way on the right.

 

Hmmmm... I'll post a screenie or add this to my tutorial, if'n you think it'd help.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...