Controlled Shotgun Spread

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Posts: 168
Joined: Sun Jun 11, 2017 11:42 am
Location: New England, US

Controlled Shotgun Spread

Post by Exosphere »

Hello forums,

I've been thinking about trying something out with my shotgun weapon. I want to try and make it so that the spread of the pellets are fired in a specific pattern, similar to whats found in some arena shooters, such as Quake Champions, Overwatch, and Team Fortress 2. However, I have no idea how I would do something like this code-wise. If anyone has any ideas or code examples, it would be greatly appreciated. Ideally, I would also like it to work not only with A_FireBullets, but A_FireProjectile as well.
Last edited by Exosphere on Sat Jul 28, 2018 8:10 pm, edited 1 time in total.
User avatar
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Controlled Shotgun Spread

Post by Matt »

A bunch of A_FireBullets calls that each fire 1 bullet with FBF_EXPLICITANGLE should get the effect you want.

Same thing with A_SpawnProjectile but you don't need that flag.

Return to “Scripting”