• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Script] Hero/unit info panel

Status
Not open for further replies.
Level 3
Joined
Dec 30, 2021
Messages
18
Hello everyone! I'm a GUI custom map maker and to make Resource Bars I need to learn Jass or Lua. I just started reading tutorials but this upgrade I need on my map asap :thumbs_up: Let me know if it's even possible do this way.
So the example pannel gonna look like this:
1660133678141.png

From upper left:
1st value is Hero's/Unit's Damage (base: 125 - 200 and bonus: +105)
icon: "ReplaceableTextures\CommandButtons\BTNAttack.blp" or icon matching attack type (if possible)

2nd value is Hero's/Unit's Attack Cooldown (base: 1.8/reduced by IAS: 1.50)
icon: "ReplaceableTextures\CommandButtons\BTNHoldPosition.blp"

3rd value is Hero's/Unit's
Attack Speed (IAS) (+20%) - not sure if it's even possible to get this value
icon: "ReplaceableTextures\CommandButtons\BTNGlove.blp"

4th value is Hero's/Unit's
Armor (base: 12 and bonus: +121)
icon: "ReplaceableTextures\CommandButtons\BTNStop.blp" or icon matching defense type (if possible)

5th value is Hero's/Unit's
Evasion (21%) - taken from Hero's Evasion "ACev" ability level -1 (Level 1 Evasion = 0% chance, Level 2 = 1%...). If unit doesnt have Evasion ability show 0%.
icon: "ReplaceableTextures\CommandButtons\BTNEvasion.blp"

6th value is Hero's/Unit's
Movement Speed (current movement speed: 325) - it would be awesome to make the numbers red if the current value is under base value and green when it's above.
icon: "ReplaceableTextures\CommandButtons\BTNBootsOfSpeed.blp"


7th value is Hero's
Strength (base: 12 and bonus: +8)

8th value is Hero's
Agility (base:17 and bonus +6) displayed in < > to point a Primary Attribute

9th value is Hero's
Intelligence (base: 8 and bonus +3)

Hovering 1st value displays info window:
1660135263958.png

This one is pretty similar to default one but i prefer displaying exact range instead of "melee".
Also it would be nice if tooltip is taken from Game Interface like here: Attack type - Hero = DAMAGETIP_HERO
It would be even more awesome if new
Damage icon would match hero's/unit's Damage type icon and be dynamic.


Hovering 2nd value displays info window:
1660135873465.png

Again 1.80 value is the base unit's attack cooldown value and
1.50 is the value decreased by IAS. So if unit has 20% total increased attack speed it will display the decreased value. The formula was: Base Attack CD/(1 + IAS) ---> 1.8/(1+0.2) = 1.5.

Hovering 3rd value displays info window:
1660136149149.png

In the tooltip i would like to contain only the amount of sec the IAS reduces so 1.8 - 1.5 = 0.3

Hovering 4th value displays info window:
1660136529429.png

Same as Damage window but no Movement Speed info.
Also it would be nice if tooltip is taken from Game Interface like here: Defense type - Hero = ARMORTIP_HERO
It would be even more awesome if new
Armor icon would match hero's/unit's Defense type icon and be dynamic.

Hovering 5th value displays info window:
1660136873665.png

Once again the value i taken from hero's/unit's Evasion "ACev" ability level -1. If Evasion level is 22, it should display the 21% value. If the unit has no Evasion ability display 0%.

Hovering 6th value displays info window:
1660137143863.png

Displays current hero's/unit's movement speed.
It would be awesome to make the numbers
red if the current value is under base value and green when it's above.

Hovering 7th value displays info window:

1660137385093.png

Would be nice if [Strength per level] value would be displayed from hero's [STRplus], [each point...maximum health] from Game Constans [StrHitPointBonus], [each point...health regeneration] from Game Constans [StrRegenBonus]. And totals multipled by that value.

Hovering 8th value displays info window:
1660137842911.png

