Page 1 of 1

-20 - Die -50 - EXPLODE!

Posted: Sat Dec 06, 2008 7:57 pm
by metal_head
Quake 3, Unreal Tournament and many other games have that, but I have no clue how would I make this. When the player shoots at an enemy for example with a pistol, and kills the enemy, the enemy dies, playing the die animation, but if the player uses more destructive weapon, the enemy will explode in blood, organs, meat chunks and splat on the floor and the near walls.
My question:
How can I make the perfectai.s detect how much health has the monster left and if the monster has only 1 for example health point left and player shoots at it he takes from it's health attribute let's say 20, the monster to die, but if the player takes more let's say 50, the monster to explode.

Any ideas?

Re: -20 - Die -50 - EXPLODE!

Posted: Sat Dec 06, 2008 8:23 pm
by Juutis
Normally the health attribute can't go below 0. So you'll need to modify the attribute's limits with the command

Code: Select all

SetAttributeValueLimits(HEALTHATTRIBUTE,-100,HEALTHAMOUNT);
(HEALTHATTRIBUTE is the name of the attribute and HEALTHAMOUNT is how much health the pawn has overall)

I suggest making the visual effect an explosion. Then you can just remove the pawn and add the explosion. So, when the pawn dies check:

Code: Select all

if(self.health < -50)
{
     AddExplosion(<your explosion name>,<your bone name>,0,0,0);
     HighLevel("Remove");
}

Re: -20 - Die -50 - EXPLODE!

Posted: Sat Dec 06, 2008 8:29 pm
by metal_head
Yeah, I was thinking the same thing, but the problem for me was to make the script detect if the pawn has sustained heavier damage.

So this command should go into the death_biz order, right?

Code: Select all

if(self.health < -50)
{
     AddExplosion(<your explosion name>,<your bone name>,0,0,0);
     HighLevel("Remove");
}

Re: -20 - Die -50 - EXPLODE!

Posted: Sat Dec 06, 2008 9:08 pm
by Juutis
Yeah, if that's the order that's executed when the pawn dies. You should add it before playing the death animation (so you don't play an animation and explode after).

Re: -20 - Die -50 - EXPLODE!

Posted: Sat Dec 06, 2008 10:09 pm
by metal_head
You should add it before playing the death animation (so you don't play an animation and explode after).
Yeah,that way the script will check first if the health is -50 or lower and then if not, will play he death animation.
Thanks, I neve though that it would be so simple, now the game get's a little more bloody :D

Re: -20 - Die -50 - EXPLODE!

Posted: Mon Dec 08, 2008 12:47 pm
by Jay
Wasn't there something like the TestDamageOrder(...) command for something like that?
(At least it works in HighLevel, for LowLevel Juutis idea is better)