[Solved] How do i hide all units HP / hitpoints / health? (not Bars) (only numbers) (without changing HP or any units settings)

Level 7
Joined
Oct 16, 2018
Messages
87
what "Title" says.

dont say "set hp to 100000000000" because i want my units attack and kill each other like what happens in most of maps.


how do i? :huh:


------------------------------------

~the SOLUTION~

Credits:
- Retera
- Tasyen
- Uncle


  • Hide HP and Mana
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 10 (Light Blue) Selects a unit
      • Player - Player X (...) Selects a unit
    • Conditions
    • Actions
      • -------- ---------------- --------
      • -------- ---------------- --------
      • -------- ---------------- --------
      • -------- HP [LUA] --------
      • Custom script: local frame = BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT, 0)
      • Custom script: BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT,0), "", 0.0, 0)
      • -------- Mana [LUA] --------
      • Custom script: local frame = BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_MANA_TEXT, 0)
      • Custom script: BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_MANA_TEXT,0), "", 0.0, 0)
      • -------- ---------------- --------
      • -------- ---------------- --------
      • -------- ---------------- --------
      • -------- HP [vJASS] --------
      • Custom script: call BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT,0), "", 0.0, 0)
      • -------- Mana [vJASS] --------
      • Custom script: call BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_MANA_TEXT,0), "", 0.0, 0)
 
Last edited:
Level 4
Joined
Dec 11, 2019
Messages
55
From what i remember giving them " 150000 " in object editor is enough to get it invisible most of the time you also gotta give it invulnerable to give it the unkillable face. Unless you aim for Units who have 0 health and are vulnerable.

The other way is transforming the certain unit into a Doodad and give it the certain health which won't show up.
 
If you are using Patch 1.31 or Patch 1.32, you could also modify the Game UI so that these numbers are not displayed visually.

The function to hide a framehandle (of the UI) is "BlzFrameSetVisible(hpTextFrame, false)" or something like that if I recall. The only hard part would be getting access to the HP text frame handle. I have not personally done it but if you look up Tasyen's UI tutorials it might help you find the answer.
 
Level 7
Joined
Oct 16, 2018
Messages
87
From what i remember giving them " 150000 " in object editor is enough to get it invisible most of the time you also gotta give it invulnerable to give it the unkillable face. Unless you aim for Units who have 0 health and are vulnerable.

The other way is transforming the certain unit into a Doodad and give it the certain health which won't show up.

no no this is not what i want.

just turning off HP numbers (those green ones) in UI when players click on units, not changing their HP or turning them to doodads.
but anyway, thank you for your answer.








If you are using Patch 1.31 or Patch 1.32, you could also modify the Game UI so that these numbers are not displayed visually.

The function to hide a framehandle (of the UI) is "BlzFrameSetVisible(hpTextFrame, false)" or something like that if I recall. The only hard part would be getting access to the HP text frame handle. I have not personally done it but if you look up Tasyen's UI tutorials it might help you find the answer.

yes its 1.32.

some questions: :ugly:
what is "framehandle"?
if "BlzFrameSetVisible(hpTextFrame, false)" is the solution then how do i use this?

thank you for your answer.
 
Last edited:
1649527739719.png


When I searched through the UI tutorial by tasyen, it looks like he says that Patch 1.32 added these constants to access the origin frames.

So it looks to me like the way to use it will be to call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT, 0), false) probably.
Tasyen notes that this function call will only work after you select a unit at the start of the game, because the HP text is one of the frames that "Doesn't exist until any selection was done." So, you can't hide it like this when the map starts. Instead, each player needs to select a unit that will show HP, and then that first load will bring the HP text frame into the UI caching system, and only then you can refer to it from code and make it disappear.

I think there's a function to select a unit as the game starts, though. So doing this is probably easier than it sounds.
 
Level 7
Joined
Oct 16, 2018
Messages
87
View attachment 397926

When I searched through the UI tutorial by tasyen, it looks like he says that Patch 1.32 added these constants to access the origin frames.

So it looks to me like the way to use it will be to call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT, 0), false) probably.
Tasyen notes that this function call will only work after you select a unit at the start of the game, because the HP text is one of the frames that "Doesn't exist until any selection was done." So, you can't hide it like this when the map starts. Instead, each player needs to select a unit that will show HP, and then that first load will bring the HP text frame into the UI caching system, and only then you can refer to it from code and make it disappear.

I think there's a function to select a unit as the game starts, though. So doing this is probably easier than it sounds.

thanks for your useful reply!

im always dealing with GUI for creating maps, So...
how do i use these codes?

local frame = BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT, 0)
BlzFrameSetAbsPoint(frame, FRAMEPOINT_CENTER, 0.4, 0.3)

local frame = BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_MANA_TEXT, 0)
BlzFrameSetAbsPoint(frame, FRAMEPOINT_CENTER, 0.4, 0.28)
 
One easy way to use script in GUI is to go to your Trigger to where it says "Actions" and make a "New Action" and choose "Custom Script". That lets you put script inside the trigger. But it only lets you do one line at a time. So for example you could try putting

Code:
call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT, 0), false)

Inside one of those, and see if it might work.

Maybe it should have "Event - Player selects a unit" or something.

Someone else might reply who knows more and gives a more detailed answer. I'm a little distracted at the moment.
 
