Pawns reacting to Projectiles.
Pawns reacting to Projectiles.
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.
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Pawns reacting to Projectiles.
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.
Aha, thank you.
For the flying backwards, I could use the jump command, somewhat like so? (This isn't the total script)
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
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)
I thank you metal head
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Pawns reacting to Projectiles.
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:
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
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 >>
} ]
So you simply put this everywhere you want this feature:
Code: Select all
if(GetAttribute("AttributeName") < TEMPHEALTH)
{
TEMPHEALTH = GetAttribute("Attributename");
self.think = "Flybackwards";
}