Changing WeaponReady flags

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!)
andreboomer
Posts: 18
Joined: Wed Feb 16, 2022 9:04 pm
Discord: Dre#2260
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Changing WeaponReady flags

Post by andreboomer »

I have figured out how easy it is to change flags through null checking. But for example, a WeaponReady flag is not identified through the method:
TNT1 A 0
{
invoker.BALLOWZOOM = true;
}
Which I'm guessing is due to Allow Zoom being attached to the A_WeaponReady(); function. Is there a way I can manipulate these flags depending on a player's inventory?
User avatar
Blue Shadow
Posts: 4903
Joined: Sun Nov 14, 2010 12:59 am
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Changing WeaponReady flags

Post by Blue Shadow »

Code: Select all

Ready:
    BLAH A 1
    {
        int wrflags = 0;
        if (FindInventory("BlueCard") wrflags |= WRF_ALLOWRELOAD;
        A_WeaponReady(wrflags);
    }
    Loop; 
If the player has a blue keycard in the inventory, the Reload state sequence is entered if the reload key is pressed.
Guest

Re: Changing WeaponReady flags

Post by Guest »

Thanks for the reply. One more thing, how could I do the same thing but instead of with inventory through getplayer input?
Also, would this need to become a virtual function? If I were to implement this?

Return to “Scripting”