DrawBar problem - SBARINFO

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!)
User avatar
ramon.dexter
Posts: 1536
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

DrawBar problem - SBARINFO

Post by ramon.dexter »

Hi, I was using this code to display bar for various types of armor:

Code: Select all

DrawBar "ARBAR", "EPBAR", armor, Horizontal, interpolate(2), 49, 195;
I can remember that this code worked correctly for various types of armor (higher than 100 or 200). But now, with gzdoom v3.4.1 this doesnt work anymore - the bar starts to shorten only after reaching 100 and lower.

How do I make it work with all amounts of armor? I thought that putting 'armor' should work, but obviously it doesn't.
Blue Shadow
Posts: 4951
Joined: Sun Nov 14, 2010 12:59 am

Re: DrawBar problem - SBARINFO

Post by Blue Shadow »

ramon.dexter wrote:I can remember that this code worked correctly for various types of armor (higher than 100 or 200). But now, with gzdoom v3.4.1 this doesnt work anymore - the bar starts to shorten only after reaching 100 and lower.
Are you sure? Because If you don't specify a max value for the bar, like what you're doing there, it's assumed to be 100. So it couldn't possibly have worked like you describe.
How do I make it work with all amounts of armor?
You can set the max value of the bar dynamically by an inventory item given to the player. The Amount property of the item determines the max value. You obviously want to alter the amount of the item to match the max "durability" of the armor you're wearing. For that you want to use ACS or ZScript.

Return to “Scripting”