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.

Problems With GZDoom Not Respecting Tic Delays

Postby 22alpha22 » Wed Aug 14, 2019 2:20 am

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
22alpha22
So lonely...
 
Joined: 21 Feb 2014
Location: Montana, USA
Operating System: Windows Vista/7 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: Problems With GZDoom Not Respecting Tic Delays

Postby Graf Zahl » Wed Aug 14, 2019 3:07 am

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Problems With GZDoom Not Respecting Tic Delays

Postby 22alpha22 » Wed Aug 14, 2019 1:34 pm

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
22alpha22
So lonely...
 
Joined: 21 Feb 2014
Location: Montana, USA
Operating System: Windows Vista/7 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: Problems With GZDoom Not Respecting Tic Delays

Postby Void Weaver » Wed Aug 14, 2019 8:37 pm

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.
User avatar
Void Weaver
Keeper of the Diablo bestiary storage Also amateur DECORATE-spaghetti weaver ಠ_ಠ
 
Joined: 18 Dec 2014


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest