Page 1 of 1
Pawns reacting to Projectiles.
Posted: Sat Sep 26, 2009 8:46 pm
by GMer
I was wondering (I'm back, W00T!) how I would make a pawn react to itself getting hit by a projectile, for example if it was hit by an explosion, it would fly backwards, land on its back for a bit, then get up again.
Re: Pawns reacting to Projectiles.
Posted: Sun Sep 27, 2009 6:18 pm
by metal_head
Well the projectiles have theese alt attributes, you'll have to add another attribute to the pawn and check in all of your low level orders if that attribute has decreased since the last time checked and if yes, go to a fly-back order

Re: Pawns reacting to Projectiles.
Posted: Mon Sep 28, 2009 1:34 am
by GMer
Aha, thank you.
For the flying backwards, I could use the jump command, somewhat like so? (This isn't the total script)
Code: Select all
Jump("flailing",128,false,"falling.wav")
// possibly a MoveBackward here?
Delay("crumpled",5+random(5),"")
Delay("getup",2,"getup.wav")
NewOrder(Lookaround)
The thing deciding when to do this would be similar to a pawn's health if I am not mistaken, using the alternate attribute instead of the main attribute.
I thank you metal head

Re: Pawns reacting to Projectiles.
Posted: Mon Sep 28, 2009 12:59 pm
by metal_head
Well I would suggest doing this in low level. You'll have to add a variable, with which we'll detect if the pawn's attribute has been decreased, let's say "TEMPHEALTH" and the script would look like this:
Code: Select all
SomeSetupOrderName[ ()
{
TEMPHEALTH = GetAttribute("Attributename");
self.think = "run";
} ]
run[ ()
{
if(GetAttribute("AttributeName") < TEMPHEALTH)
{
TEMPHEALTH = GetAttribute("Attributename");
self.think = "Flybackwards";
}
} ]
Flybackwards[ ()
{
ForceUp(80);
ForceBackward(80);
-----
And the animating stuff >>
} ]
Now, I'm just giving an example of what it could be. For the flying back stuff I would use the ForceUp and Backward commands + an animation. BTW, this is low level, I don't think that there's a way of detecting if another attribute, given to the pawn has decreased, so you'll have to make all your orders that you wanna have this thing in in low level.
So you simply put this everywhere you want this feature:
Code: Select all
if(GetAttribute("AttributeName") < TEMPHEALTH)
{
TEMPHEALTH = GetAttribute("Attributename");
self.think = "Flybackwards";
}