Multiple INVBARs

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
Mush256
Posts: 15
Joined: Tue May 31, 2022 2:05 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Czech Republic

Multiple INVBARs

Post by Mush256 »

Hey, I'm pretty new to Decorate and just wanted to ask, is it possible to have more INVENTORY.INVBAR shown at the same time? I have two types of pickups in my mod but only the first one that is picked up shows up. I would like to have both of them on the screen at the same time, as shown on the image below.
Attachments
h.png
h.png (9.13 KiB) Viewed 288 times
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Multiple INVBARs

Post by Jarewill »

There's no way to make a second inventory bar.
However you can create a custom status bar that will display both items separately.

There's two ways to do this:
1) Using SBARINFO you can modify the default status bar to add another number display using DrawNumber. (Due to limitations, DrawNumber can only display Ammo-based items)
2) The better option is to use ZScript to modify the default status bar (found in gzdoom.pk3:zscript/ui/statusbar/doom_sbar.zs) using FindInventory and DrawString, for example:

Code: Select all

let itm = CPlayer.mo.FindInventory("ItemToDisplay");
If(itm){
    DrawImage("SPRITE", (X, Y));
    DrawString(mSmallFont, FormatNumber(itm.Amount, 1, 3), (X, Y));
}
//Example code, will need tweaking  
User avatar
Mush256
Posts: 15
Joined: Tue May 31, 2022 2:05 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Czech Republic

Re: Multiple INVBARs

Post by Mush256 »

Okay, thank you!
Post Reply

Return to “Scripting”