Would be nice if [Agility per level] value would be displayed from hero's [AGIplus]
It would be also nice to add how much the primary attribute (which is agilility in this case) damage adds like: "....by 0.5 (
+11.5 total)".
It would be also super awesome to add how much attack speed agility adds like: "...by 1% (
+23% total)"
I won't show how much each point of agility increases Evasion chance because the formula is complicated. But maybe it is good idea to add total like: "...chance (
+16% total). The value would be taken from the following formula:
((((Agility - Hero's Level) x 0.75)/(100 + ((Agility - Hero's Level) x 0.75)) + 0.02) x 100)
or global variable ((Evasion + 0.02) x 100))

Hovering 9th value displays info window:
1660139851286.png

Would be nice if [Intelligence per level] value would be displayed from hero's [INTplus], [each point...maximum mana] from Game Constans [IntManaBonus], [each point...mana regeneration] from Game Constans [IntRegenBonus]. And totals multipled by that value.

Colors: |cffffa500Damage|r |Cffffcc00Hero|r |cffFF0000Strength|r |cff00FF00Agility|r |CFF3366FFIntelligence|r |cffFFFF00Armor:|r |cffFFFFCCTooltip|r

I got a feeling like I'm asking way too much but even posting it gives me joy.
Most of these things I'm asking are probably impossible to do or not even worth starting but atleast I try.
I will be appreciate any answer under this post.
Good Luck!
 
Last edited:
Level 14
Joined
Jan 24, 2017
Messages
246
The only solution I can think of is a custom UI. This has some issues:
  • You need to check if a Hero is selected and update the values in a loop.
  • You overwrite the normal UI or need to remove it.
I made a proof of concept map with Warcraft 3 Reforged UI Designer (RUID) . I highly recommend this tool to start getting into Custom UI and then edit the code you get from it. The map I made is just a test and only works for player red, so you would need to use local player to update the UI for each player individually.
 

Attachments

  • Hero UI.w3m
    43.6 KB · Views: 26
Level 3
Joined
Dec 30, 2021
Messages
18
Thank you for your replay @Ziadoma. I have studied this amazing tool and I have few issues with it.
1. If I make black backdrop to cover original Blizzard's stats, it still displays Unit's Damage/Armor/Primary Attribute tooltip when hovering them.
2. Now the hardest thing will be displaying the values of Damage / current attack cooldown / increased attack speed / armor and so on
 
I don't know of a function to get the current attackspeed only base attackspeed. One would need to store all attackspeed-bonus sources and then have a calc function which checks for all that effects and returns the proper value or code all attackspeed boni.

Range is readable by unit weapon real field when you mod V1.32+

primary stat is an Unit Integer Field UNIT_IF_PRIMARY_ATTRIBUTE

