UI Frames : how to access inactive workers icon ?

Level 12
Joined
Jan 30, 2020
Messages
876
Hello there.

I recently introduced a non-hero worker in my map, that has a Custom UI made with the invaluable help and knowledge from @Tasyen .

As many of you working with custom UI know, you can hide the black backdrop behind the basic bottom frame, but that still leaves the zone unclickable because we cannot access the transparent frame responsible.
The common workaround is moving the bottom of the ConsoleUI off screen with a command like this :
Lua:
    BlzFrameSetAbsPoint(BlzGetFrameByName("ConsoleUI", 0), BOTTOM, 0.0, -0.24)
The reason is that the origin frame Console UI is a parent of that problematic inaccessible frame.

There are side effects with moving this ConsoleUI, including problems with the ORIGIN_FRAME_UNIT_MSG that handles all the messages displayed to players. I am currently trying to move this message frame without crashing threads with debug messages, and I hope it will en up working.


Now there is a side effect I have not encountered yet, because I did not use the feature :

Adding a non-hero worker unit to my map, I discovered as expected, that the inactive worker icon was also a child of the Console UI frame, like most frames in the game interface, so moving the bottom of Console UI off screen also hides the worker icon.


The problem is I have not found a way to access this worker icon frame to reposition it.


So my question is :
- Is it possible to move this worker icon frame back into view, or is the only way to display an icon for the inactive workers using custom frames ?
 
Level 12
Joined
Jan 30, 2020
Messages
876
UPDATE :
I usually post an update when I find a solution, but this time I am really stuck !
I seem to have overcome the issue with the wrong repositioning of the ORIGIN_FRAME_UNIT_MSG : giving this frame an even slightly wrong position can lead to game crashes.

But s for the worker icon, I have found nothing to get it to work It is definitely attached to the Console UI, but so far it seems there is no way of accessing it.
On the other hand, there also seems to be no way to remove the unclickable area of the Console UI Backdrop. You can hide the backdrop, maybe you can even edit its texture in the consoleui.fdf file :
Code:
... (non related entries)

Frame "BACKDROP" "ConsoleUIBackdrop" {
    //Width 0.8,
    Height 0.13,
    SetPoint BOTTOMLEFT, "ConsoleUI", BOTTOMLEFT, 0.0, 0.0,
    SetPoint BOTTOMRIGHT, "ConsoleUI", BOTTOMRIGHT, 0.0, 0.0,
    BackdropTileBackground,
    BackdropBackground  "Textures\Black32.blp",
}

But I don't know where to alter the unclickable area. Maybe it's a hidden texture within the 6 textures mentioned for the bottom of the console mentioned in the fdf, but i doubt it.
There is an inventory cover model, but there is no commandbuttons area model, and the unclickable zone seems to be linked to the command button area.
There is also a humanui.mdx but it only uses the 4 basic textures of the human interface so it's a no go.

I am not sure, but if anyone has found a way to display the inactive worker icon independently from the Console UI, I would be grateful to know how it has been done.
 
Level 12
Joined
Jan 30, 2020
Messages
876
Thanks for the following, unfortunately, it seems the only way out is making a custom glue button with triggers to emulate the worker button.
Or maybe just make the worker another hero and find a way to hide attributes with 0 value.

Fact is I cannot let the unclickable area, so I have to move the bottom of Console UI to get rid of it, and thus hiding the worker button on the way.
This is another important part of Custom UI that Blizzard forgot about, and this is surprising considering that most non-RPG maps that use Custom UI must be facing the exact same issue.

Let's hope GLUE buttons can do the job without too many hiccups !

EDIT :
I have decided to make a Hero out of my new worker to have it use the second hero button in replacement of the inactive worker Icon. Problem is I cannot hide the attribute icons.
I tried to alter my Lua function that manages updating the HP Bar on selected units to make it hide attribute icons if it is not the main Hero (Balls and the new worker are also heros now) :
Lua:
function UpdateHP(u, life, maxlife, on, pn, color)
    if color then
        BlzFrameSetVertexColor(Bar[pn], BlzConvertColor(255, RedB[on], GreenB[on], BlueB[on]))
    end
    BlzFrameSetValue(BlzGetFrameByName("HPBarEx",pn), life/maxlife*100)
    BlzFrameSetText(BlzGetFrameByName("HPBarExText",pn), "HP: "..life)
    local show=false
    if IsUnitType(u, HEROBUILDER) then
        show=true
    end
    if (pn==LocalPn) and IsUnitType(u, HERO) then
        BlzFrameSetVisible(BlzGetFrameByName("InfoPanelIconHeroStrengthLabel", 6), show)
        BlzFrameSetVisible(BlzGetFrameByName("InfoPanelIconHeroStrengthValue", 6), show)
        BlzFrameSetVisible(BlzGetFrameByName("InfoPanelIconHeroAgilityLabel", 6), show)
        BlzFrameSetVisible(BlzGetFrameByName("InfoPanelIconHeroAgilityValue", 6), show)
        BlzFrameSetVisible(BlzGetFrameByName("InfoPanelIconHeroIntellectLabel", 6), show)
        BlzFrameSetVisible(BlzGetFrameByName("InfoPanelIconHeroIntellectValue", 6), show)
        BlzFrameSetVisible(BlzGetFrameByName("InfoPanelIconHeroIcon", 6), show)
    end
end

But trying to hide these crashes the game straight away - not that I was expecting things to be THAT easy considering the UI API :D

NOTE : Did people know that we can change a unit into a hero in 2 simple clicks ?
 
Last edited:
Level 12
Joined
Jan 30, 2020
Messages
876
UPDATE :

Since patch 1.32.6, we can now access all of Console UI child frames, it is referenced as the 8th child (from 0 to 7 so index is 7) - thanks to @Tasyen again for figuring this ou -
Here is an example moving this icon :
Lua:
    -- Inactive Worker Icon
    local fh=BlzFrameGetChild(BlzGetFrameByName("ConsoleUI", 0), 7)
    BlzFrameClearAllPoints(fh)
    BlzFrameSetAbsPoint(fh, TOPLEFT, -0.13, 0.48)
 
Top