Game Development Community

Throwing instead of shooting

by Nmuta Jones · in Torque Game Engine · 10/22/2006 (10:34 am) · 6 replies

I'm modding the starter.fps to create a snowball fight.

My models have no weapons. When my character would shoot, instead I need him to play a "throwing" thread which is a blended upper body animation.

Can you point me in the right direction? Thanks.

#1
10/22/2006 (12:03 pm)
Learn how to use weapon states as well as just trigging normal animations :)
#2
10/22/2006 (2:55 pm)
OK .... I got triggering normal anims down already.

WEAPON STATES...that's what I needed to look to. Thanks for the heads up.
#3
10/22/2006 (3:58 pm)
Essentially I've written a small ai script with enemy bots. If they get close to you then they "open fire":

function openFire(%me){

  %me.setImageTrigger(0,true);
  %me.playthread(0,"throw"); 

   
}


where %me is the enemy bot. The script works fine, they shoot when they're supposed to and the thread plays, but the thread plays and then freezes so the player is "caught" in the animation. I need it to play once (Preferably blended) and then go back to whatever the enemy was doing.
#4
10/22/2006 (4:33 pm)
PlayThread has this problem. You actually have to do a stopThread afterwards.

The problem gets a little more annoying, in fact.
You can't simply do a stopThread right after the playThread, obviously, because it would appear the animation never played at all.

You also can't do a stopThread just before you play. That won't work either.

you would have to do a schedule to stop the animation that looks something like this:

$ThrowTime = 5000; // 5 seconds for throwing the snowball
function openFire(%me)
{
     %me.setImageTrigger(0,true);
     %me.playthread(0,"throw");

     // this would stop the animation on thread 0
     // after $ThrowTime milliseconds
     %me.schedule($ThrowTime, stopThread, 0);
}

Then just set $ThrowTime to be about the length of you animation (usually about 15 fps)

It'd be nice if there was a flag that you could send to PlayThread to do this for you. Its easy enough to do in the engine, really. But beyond the scope of what is being asked.
#5
10/22/2006 (4:59 pm)
Ah.

@Jeremy: Done. It works like a charm! Thanks.
#6
12/03/2007 (7:30 am)
Wow thanks Jeremy this may be an older thread but it was exactly what I was looking for.