For Damage & Armor Text you can just copy the default display.
BlzFrameGetText(BlzGetFrameByName("InfoPanelIconValue", 0)
BlzFrameGetText(BlzGetFrameByName("InfoPanelIconValue", 2)

1. If I make black backdrop to cover original Blizzard's stats, it still displays Unit's Damage/Armor/Primary Attribute tooltip when hovering them.
There are multiple options to get rid of them.

Scale them down to 0.00001 with BlzFrameSetScale

Create a hidden SIMPLEFRAME and make it the parent of them
JASS:
function Test takes nothing returns nothing
    local framehandle newParent = BlzCreateFrameByType("SIMPLEFRAME", "", BlzGetFrameByName("ConsoleUI", 0), "", 0)
    call BlzFrameSetVisible(newParent, false)
    call BlzFrameSetParent(BlzGetFrameByName("SimpleInfoPanelIconDamage",0), newParent)
    call BlzFrameSetParent(BlzGetFrameByName("SimpleInfoPanelIconDamage",1), newParent)
    call BlzFrameSetParent(BlzGetFrameByName("SimpleInfoPanelIconArmor",2), newParent)
    call BlzFrameSetParent(BlzGetFrameByName("SimpleInfoPanelIconRank",3), newParent)
    call BlzFrameSetParent(BlzGetFrameByName("SimpleInfoPanelIconFood",4), newParent)
    call BlzFrameSetParent(BlzGetFrameByName("SimpleInfoPanelIconGold",5), newParent)
endfunction
 
Attack-speed is hard. You'd need to use a system to store all modifiers to attack-speed in or it's impossible to get current attack-speed.
I've used New Bonus [vJASS][LUA] before doing my Extendable Bonus System (I have not updated that thread in a while, changes have occurred).

With that, you need to setup bonuses from items/abilities using non-GUI and then you can read what the current bonus is.
 
Level 3
Joined
Dec 30, 2021
Messages
18
Attack-speed is hard. You'd need to use a system to store all modifiers to attack-speed in or it's impossible to get current attack-speed.
I've used New Bonus [vJASS][LUA] before doing my Extendable Bonus System (I have not updated that thread in a while, changes have occurred).

With that, you need to setup bonuses from items/abilities using non-GUI and then you can read what the current bonus is.
Thats unfortunet.
Which kind of frametype should I use to make icon+value?
I made button for icons (because it can glow when hovering) and texframe for values.
Is it possible to bind it together and make it glow together when hovering but being not clickable like button?
Just like you on this ss:
1660586523796.png
 
Last edited:
Level 3
Joined
Dec 30, 2021
Messages
18
For Damage & Armor Text you can just copy the default display.
BlzFrameGetText(BlzGetFrameByName("InfoPanelIconValue", 0)
BlzFrameGetText(BlzGetFrameByName("InfoPanelIconValue", 2)
How to put these into code, the UI creator made?
I did this way but it doesn't display anything.
I feel I'm lacking Jass knowledge too much.

set TextAD = BlzCreateFrameByType("TEXT", "name", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
call BlzFrameSetAbsPoint(TextAD, FRAMEPOINT_TOPLEFT, 0.337500, 0.0823100)
call BlzFrameSetAbsPoint(TextAD, FRAMEPOINT_BOTTOMRIGHT, 0.381040, 0.0661000)
call BlzFrameSetText(TextAD, BlzFrameGetText(BlzGetFrameByName("InfoPanelIconValue", 0)))
call BlzFrameSetEnable(TextAD, false)
call BlzFrameSetScale(TextAD, 0.643)
call BlzFrameSetTextAlignment(TextAD, TEXT_JUSTIFY_TOP, TEXT_JUSTIFY_LEFT)
 
How to put these into code, the UI creator made?
I did this way but it doesn't display anything.
Put it in the UI update code, not in the UI creation code. The UI creation code runs once at map init/0s, it creates all the needed Frames and loads in frame-blueprints. While the update code runs every 0.xx seconds or on every unitselection and it update the displayed Text/Tooltip/Icons to fit the current situation.

Is it possible to bind it together and make it glow together when hovering but being not clickable like button?
That was created by having a textureless button with a glow feature (highlight child) which has 2 child-Frames the icon and text. The button's Size contains both the icon and text. The Text is anchored to the right Side of the Button while the Icon is anchored to the left.
the specific frame in the image was defined in fdf (checkout the map imports from where you have that) and belongs to the SimpleFrame family. I think RUID is not able to create SimpleFrames. But you can create something quite alike using the Frame family.

You need a BUTTON or GLUEBUTTON, inherit one of the glowing buttons then create a BACKDROP and TEXT childFrames and put them relative to the button.
Inside map script when you create a Frame the parent is choosen (use the button instead of BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0)):
BlzCreateFrameByType("TEXT", "name", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
 
Level 3
Joined
Dec 30, 2021
Messages
18
Ok. It's getting better and better :thumbs_up:
1660689469933.png

I think i'm gonna pass off the idea about Increased Attack Speed since it's hard to track through buffs application such as Endurance Aura/Bloodlust. My next step will be making Tooltips for the values.
I would like to use default tooltip texture as Backdrop like:
1660689662789.png

Do you guys know the full Texture path to use it as Backdrop?
In WE editor it is splited between Tooltip-Background and Tooltip-Border.

I'm also interested of moving ORIGIN_FRAME_HERO_BAR:
1660690115694.png


I'm using
call BlzFrameSetAbsPoint(BlzGetOriginFrame(ORIGIN_FRAME_HERO_BUTTON, 0), FRAMEPOINT_TOPLEFT, 0.2, 0.18)
call BlzFrameSetAbsPoint(BlzGetOriginFrame(ORIGIN_FRAME_HERO_BUTTON, 0), FRAMEPOINT_BOTTOMRIGHT, 0.5, 0.0146)

but instead of moving, it increases the size of frame.
 

Attachments

  • 1660690074410.png
    1660690074410.png
    3.1 MB · Views: 23
Last edited:
Do you guys know the full Texture path to use it as Backdrop?
In WE editor it is splited between Tooltip-Background and Tooltip-Border.
One can not set the border of a BACKDROP in map script. Sadly the default Blizzard Frame-Blueprints lack the ToolTip BACKDROP. Hence one needs to define it oneself in fdf. Could copy it from my Resource HeroScoreFrame it has the simple one. In TasButtonList i made a more complex Tooltip with an icon Title, seperator and Text.

Anyway the paths requested:
ToolTipBackground=UI/Widgets/ToolTips/Human/human-tooltip-background.blp
ToolTipBorder=UI/Widgets/ToolTips/Human/human-tooltip-border.blp

Fdf Blueprint from HeroScoreFrame
Code:
Frame "BACKDROP" "TasToolTipBox" {
    DecorateFileNames,
    BackdropTileBackground,
    BackdropBackground  "ToolTipBackground",
    BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
    BackdropCornerSize  0.01,
    BackdropBackgroundSize  0.256,
    BackdropBackgroundInsets 0.0003 0.0003 0.0003 0.0003,
    BackdropEdgeFile  "ToolTipBorder",
    BackdropBlendAll,
}


ORIGIN_FRAME_HERO_BUTTON
To move it you need either BlzHideOriginFrames(true) or BlzEnableUIAutoPosition(false)
Anchored with TopLeft
Lua:
BlzEnableUIAutoPosition(false)
local frame = BlzGetOriginFrame(ORIGIN_FRAME_HERO_BUTTON, 0)
BlzFrameSetAbsPoint(frame, FRAMEPOINT_TOPLEFT, 0.1, 0.55)
-- Move 2.Button
local frame = BlzGetOriginFrame(ORIGIN_FRAME_HERO_BUTTON, 1)
BlzFrameSetAbsPoint(frame, FRAMEPOINT_TOPLEFT, 0.3, 0.25)
Some examples to move around Default UI.
 
Level 3
Joined
Dec 30, 2021
Messages
18
After few days of studying your tutorials I'm impressed how much stuff is added to modify custom maps and I'm pretty sure the idea I want to achieve is real.
There is one question I have to ask.
If I create new frames, modify origin frames, they are modified for every Player.
How can I modify the values for specific Player? So the Player 1 wont have same label values for example as Player 2 when the function is called.
 
Level 3
Joined
Dec 30, 2021
Messages
18
With GetLocalPlayer() you can get a specific player. There are a few tutorials on hive about that.
I have studied few of them and I still need help how to implement the system to my new made frames.
I coppied your idea and getting a little confused about it.
The problem is the loop refreshing values function. How do I refresh values of frames for local player OF selected unit by that player?
Using if (GetLocalPlayer() == GetTriggerPlayer()) then when there are Players/Units in the Event section is easy but I'm confused about the loop trigger where I have 0.01 sec Event.
 
Level 3
Joined
Dec 30, 2021
Messages
18
I dont remember what I did in the map, but I guess you can loop over all the players and return the selected unit and the player and pass it to the function and set the values to show.
Could u show me some example? This sounds confusing for me since I'm JASS beginner and I'm kinda stuck on this most important and scary part which is hard to figure out since it needs another player to test.
 
Last edited:
Status
Not open for further replies.
Top