Re: [Solved] ZScript global variables

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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
Marisa the Magician
Banned User
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: [Solved] ZScript global variables

Post by Marisa the Magician »

This is in reference to the last couple posts of this closed thread. I was linked that thread on the Discord a little bit ago and I kinda wanted to give it some "closure", so to say.

Moving the init function to the Ready state of the pistol doesn't cause this bug. I think the problem here is that the way the're doing it, the initialization is somehow being performed before thinkers are deserialized.
This can also happen with Event Handlers if you do the gvar initialization in OnRegister instead of WorldLoaded, for example.
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Re: [Solved] ZScript global variables

Post by Blue Shadow »

So in other word, executing that code on the first tic of the Select state of the weapon is just too early. I see. Thanks for looking into this.

@Nash: No, I didn't report it as bug. I remember being so annoyed and frustrated at the time to the point I didn't bother. I decided to just move on and think of a different solution that doesn't involve using global variables.

Return to “Scripting”