• 🏆 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!

Some UI Questions

Status
Not open for further replies.
Level 9
Joined
Mar 26, 2017
Messages
376
Hello Guys,

I have been working to implement custom UI systems to my map, with alot of help from the tutorials from @Tasyen

There are a few things that I want to do, but cannot find the answer for:

1 - Is it possible at all to move the minimap? I have tried the BlzFrameSetAbsPoint(BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP,0), FRAMEPOINT_TOP, x, y), but this doesn't seem to work.

2 - I would like to show the HP and Mana of a unit when selected, but not its unit details. Is this possible to do? I don't know which input to give for the BlzFrameSetVisible command to reveal these HP and Mana numbers.

3 - Similarly, I want to reveal a unit's inventory, without showing anything other than their 6 item slots, Is this possible with the BlzFrameSetVisible command, or perhaps some other command?

Hopefully someone can help me with this.
 
1.

JavaScript:
this.frame = BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0);
BlzFrameClearAllPoints(this.frame);
BlzFrameSetPoint(this.frame, FRAMEPOINT_BOTTOMLEFT, Default.gameUI, FRAMEPOINT_BOTTOMLEFT, 0.0200, 0.009);
BlzFrameSetSize(this.frame, 0.10, 0.09);
BlzFrameSetVisible(this.frame, false);
BlzFrameSetParent(this.frame, this.frameContainer); // frameContainer can be anything (like game ui)

2. I don't think anyone has been able to isolate the hp or mp text frames. I personally hide the portrait and display my own custom hp and mp bars.

3. You can hide all of the UI then show just the inventory icon frames.

JavaScript:
static showInventory(){
    for (let i = 0; i < 10; i++) {
        let frame = BlzGetOriginFrame(ORIGIN_FRAME_ITEM_BUTTON, i);
        BlzFrameClearAllPoints(frame);
        BlzFrameSetPoint(frame, FRAMEPOINT_CENTER, Default.gameUI, FRAMEPOINT_CENTER, 0 + (i*0.07), 0);
        BlzFrameSetVisible(frame, true);
    }
}
 
Level 9
Joined
Mar 26, 2017
Messages
376
Great to hear this is possible!

Unfortunately, I cannot get them to work:

1 - Minimap
I have put the following code:


Code:
  local minimap = BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP,0)
    BlzFrameClearAllPoints(minimap)
    BlzFrameSetAbsPoint(minimap, FRAMEPOINT_BOTTOMLEFT, 0.00, 0.00)
    BlzFrameSetVisible(minimap, false)
    BlzFrameSetParent(minimap, BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0))

With this, the minimap has disappered. If I try to add the line BlzFrameSetVisible(minimap, true), the minimap does appear, but it stays in the original position. This is also true if I make changes to the coordinates put in the BlzFrameSetAbsPoint command.


3 - Inventory

Code:
TempInt1 = 0
    repeat
        frame = BlzGetOriginFrame(ORIGIN_FRAME_ITEM_BUTTON, TempInt1)
        BlzFrameClearAllPoints(frame)
        BlzFrameSetPoint(frame, FRAMEPOINT_CENTER, BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), FRAMEPOINT_CENTER, 0 + (TempInt1*0.07), 0)
        BlzFrameSetVisible(frame, true)
    TempInt1 = TempInt1 + 1
    until TempInt1 > 6

Doesn't work either.
Even just the command BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_ITEM_BUTTON, 0), true) makes no inventory button visible. I have tested while selecting an owned unit that has the inventory ability.

Might it have to do with the fact that I disabled basically all UI with BlzHideOriginFrames(true), without bringing back anything from the original UI, except for the portrait.


Hopefully you can help me out here, this would make a lot of difference for my map.
 
Last edited:
3 - Inventory
The item Buttons are hidden cause their parent's parent is hidden. I show the item Buttons by setting the parent of the inventory (parent of item_Button) to the parent of the command buttons with this line:
Lua:
BlzFrameSetParent(BlzFrameGetParent(BlzGetOriginFrame(ORIGIN_FRAME_ITEM_BUTTON, 0)), BlzFrameGetParent(BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 0)))
 
Level 9
Joined
Mar 26, 2017
Messages
376
The item Buttons are hidden cause their parent's parent is hidden. I show the item Buttons by setting the parent of the inventory (parent of item_Button) to the parent of the command buttons with this line:
Lua:
BlzFrameSetParent(BlzFrameGetParent(BlzGetOriginFrame(ORIGIN_FRAME_ITEM_BUTTON, 0)), BlzFrameGetParent(BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 0)))

It's not working :cry:

I will just put all UI command that I run:

Code:
    BlzHideOriginFrames(true)
    BlzFrameSetAllPoints(BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0))
    BlzFrameSetParent(BlzFrameGetParent(BlzGetOriginFrame(ORIGIN_FRAME_ITEM_BUTTON, 0)), BlzFrameGetParent(BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 0)))
    BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_ITEM_BUTTON,0), true)
    BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT,0), true)

Is there anything in here missing, or somehow blocking the revealing of the inventory button?
 
Level 9
Joined
Mar 26, 2017
Messages
376
Ah I see what has gone wrong, I didn't try to pick up items. I expected the 'empty bag' icon to be there, and when I didn't see it, I assumed it didn't work.

Thanks for the help, this is really great for my map :D
 
Status
Not open for further replies.
Top