Level 7
Joined
Oct 16, 2018
Messages
87
One easy way to use script in GUI is to go to your Trigger to where it says "Actions" and make a "New Action" and choose "Custom Script". That lets you put script inside the trigger. But it only lets you do one line at a time. So for example you could try putting

Code:
call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT, 0), false)

Inside one of those, and see if it might work.

Maybe it should have "Event - Player selects a unit" or something.

Someone else might reply who knows more and gives a more detailed answer. I'm a little distracted at the moment.


my trigger:
events-...
conditions-...
actions-
custom script: local frame = BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT, 0)
custom script: BlzFrameSetAbsPoint(frame, FRAMEPOINT_CENTER, 0.4, 0.3)


moves the text to center of screen.
the problem must be this part: "BlzFrameSetAbsPoint(frame, FRAMEPOINT_CENTER, 0.4, 0.3)"
its Lua.

can you take a look?



thank you for your assistance!
 
Yeah. The coordinate system for the Blz frames always has a screen width of 0.8 and a screen height of 0.6, so 0.4 and 0.3 (being each half of those width and height values) will put something at the center of the screen.
But that's great. That means you got it to work.

What if you change the lua for moving to the center of the screen and you tell it to hide instead?

So you could change

Code:
custom script: BlzFrameSetAbsPoint(frame, FRAMEPOINT_CENTER, 0.4, 0.3)

to be like

Code:
custom script: BlzFrameSetVisible(frame, false)

(just as a note, I've spent more time in jass than lua so if you get some lua error you might need to adjust or fix something. My code above is just a sample brainstorm and I didn't try it yet myself)
 
Level 7
Joined
Oct 16, 2018
Messages
87
Yeah. The coordinate system for the Blz frames always has a screen width of 0.8 and a screen height of 0.6, so 0.4 and 0.3 (being each half of those width and height values) will put something at the center of the screen.
But that's great. That means you got it to work.

What if you change the lua for moving to the center of the screen and you tell it to hide instead?

So you could change

Code:
custom script: BlzFrameSetAbsPoint(frame, FRAMEPOINT_CENTER, 0.4, 0.3)

to be like

Code:
custom script: BlzFrameSetVisible(frame, false)

(just as a note, I've spent more time in jass than lua so if you get some lua error you might need to adjust or fix something. My code above is just a sample brainstorm and I didn't try it yet myself)


i feel this is the SOLUTION and is correct, or is very close to the solution.

i see in that UI Tutorial there is the same thing for disabling UI things "BlzFrameSetVisible(frame, false)"

  • Actions
    • Custom script: local frame = BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT, 0)
    • Custom script: BlzFrameSetVisible(frame, false)

and i can launch the world editor Test, but when i select a unit... BOOM! it crashes :ugly:


its enough for today, thank you for your assistance and fast-answering.
 
The game does not support hiding String/Texture-SimpleFrames. Set once per second the font of them to nothing.
BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT,0), "", 0.0, 0)
BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_MANA_TEXT,0), "", 0.0, 0)
 

Uncle

Warcraft Moderator
Level 42
Joined
Aug 10, 2018
Messages
4,189
what "Title" says.

dont say "set hp to 100000000000" because i want my units attack and kill each other like what happens in most of maps.


how do i? :huh:


------------------------------------

~the SOLUTION~

Credits:
- Retera
- Tasyen


  • Hide HP and Mana
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 10 (Light Blue) Selects a unit
      • Player - Player X (...) Selects a unit
    • Conditions
    • Actions
      • -------- HP [LUA] --------
      • Custom script: local frame = BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT, 0)
      • Custom script: BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT,0), "", 0.0, 0)
      • -------- Mana [LUA] --------
      • Custom script: local frame = BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_MANA_TEXT, 0)
      • Custom script: BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_MANA_TEXT,0), "", 0.0, 0)
You can delete the local frame lines since you're not using them for anything. Nor do you even need them.
  • Actions
    • -------- HP [LUA] --------
    • Custom script: BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT,0), "", 0.0, 0)
    • -------- Mana [LUA] --------
    • Custom script: BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_MANA_TEXT,0), "", 0.0, 0)
Also, if you want this to work for Jass simply put "call " in front of those 2 BlzFrameSetFont() functions.
  • Custom script: call BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT,0), "", 0.0, 0)
  • Custom script: call BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_MANA_TEXT,0), "", 0.0, 0)
I doubt you'll want to run your map in Lua mode if you're not going to code any Lua yourself. Most of the systems you'll find on this site were designed for Jass.
 
Level 7
Joined
Oct 16, 2018
Messages
87
You can delete the local frame lines since you're not using them for anything. Nor do you even need them.
  • Actions
    • -------- HP [LUA] --------
    • Custom script: BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT,0), "", 0.0, 0)
    • -------- Mana [LUA] --------
    • Custom script: BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_MANA_TEXT,0), "", 0.0, 0)
Also, if you want this to work for Jass simply put "call " in front of those 2 BlzFrameSetFont() functions.
  • Custom script: call BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT,0), "", 0.0, 0)
  • Custom script: call BlzFrameSetFont(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_MANA_TEXT,0), "", 0.0, 0)
I doubt you'll want to run your map in Lua mode if you're not going to code any Lua yourself. Most of the systems you'll find on this site were designed for Jass.


thanks alot for the vjass version!

yes i was thinking about the same thing (the future issues with jass spells)
 
Last edited:
Top