Search In
• More options...
Find results that contain...
Find results in...

# Accuracy and hitscan offsets?

## Recommended Posts

So is there a way to code this:

If you run the attack will not spawn where you aim but from a random location depending on set offset, aka player accuracy is worse if you run and/or how fast you run. (and the set spread you have on your decorate gun stays the same inside this offset)

I have seen that some things can be done in ACS but I need some guidence to do this.

Assuming you mean ZDoom, you can use DECORATE expressions to change the spread and/or offset in a A_FireBullets call depending on player velocity.

Thats some clue atleast, but I dont find sulotions without using ACS.
is there are DECORATE variable that identifies player current movement speed?

velx, vely, velz represent the player's velocity on all three axes. Don't forget they can be positive or negative depending on the direction. If you want the combined speed, remember Pythagoras: sqrt(velx*velx + vely*vely + velz * velz) is the player speed. For just horizontal speed, you can use sqrt(velx*velx + vely*vely), and for just vertical speed you can use simply abs(velz).

Great! that is what I have been looking for!
Now I shall figure out how to do something more advanced

```RIFG A 0 A_FireBullets 0, 0, 9, 5, "BlankPuff", 0)
RIFG A 4 A_FireBullets 0, 0, 1, 5, "BulletPuff", 1)```
make the offset never spread the bullets like a shotgun would, but keep all of them hitting the same spot while the offset is active.

One way to do this would be using
A_FireBullets (angle spread_horz, angle spread_vert, int numbullets, int damage [, string pufftype [, int flags [, float range [, string missile [, float spawnheight [, float spawnofs_xy]]]]]]) (development version 3c7e1e0 only)

tho I dont use that version I imagine that something could be done. Any one knows solutions to this?