[ACS] Autoaim enabled railgun

Sprites, textures, sounds, code, and other resources belong here. Share and share-alike!
Forum rules
Before posting your Resource, please make sure you can answer YES to any of the following questions:
  • Is the resource ENTIRELY my own work?
  • If no to the previous one, do I have permission from the original author?
  • If no to the previous one, did I put a reasonable amount of work into the resource myself, such that the changes are noticeably different from the source that I could take credit for them?
If you answered no to all three, maybe you should consider taking your stuff somewhere other than the Resources forum.

Consult the Resource/Request Posting Guidelines for more information.

Please don't put requests here! They have their own forum --> here. Thank you!
User avatar
Scotty
Posts: 35
Joined: Tue Mar 24, 2009 10:43 pm

[ACS] Autoaim enabled railgun

Post by Scotty »

Ed the Bat and I made a little mod that allows railguns to use autoaim!

This works by:
  • Firing a 0-damage bullet that is assigned a TID, which uses autoaim.
  • Calculating the pitch from which the A_RailAttack needs to be fired based on the player's position and the puff's position.
  • Returning the pitch to the call to A_RailAttack on the weapon, which has the RGF_EXPLICITANGLE flag set.
This creates a RailAttack which conforms to the user's autoaim settings.

Other than using this for autoaim, one could create a weapon that uses an angled sprite and shoots an angled RailAttack that hits where the player is aiming.
Provisions for this were started but weren't finished.

There are a couple of known bugs:
  • Two bullet chips are created per attack if you allow the weapon to use decals.
  • Over long distances, the attack is wildly inaccurate, due to conversion between floating point and fixed point values.
We used a piece of a function found in the ZDoom wiki:
http://zdoom.org/wiki/Distance

If you use this in your mod, credit to us is appreciated but absolutely not mandatory!

Screenshot:
Spoiler:
Download
User avatar
Scotty
Posts: 35
Joined: Tue Mar 24, 2009 10:43 pm

Re: [ACS] Autoaim enabled railgun

Post by Scotty »

The original version of this resource used a feature from the ZDoom's development branch, which was GetActorProperty's APROP_AttackZOffset. A user requested that I make it compatible with the current stable version of ZDoom.

So here it is! If you have a player class that uses a different AttackZOffset, you'll need to account for that when implementing the script. I added in a constant which takes care of that so it's not a big deal, just change the value and recompile.
You do not have the required permissions to view the files attached to this post.
User avatar
Nash
 
 
Posts: 17465
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: [ACS] Autoaim enabled railgun

Post by Nash »

Nice work, but I wonder what's stopping this from being implemented natively? Seems like something really basic and trivial that it should be addressed at the source level... :S
User avatar
Scotty
Posts: 35
Joined: Tue Mar 24, 2009 10:43 pm

Re: [ACS] Autoaim enabled railgun

Post by Scotty »

Thanks dude! I've wondered that too, it's fairly simple math. Maybe it caused problems or maybe it's to prevent cheap shots in multiplayer.
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US

Re: [ACS] Autoaim enabled railgun

Post by Ed the Bat »

Nash wrote:Nice work, but I wonder what's stopping this from being implemented natively? Seems like something really basic and trivial that it should be addressed at the source level... :S
I'd been told a couple of times that it would, indeed, be simple to add. But, as you can see, two years later it hasn't happened. Without the help of Epic, I still wouldn't have my armor-piercing gun that honors autoaim.

Return to “Resources”