I'm trying to make a hitscan weapon where the bullet spread increases as you keep pressing the trigger. The bullet spread would be gradually restored with time, to avoid being able to cancel the effect with quicktapping or switching weapons. Think of it like a minigun spinning up and down.
So I'm declaring a "minigun_overheat" global variable in ACS and running an ENTER script that periodically lowers its value, leaving it at 0 or above. I have another script to increase that variable, meant to be called in the firing states. And I think I should make another script (function?) to return the current "minigun_overheat" value and use CallACS in the weapon's firing states to go to different states with different spread values with A_JumpIf based on the result. Or perhaps I can pass a variable directly to the angle spread_horz and spread_verz parameters in A_FireBullets?
By this point you can probably tell I have no idea what I'm doing. I could keep banging my head against this, but there's a good chance I'm missing a much easier way to do it and there might be examples floating around, so I figured I'd ask you guys first. Any thoughts?
Dynamic weapon spread
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
- Matt
- 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
- Contact:
Re: Dynamic weapon spread
Can you use CallACS inside the A_FireBullets parameters?
-
Blue Shadow
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: Dynamic weapon spread
Absolutely.Vaecrius wrote:Can you use CallACS inside the A_FireBullets parameters?
Re: Dynamic weapon spread
Maybe something like this. I haven't tried the code in action, but I guess you'll get the general idea (others may point out flaws or if there's a room for improvement).
Spoiler:
Re: Dynamic weapon spread
Thank you! Changed the numbullets parameter to -1 to avoid accurate quicktapping, but otherwise everything seems to work just as it's supposed to. Now to toy with balance... 