Scripts / Dvader hud script

Author
Message
JC LEON
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 2nd Nov 2019 23:20 Edited at: 3rd Nov 2019 08:51
Hi to all i recenlty saw the great Dvader tutorial on how to make a custom hud
here the dead forum link

https://forum.game-guru.com/thread/216400?page=1#msg2559566

btw i downlaoded the script


and noticed that the health bar starting to mess up when health reach a really low value and completely mess when player health reach zero

can someone tell me why and how to solve?
many thanks in advance

here my video


Leon
PC 2 Specs:
AMD RYZEN 2600 SIX CORE @3,70, 64GB RAM DDR4 2400, M/B GIGABYTE AX370
SVGA NVDIA 1660GTX 6GB , SSD M.2 TRANSCEND S110 1TB, 1X HDD SEAGATE BARRACUDA 4TB, 1X HDD TOSHIBA 2TB


PC 2 Specs:
AMD QUADCORE 880K @4.5GHZ, 32GB RAM DDR3 1600, M/B ASUS A88XM-PLUS
SVGA RADEON R9 380 4GB , SSD KINGSTON A400 1TB, 2X HHD SEAGATE BARRACUDA 4TB
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Nov 2019 19:28
yes you need to adjust this line
SetSpriteSize( cursor_sp,g_PlayerHealth/(initialhealth/10),3)
or rather this part of it
g_PlayerHealth/(initialhealth/10)
as currently it just divides your current health by the starting health (divided by 10)... ideally you want a %
so perhaps something like
local size = (initialhealth/10) * (g_PlayerHealth/initialhealth)
if size < 1 then size = 1 end
SetSpriteSize( cursor_sp,size,3)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
JC LEON
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 3rd Nov 2019 21:34
thanks smallg but i sincerely didnt undestand what you wrote..

btw the original scirpt i linked above waas for the original Dvader healthbar script and sincerely i noticed that changing the bar texture with another i solved the issue with the original healthbar script.. so iused the same bar bor my hunger script and i have a strange issue since bar never go down..but with the prevoius bar (that one form my video) the bar goes down...i 'm going crazy

btw this is my hunger script


PC 2 Specs:
AMD RYZEN 2600 SIX CORE @3,70, 64GB RAM DDR4 2400, M/B GIGABYTE AX370
SVGA NVDIA 1660GTX 6GB , SSD M.2 TRANSCEND S110 1TB, 1X HDD SEAGATE BARRACUDA 4TB, 1X HDD TOSHIBA 2TB


PC 2 Specs:
AMD QUADCORE 880K @4.5GHZ, 32GB RAM DDR3 1600, M/B ASUS A88XM-PLUS
SVGA RADEON R9 380 4GB , SSD KINGSTON A400 1TB, 2X HHD SEAGATE BARRACUDA 4TB
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 4th Nov 2019 08:36 Edited at: 4th Nov 2019 19:38
You shouldn't create a sprite in a loop, you only need to create it once or again only if it has been deleted - edit; this will cause the previous bars to still be visible at the old sizes as the bar changes
so you just need to move the createsprite command outside of the main loop (or add a toggle variable if you needed it to be deleted/created at runtime - as the orignial does, it only creates the sprite when the player presses a key)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
JC LEON
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 16th Nov 2019 23:53 Edited at: 16th Nov 2019 23:54
thanks smallg i made like you said but why i have this strange issue on the bar when stamina is really low??
the bar is the same of the healthbar in the top left corner of the screen( only different color, green) and the health bar works fine but the unher bar become weird when stamina is too low.. like you can see in the video
PC 2 Specs:
AMD RYZEN 2600 SIX CORE @3,70, 64GB RAM DDR4 2400, M/B GIGABYTE AX370
SVGA NVDIA 1660GTX 6GB , SSD M.2 TRANSCEND S110 1TB, 1X HDD SEAGATE BARRACUDA 4TB, 1X HDD TOSHIBA 2TB


PC 2 Specs:
AMD QUADCORE 880K @4.5GHZ, 32GB RAM DDR3 1600, M/B ASUS A88XM-PLUS
SVGA RADEON R9 380 4GB , SSD KINGSTON A400 1TB, 2X HHD SEAGATE BARRACUDA 4TB
PM
archkali
4
Years of Service
User Offline
Joined: 21st Dec 2019
Location: Los Angeles
Posted: 23rd Dec 2019 10:08
Sorry to ask this here but....nowhere can I find documentation about how to attach a script to a persistent dynamic entity. The player character doesnt allow a script... so where do I put this script? On a invisible wall that I make sure is in every level?
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 23rd Dec 2019 14:58
Attach it to anything in your level, you can even create special markers to attach scripts to make them easier to find in the editor.

In the _init function of the script just have:
Hide( e )
CollisionOff( e )

… and they will not be seen or interfere with the player at runtime.
Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-04-26 15:05:25
Your offset time is: 2024-04-26 15:05:25