Preventing Infinite Recursion in WorldHitscanPreFired

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!)
Post Reply
User avatar
stainedofmind
Posts: 221
Joined: Sun Sep 01, 2019 10:59 am

Preventing Infinite Recursion in WorldHitscanPreFired

Post by stainedofmind »

Hi! In brief, I'm wanting to make use of the WorldHitscanPreFired event to allow to universally modify hitscan attacks. Yes, you can tell the event handler to not spawn the hitscan and replace it with a projectile, but if you try to fire a new hitscan projectile, it leads to an infinite recursion crash. I have figured out a really hacky way to get around this, but it doesn't allow for perfect recreation of the hitscan. I'm wondering then if there is currently anyway to modify or re-create a hitscan then without resorting to spawning a projectile. Thank you.
User avatar
kodi
 
 
Posts: 1361
Joined: Mon May 06, 2013 8:02 am

Re: Preventing Infinite Recursion in WorldHitscanPreFired

Post by kodi »

Hello! I actually do this in my mod. I do it by using the LineTrace function to create my new and modified hitscan attack instead of any of the built-in attack functions. LineTrace does not create further Hitscan events. I did this because I needed to check the texture of the attack's hit point, so I could universally add fitting particle effects.
User avatar
stainedofmind
Posts: 221
Joined: Sun Sep 01, 2019 10:59 am

Re: Preventing Infinite Recursion in WorldHitscanPreFired

Post by stainedofmind »

kodi wrote: Fri Jul 11, 2025 5:08 am Hello! I actually do this in my mod. I do it by using the LineTrace function to create my new and modified hitscan attack instead of any of the built-in attack functions. LineTrace does not create further Hitscan events. I did this because I needed to check the texture of the attack's hit point, so I could universally add fitting particle effects.
Super delayed reply, but thank you for the idea. I wouldn't have thought of it. Is the mod available somewhere so I could take a look at the code? OR if not, are you able to share the basics of it?
Post Reply

Return to “Scripting”