Hello, I wanted to know if Math.Clamp() works on DProgressBars, like as example lets take the players health, a ProgressBar can only go from 0 to 1, if I clamp the player health to these numbers, would it be like for the progressbar then like this:
player HP: 100 = Progressbar 1(100%)
player HP: 99 = Progressbar 0.99(99%)
player HP: 50 = Progressbar 0.50(50%)
or will it be like
player HP: 100 = Progressbar 1(100%)
player HP: 1 = Progressbar 1(100%)
Player HP: 0 = Progressbar 0(0%)
I dont know if you kinda get what I mean, I just hope you do..
Why don't you try it?
[QUOTE=Donkie;48034146]Why don't you try it?[/QUOTE]
Because I currently cant since I aint at my PC until 8PM GMT 1, plus if its a "kind of" stupid question, it would stop others from asking it, right?
THERES PROGRESS BARS. WHAT
PS: Playerhealth / 100 clamped from 0 to 1 would do what you want, I think
[QUOTE=whitestar;48034184]Because I currently cant since I aint at my PC until 8PM GMT 1, plus if its a "kind of" stupid question, it would stop others from asking it, right?[/QUOTE]
That's a shit excuse. Just want until you get to your PC and try it. There's no need to ask such questions as "what will happen if". Just go and try it yourself. If it doesn't do what you want it to do - come and ask your questions.
Okay, the progressbar doesnt work as I wanted it to. it doesnt count the health as it should, means 1HP is still 100%, how can I make 1HP be 1%?
[editline]23rd June 2015[/editline]
[QUOTE=Kevlon;48034779]THERES PROGRESS BARS. WHAT
PS: Playerhealth / 100 clamped from 0 to 1 would do what you want, I think[/QUOTE]
What if health is over 100? :p
player:Health() / player:GetMaxHealth()
[editline]23rd June 2015[/editline]
If you use DProgressBar, 10000% hp will be shown as 100%
[QUOTE=Robotboy655;48035277]player:Health() / player:GetMaxHealth()
[editline]23rd June 2015[/editline]
If you use DProgressBar, 10000% hp will be shown as 100%[/QUOTE]
first, thanks. second, when the player dies, theres still a bit of the progressbar filled, some huds "bypassed" this way with "if blah < 0 then blah = 0" and stuff, dont know if that applies for DProgress though, and the health was just an example, what if I want stuff like an XP system, how would I make the percentage of the total value?
Why are you using Derma elements for HUD?
The progress bar has a bug: [url]https://github.com/Facepunch/garrysmod-issues/issues/1402[/url]
[QUOTE=Robotboy655;48035332]Why are you using Derma elements for HUD?
The progress bar has a bug: [url]https://github.com/Facepunch/garrysmod-issues/issues/1402[/url][/QUOTE]
I dont use DProgress on the hud directly, I use it in a DFrame with concommand, because the HUDPaint hook is a think hook.
[QUOTE=Robotboy655;48035332]Why are you using Derma elements for HUD?[/QUOTE]
I use derma for HUD elements to take advantage of docking and all the other features.
[QUOTE=Robotboy655;48035332]Why are you using Derma elements for HUD?[/QUOTE]
Derma is great for huds
[QUOTE=Kamshak;48039100]Derma is great for huds[/QUOTE]
Depends, since HUDPaint is a think hook, the game would lag like hell if you'd use DProgress in that hook.
[QUOTE=whitestar;48040155]Depends, since HUDPaint is a think hook, the game would lag like hell if you'd use DProgress in that hook.[/QUOTE]
You don't use it in the hook, you simply create it and update it in it's own Think hook. You can use SetPaintedManually/PaintManual to force your HUD Panel to paint in HUDPaint. It doesn't cause any performance impact at all.
Sorry, you need to Log In to post a reply to this thread.