Problems With GZDoom Not Respecting Tic Delays

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
22alpha22
Posts: 303
Joined: Fri Feb 21, 2014 5:04 pm
Graphics Processor: nVidia with Vulkan support
Location: Montana, USA

Problems With GZDoom Not Respecting Tic Delays

Post by 22alpha22 »

I've recently started simplifying my weapons in my mods by using Anonymous functions rather than a billion or so jumpifs, in the process I've run into a peculiar, game breaking problem. After I simplified my unarmed weapon (code below), switching from the unarmed weapon to any other weapon now causes the other weapons to switch near instantly despite there being delays in how many A_Raise is called per tic. Not only that, after switching to a new weapon from the fist, the new weapon behaves strangely, with random weapon actions performing much quicker than there supposed to and sometimes the weapon locks up completely. If the weapon locks up, it wont respond to any command and becomes impossible to switch away from. Even more strangely, the rest of the game continues to run fine, I can still move and interact with the map. I have to manually remove the weapon via console commands to regain control of my arsenal. This only happens when switching from the fist to another weapon. Switching from any other weapon to another doesn't break anything.

The new unarmed fist:
Spoiler:
The old fist:
Spoiler:
Note when I reverted back to the old fist code, the problems went away.

Another weapon's code for reference:
Spoiler:
When switching from the fist to this weapon or any other, the weapon raises instantly and behaves unpredictably. When switching from any other weapon, it raises at the normal speed and behaves as expected.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Problems With GZDoom Not Respecting Tic Delays

Post by Graf Zahl »

You shouldn't call A_Raise and A_Lower repeatedly in the same state. This behaves subtly different in case the desired animation ends. With only one call per state it jumps to the ready state, meaning that the following A_Raise states never get called. But with your new grouping it jumps to the ready state just as before, but since the anonymous function hasn't ended yet it will also run through the subsequent A_Raise calls and mess things up quite badly.

Sadly the weapon code suffers from some serious design issues that cannot be undone without breaking 25 years of modding.
User avatar
22alpha22
Posts: 303
Joined: Fri Feb 21, 2014 5:04 pm
Graphics Processor: nVidia with Vulkan support
Location: Montana, USA

Re: Problems With GZDoom Not Respecting Tic Delays

Post by 22alpha22 »

Ok that makes sense now that I think about it. I wasted several hours trying figure it out where problem was before I isolated it to the fist but I didn't know what the actual problem was. Glad to have this worked out. :)
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Problems With GZDoom Not Respecting Tic Delays

Post by Void Weaver »

A bit offtopic but you can just specify weapon lowering or rising speed in function itself. So A_Lower(24) will deselect weapon 4 times faster.
Post Reply

Return to “Scripting”