Game Development Community

RESOLVED [ancient issue] stateRecoil is always last recoil anim listed

by Steve Acaster · in Torque 3D Professional · 11/28/2009 (12:30 am) · 8 replies

almost feel embarrassed to mention this one now

The player recoil states (light_recoil, medium_recoil, heavy_recoil) which work in tandem with the weaponimage recoil states (lightrecoil, mediumrecoil, heavyrecoil), only ever play the last recoil animation numerically listed in the player's TSShapeConstructor file.

So, if
singleton TSShapeConstructor(theplayerdts)
{
   baseShape = "./theplayer.dts";
....
sequence29 = "ltrecoil.dsq light_recoil";
sequence30 = "medrecoil.dsq medium_recoil";
sequence31 = "hvyrecoil.dsq heavy_recoil";
};

So, regardless of what the weaponimage cs' stateRecoil says it wants to play, it will only play the last one listed (in this case heavy_recoil).


unless I've been doing it wrong for 2 years, but I don't see it...

RESOLVED IN 1.1B2

#1
11/28/2009 (3:38 am)
The reason for this is really simple :

// Recoil thread. The server player does not play this animation.
   mRecoilThread = 0;
   if (isGhost())
      for (U32 s = 0; s < PlayerData::NumRecoilSequences; s++)
         if (mDataBlock->recoilSequence[s] != -1) {
            mRecoilThread = mShapeInstance->addThread();
            mShapeInstance->setSequence(mRecoilThread,mDataBlock->recoilSequence[s],0);
            mShapeInstance->setTimeScale(mRecoilThread,0);
         }

This cycle will set always the last sequence to the thread.

The best solution is to use separate threads for each sequence:
www.garagegames.com/community/forums/viewthread/76357
#2
11/28/2009 (4:08 pm)
That looks to be leaking TSThreads... It should just need one thread but set the proper sequence and play it when the weapon is fired. TSThread supports smoothly transitioning from one sequence to another.

Logging as THREED-816

#3
11/28/2009 (5:46 pm)
The only place where the sequence is set is onNewDataBlock().
It sets the last sequence - HeavyRecoil.
Then it never transits to another sequence.

I have never used this thread (because i don't need its functionality),but this is what happens here.
#4
11/28/2009 (8:00 pm)
What would be most user friendly would be for the stateRecoil to play the animation sequence listed in the stateRecoil[#] --- but there might be good reasons why it has to hardcoded as a named setting.(non coder here)
#6
06/10/2010 (12:24 am)
There are more places where animations or sounds are more or less hard coded in the engine or in scripts. I myself have made some engine modifications to get a melee system (resource was by Sean Rice), where animations are hard coded (therefore you need all the attack anims name the same with every model, which I don't like, I'm not an artist (yet) and have to buy different characters).

Same goes on for sounds. Take the death and pain sounds. I had a female NPC killed and she screamed with a very low voice.

Now for any help on this thread: I am planning to rebuild some of the code (C++ and/or script) the next few days (or weeks) to get these issues fixed and give it as a resource to the community.
#7
06/10/2010 (4:26 am)
@Richard
Regarding manly girl's scream - make a new audio profile and in (art)player.cs try this:

function Player::playDeathCry(%this)
{
   if( %this.getDataBlock().getName() $="girl1data")
      %this.playAudio(0, GirlCrySound);
   else
      %this.playAudio(0, DeathCrySound);
}

tried and tested
#8
06/10/2010 (7:02 am)
Thanks Steve, I will give it a try.