Game Development Community

Animations to show pain (HELP!)

by ITT019_(0007) · in Artist Corner · 10/30/2006 (12:09 pm) · 11 replies

Hey everybody.

I and my group are working on a action/platformer using the torque engine. After looking at how our player attacks its enemies we noted that something seemed off.........we had no way to show the user that the attack they layed did anything. We also have no way other then the life bar to show them that they are hurt as well.

I am also quite surprized that after searching through the site I found nothing that adressed this issue?

The only idea I have right now is to make a animation called "hit" or "pain" and then having it get called if the damage is now less then it was before. I am not much of a programmer but have a sound foundation so please go as deep as need be.




Thanks

#1
10/30/2006 (12:17 pm)
%obj.setDamageFlash(%flash);

setDamageFlash( level )

Purpose
Use the setDamageFlash method to set the current damage flash level. When this level is > 0.0 the screen is rendered with an an additive red overlay, which is limited to 76% regardless of level. The value of level is auto-decremented over a few seconds.

Syntax
level - A floating-point value specifying the level of damage flash to apply. This value can be between 0.0 (0%) and 1.0 (100%).

Returns
No return value.

Notes
A damage flash is a translucent red overlay that can be used to inform the player that their avatar has taken damage.

See Also
getDamageFlash

http://tdn.garagegames.com/wiki/Torque_Console_Objects_10
---------------------------------------------------------------------------------

Other solutions would require more info on what your game is about, is it side scroling? isometric?

What did you make your model in? ETC...
#2
10/30/2006 (12:23 pm)
Before providing help, what does your design call for? Are you in first person mode or 3rd person view? How do you want the damage to be represented? My team used the red flash, a heartbeat sound, and motion blur to show the player received damage. From a 3rd person angle, playing a hurt animation would look good with some motion blur. So what do you want to show?
#3
10/30/2006 (12:25 pm)
Thats not what I am looking for.



This is a 3rd person game and we need to have it that when you hit the enemy with your melee wepond or jump upon them (if they are small enough) that the player recieves instant feedback that the blow was landed.


It would also be nice to have the player do the same. We don't want an HUGE RED FLASH to show up, it would take away from everything else that is going on.

This lack in our game was actually pointed out by Josh Sawyer who is the lead designer of Neverwinter Nights 2. He came to our school to talk and all the classes who had something to show got some feedback as well. He said this was the first thing he noticed. When he worked at Midway feedback from the world was one of the BIG things they tried to hammer home in every game.



I need an answer that had "animations" within it somewhere.

Thanks.

(a motion blur might look very cool if we could have an moving reaction as well)
#4
10/30/2006 (12:29 pm)
Hay man, without knowing a thing about your game at all from your post, the "HUGE RED FLASH" was the best i could do.

If your question how to make the animations? or how to script the triggering the animations?
#5
10/30/2006 (12:36 pm)
@Greenbay - Based on what you just described, I would create the animation datablock and trigger it when the entity receives damage, like getting reeling, getting knocked back/down, or playing a stunned animation. How does that sound?
#6
10/30/2006 (12:43 pm)
Open up server\scripts\player.cs in the starter.fps folder. Toward the bottom, there is a function called Player::playPain(%this). That is where you want to play the "pain" animation. You would do this by calling %this.setActionThread("pain"). Here's an example:

[b]In shapes\Player\player.cs[/b]
datablock TSShapeConstructor(PlayerDts)
{
   baseShape = "./player.dts";
   sequence0 = "./player_root.dsq root";
   sequence1 = "./player_forward.dsq run";
   sequence2 = "./player_back.dsq back";
   sequence3 = "./player_side.dsq side";
   sequence4 = "./player_lookde.dsq look";
   sequence5 = "./player_head.dsq head";
   sequence6 = "./player_fall.dsq fall";
   sequence7 = "./player_land.dsq land";
   sequence8 = "./player_jump.dsq jump";
   sequence9  = "./player_diehead.dsq death1";
   [b]sequence10 = "./player_pain.dsq pain";[/b]
};

[b]In server\scripts\Player\player.cs[/b]
function Player::playPain( %this )
{
   %this.playAudio(0,PainCrySound);
   %this.setActionThread("pain");
}

[EDIT]
Of course, that was based on the FPS example. You would want to change my example to suit your own file names, pathing, ect. Easily applicable to your situation though.
[/EDIT]
#7
10/30/2006 (12:58 pm)
Thanks Allyn, I truely do aprechiate your quick responce. Seeing as how this is a first person engine it is easy to undersand your responce. But for a 3rd person game the player has to see what is going on from a seperated angle and shouldn't really have the reaction in a 1st person responce (unless you wanted some sort of blood to splater on the screen while a bunch of gore is going on).


Michael Perry, THAT is exactlly what I was thinking and looking for!!!!!! I am more of an art guy then a programming guy so I still have to test the waters with my toes before I dive head in and make a huge mess. Thanks for your precice and quick input.
#8
10/30/2006 (1:00 pm)
Happy to help.
#9
10/30/2006 (1:07 pm)
It wasn't that torque is a FPS, its that I had no idea what your game was or was about.

I could have given you that information also if you has been more specific in your question.

Anyway, good luck.
#10
10/30/2006 (1:09 pm)
Let us know how that works out for you, adding the motion blur would also look sweet, but you might want to hand that off to your engine guy unless you want a fun learning experience like I had =)
#11
12/01/2009 (12:18 pm)
I was trying this solution with T3D and the apropiate changes but it appears that setActionThread wont work in scripts/server/player.cs. I notice that it wont play any animation, does anyone know what might be the problem?