Function to Check a Projectile's Angle and Height

Moderator: GZDoom Developers

Post Reply
User avatar
some_random_guy
Posts: 61
Joined: Fri Apr 29, 2011 5:20 pm
Location: here

Function to Check a Projectile's Angle and Height

Post by some_random_guy »

I'd think it would be cool to have a monster check from which angle a projectile or hitscan attack hits them. (relative to the monster i.e. from the front, behind, etc.)
This would allow a modder to use different sprites in pain or death states.

For example, if the function could figure out that the monster was attacked from behind, the modder could have the monster go to a line of code (in DECORATE) and
have the sprite sequence showing the monster leaning forward as a result of the blow, versus getting hit up front, when the monster would appear to stumble backwards
or from the side, or from any other angle! This would also make it reasonable to create multiple angle views for death sprites (like for the enemies in DOOM) so if you
shot the monster in the side, the monster wouldn't appear to fly backwards as it would if you simply used only one set of angled views. (that is, if a set of views was created
to give the same impression that the monster is flying backwards as the single set of sprites used in DOOM)

It would be even more effective to be able to check the height at which the projectile hits the monster, because you could have the monster clutch it's gut when hit in the
middle of the body, or stumble down to the ground when shot in the legs, etc. This could also be used to allow for headshots. :shock:

This may actually be more effective to, instead of using a function, being able to create states for monsters that are triggered when the height/directional criteria are met.
Personally, I can't tell which would be more efficient.
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: Function to Check a Projectile's Angle and Height

Post by XutaWoo »

I'm pretty sure there's no way for ZDoom to actually check these things.
Well, height maybe, but it'd probably take a rewrite of the damage system to return angles. It wouldn't work with monster melee attacks anyway, since those deal direct damage.

Also, you can already give the death states rotations. There's no special handling in them that keep the corpse facing players at all times.
User avatar
some_random_guy
Posts: 61
Joined: Fri Apr 29, 2011 5:20 pm
Location: here

Are you sure...?

Post by some_random_guy »

First off, I know that multiple views can be made for the death sprite sequences, but think of doing that for an Imp...
You blast the creature from behind with a shotgun, but because of the way the view is set up, it looks like it's flying backwards,
when it would look much better to have it look like it's falling forwards.

You don't think ZDoom could check such things? Does ZDoom not know where bullet or blood puffs spawn?
Even if not, it is my suggestion to make it so ZDoom can check these things. :roll:

Also, I realized that if a monster got hit several times in 1 tic, things could get screwed up.
This being so, I think it would be cool to set a flag for such a function (or for the Actor) to
either randomly pick one of the projectiles to determine which direction the monster is getting
hit from or to use the average direction of all the projectiles.

Additionally, a variable could also be set for the function (or state attribute in DECORATE) to determine
the maximum variation in angle the function (or state) will accept from projectiles in one hit. For example,
this would allow the monster to go to a default state if it gets hit from the front and behind in the same tic,
so instead of stumbling in one of the 2 directions, it kinda stands there and flinches while it takes the hits.

EDIT: I say use the puff spawning height since the engine has to know where to spawn it, so it must have a number to use for height.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”