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?
-20 - Die -50 - EXPLODE!
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: -20 - Die -50 - EXPLODE!
Normally the health attribute can't go below 0. So you'll need to modify the attribute's limits with the command
(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
SetAttributeValueLimits(HEALTHATTRIBUTE,-100,HEALTHAMOUNT);
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");
}
Pain is only psychological.
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: -20 - Die -50 - EXPLODE!
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?
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!
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).
Pain is only psychological.
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: -20 - Die -50 - EXPLODE!
Yeah,that way the script will check first if the health is -50 or lower and then if not, will play he death animation.You should add it before playing the death animation (so you don't play an animation and explode after).
Thanks, I neve though that it would be so simple, now the game get's a little more bloody
Re: -20 - Die -50 - EXPLODE!
Wasn't there something like the TestDamageOrder(...) command for something like that?
(At least it works in HighLevel, for LowLevel Juutis idea is better)
(At least it works in HighLevel, for LowLevel Juutis idea is better)
Everyone can see the difficult, but only the wise can see the simple.
-----
-----