-20 - Die -50 - EXPLODE!

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

-20 - Die -50 - EXPLODE!

Post by metal_head » Sat Dec 06, 2008 7:57 pm

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?

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: -20 - Die -50 - EXPLODE!

Post by Juutis » Sat Dec 06, 2008 8:23 pm

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");
}
Pain is only psychological.

User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: -20 - Die -50 - EXPLODE!

Post by metal_head » Sat Dec 06, 2008 8:29 pm

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");
}

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: -20 - Die -50 - EXPLODE!

Post by Juutis » Sat Dec 06, 2008 9:08 pm

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.

User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: -20 - Die -50 - EXPLODE!

Post by metal_head » Sat Dec 06, 2008 10:09 pm

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

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: -20 - Die -50 - EXPLODE!

Post by Jay » Mon Dec 08, 2008 12:47 pm

Wasn't there something like the TestDamageOrder(...) command for something like that?
(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.
-----

Post Reply