Jump to content

Way to force draw bar


Recommended Posts

Hi guys.

In 1.6 was added some new functions for HUD. I liked the idea to use it to draw my stamina bar in place, where is breath bar by default. But then I got a problem - until the player gets into the water, breath bar x, y = 0, 0. Is there a way to force draw that bar without going into water?

Link to comment
  • Moderators
  On 05/04/2025 at 21:55, IIYAMA said:

But as alternative you can draw a bar under it with:

Expand  

That's something that I want to do. And if breath bar has its coords, then all ok. But if not, then stamina bar going to left top corner. I just can't upload images.

If character will be in water while player has black screen by fadeCamera() and HUD off, will it trigger breath bar?

 

Link to comment
  • Moderators
  On 06/04/2025 at 00:36, DarkStalker30 said:

If character will be in water while player has black screen by fadeCamera() and HUD off, will it trigger breath bar?

Expand  

It will probably be visible when the camera is fade out. So yes you need to add some more exceptions for unexpected situations.

This condition might catch some of the problems:

if getCameraTarget () ~= localPlayer then return end

 

Link to comment
Posted (edited)
  On 06/04/2025 at 09:24, IIYAMA said:

It will probably be visible when the camera is fade out. So yes you need to add some more exceptions for unexpected situations.

This condition might catch some of the problems:

if getCameraTarget () ~= localPlayer then return end

 

Expand  

I found another way. On start interface resource add and instant remove armor to localPlayer, it's turning on armor bar, then taking health bar coords, armorY + (healthY - armorY) / 2 = breathY. And it's working perfect.

UPDATE: for correct working of this method you need to let armor bar to be drawn for 1 frame at least. I used a timer, which checking armorX and armorY, until they became not 0, 0.

Edited by DarkStalker30
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...