1. Fill your cup and take your pick among the maps best suited for this year's Hive Cup. The 6th Melee Mapping Contest Poll is up!
    Dismiss Notice
  2. Shoot to thrill, play to kill. Sate your hunger with the 33rd Modeling Contest!
    Dismiss Notice
  3. Do you hear boss music? It's the 17th Mini Mapping Contest!
    Dismiss Notice
  4. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

UI: OriginFrames

Discussion in 'JASS/AI Scripts Tutorials' started by Tasyen, Jun 4, 2019.

  1. watterboy

    watterboy

    Joined:
    Jan 20, 2020
    Messages:
    48
    Resources:
    0
    Resources:
    0
    Is it possible to (once all of the UI is hidden) just show the unit inventory? The SimpleInfoPanel shows the inventory, but also the unit's weapon, armor ect.
     
  2. Planetary

    Planetary

    Joined:
    Feb 7, 2020
    Messages:
    271
    Resources:
    1
    Maps:
    1
    Resources:
    1
    You should be able to show each of the buttons individually with their frame name or by using the new BlzFrameGetChild() function (more here UI: OriginFrames).
    Code (Lua):
    local ib = {
        [0] = "InventoryButton_0",
        [1] = "InventoryButton_1",
        [2] = "InventoryButton_2",
        [3] = "InventoryButton_3",
        [4] = "InventoryButton_4",
        [5] = "InventoryButton_5"
    }
    for i = 0,#ib do
        BlzFrameSetVisible(BlzGetFrameByName(ib[i],0), true)
    end
     
  3. watterboy

    watterboy

    Joined:
    Jan 20, 2020
    Messages:
    48
    Resources:
    0
    Resources:
    0
    Thanks man, i'll try that out in a little bit!
     
  4. watterboy

    watterboy

    Joined:
    Jan 20, 2020
    Messages:
    48
    Resources:
    0
    Resources:
    0
    Idk I can't seem to get this to work - I barely understand jass or lua as it is; but logically, I feel like the parent of the inventory is the simpleUI and that is hidden, so I'm unable to turn on the child (the individual inventory buttons). I'm not getting errors, but I also don't exactly know what I'm doing. I tried this:
    Code (Text):
    call BlzFrameSetVisible(BlzFrameGetChild(BlzGetFrameByName("InventoryButton_0",0),0), true)
     
  5. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,611
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    In V1.31 one can show the inventory with this one liner.
    Code (vJASS):
    call BlzFrameSetParent(BlzFrameGetParent(BlzGetOriginFrame(ORIGIN_FRAME_ITEM_BUTTON, 0)), BlzGetFrameByName("ConsoleUI", 0))


    But it does not work in V1.32.8. There is something quite wierd going on with Item Buttons since the release of the Name Frame version. Technicaly it should show the inventory when one changes the parent of "SimpleInventoryBar" to "ConsoleUI" and show that Inventory Frame. But for unknown reasons (atleast to me) "SimpleInventoryBar" hides itself frequently and the cooldowns are not shown.

    The simplest (in Current Version) I can think of is to show the bottom Unit UI push it out of the screen and move the item buttons to the place you want them.
     
  6. watterboy

    watterboy

    Joined:
    Jan 20, 2020
    Messages:
    48
    Resources:
    0
    Resources:
    0
    Damn that's a pain to hear - I barely know what I'm doing with these scripts as it is. Wish they would add some GUI for these UI commands. But thank you for the reply, much appreciated.
     
  7. SebioL

    SebioL

    Joined:
    May 19, 2020
    Messages:
    168
    Resources:
    0
    Resources:
    0
    To remove the dark background, all right! But, it's possible to increase the size of the portrait on the panel, through some code? So that the model is left with more space to appear from the height of the bust with good visibility, standard the version BlizzCon.:
    [​IMG]
     
  8. watterboy

    watterboy

    Joined:
    Jan 20, 2020
    Messages:
    48
    Resources:
    0
    Resources:
    0
    I gotta figure out how to get my abilities and inventory laid out like that - everything else I want to hide. Trying to develop this RPG; I'm pretty good with GUI but can't do jack with jass, it confuses the hell out of me
     
  9. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,611
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    One can resize the Portrait Frame. But first one has to free it. That can be done with
    call BlzEnableUIAutoPosition(false)
    , hiding default UI or by setting the TOPLEFT position.
    One access it with BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT, 0). After that one can resize it with
    Code (vJASS):
    call BlzFrameSetSize(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT, 0), 0.3, 0.3)


    That looks like these 4 Lines:
    Code (vJASS):
    call BlzHideOriginFrames(true)
    call BlzFrameSetVisible(BlzGetFrameByName("ConsoleUIBackdrop",0), false)
    call BlzFrameSetVisible(BlzFrameGetParent(BlzGetFrameByName("SimpleInfoPanelUnitDetail", 0)), true)
    call BlzFrameSetAlpha(BlzGetFrameByName("SimpleInventoryCover", 0), 0)
     
     
  10. watterboy

    watterboy

    Joined:
    Jan 20, 2020
    Messages:
    48
    Resources:
    0
    Resources:
    0
    haha the video clip is what I have now - but i need to move the abilities, move the inventory, and hide the unit name, attack damage and defense somehow
     
  11. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,611
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    In Reforged one access the CommandButton Frames with
    BlzGetFrameByName("CommandButton_0", 0)
    BlzGetFrameByName("CommandButton_1", 0)
    BlzGetFrameByName("CommandButton_2", 0)
    BlzGetFrameByName("CommandButton_11", 0)

    And the Inventory Buttons with
    BlzGetFrameByName("InventoryButton_0", 0)
    BlzGetFrameByName("InventoryButton_1", 0)
    BlzGetFrameByName("InventoryButton_5", 0)

    That Frames you clear Points and move them to the wanted position. For example:
    local framehandle itemButtonFrame = BlzGetFrameByName("InventoryButton_0", 0)
    call BlzFrameClearAllPoints(itemButtonFrame)
    call BlzFrameSetAbsPoint(itemButtonFrame, FRAMEPOINT_BOTTOMLEFT, 0.45, 0.12)
    [JASS/AI] - UI: Positionate Frames

    if you want to get rid of the whole unitInfo bottom use this, works only if the unit selected is not training nor a transporter.
    call BlzFrameSetScale(BlzGetFrameByName("SimpleInfoPanelUnitDetail", 0), 0.0001)

    Edit: added the missing type in the local
     
    Last edited: Sep 15, 2020
  12. watterboy

    watterboy

    Joined:
    Jan 20, 2020
    Messages:
    48
    Resources:
    0
    Resources:
    0
    Thanks a lot for the elaborate answer, this helps a lot. I'll try this tonight and post results. Thanks!!
     
  13. watterboy

    watterboy

    Joined:
    Jan 20, 2020
    Messages:
    48
    Resources:
    0
    Resources:
    0
    Oddly, I can't seem to get past the first line - not quite sure what the syntax error is[​IMG]

    Imgur: The magic of the Internet

    Code (Text):
    //===========================================================================
    // Trigger: User Interface
    //===========================================================================
    function Trig_User_Interface_Actions takes nothing returns nothing
        local AbilityButtonFrame1 = BlzGetFrameByName("CommandButton_8", 0)
        local AbilityButtonFrame2 = BlzGetFrameByName("CommandButton_9", 0)
        local AbilityButtonFrame3 = BlzGetFrameByName("CommandButton_10", 0)
        local AbilityButtonFrame4 = BlzGetFrameByName("CommandButton_11", 0)
        local AbilityButtonFrame5 = BlzGetFrameByName("CommandButton_4", 0)
        local AbilityButtonFrame6 = BlzGetFrameByName("CommandButton_5", 0)
        local AbilityButtonFrame7 = BlzGetFrameByName("CommandButton_6", 0)
        local AbilityButtonFrame8 = BlzGetFrameByName("CommandButton_7", 0)
        call BlzHideOriginFrames(true)
        call BlzFrameSetVisible(BlzGetFrameByName("ConsoleUIBackdrop",0), false)
        call BlzFrameSetVisible(BlzFrameGetParent(BlzGetFrameByName("SimpleInfoPanelUnitDetail", 0)), true)
        call BlzFrameSetSize(BlzFrameGetParent(BlzGetFrameByName("SimpleInfoPanelUnitDetail", 0)), .3, .3)
        call BlzFrameClearAllPoints(AbilityButtonFrame1)
        call BlzFrameSetAbsPoint(AbilityButtonFrame1, FRAMEPOINT_BOTTOMLEFT, 0.03, 0.15)
        call BlzFrameClearAllPoints(AbilityButtonFrame2)
        call BlzFrameSetAbsPoint(AbilityButtonFrame2, FRAMEPOINT_BOTTOMLEFT, 0.07, 0.15)
        call BlzFrameClearAllPoints(AbilityButtonFrame3)
        call BlzFrameSetAbsPoint(AbilityButtonFrame3, FRAMEPOINT_BOTTOMLEFT, 0.11, 0.15)
        call BlzFrameClearAllPoints(AbilityButtonFrame4)
        call BlzFrameSetAbsPoint(AbilityButtonFrame4, FRAMEPOINT_BOTTOMLEFT, 0.15, 0.15)
        call BlzFrameClearAllPoints(AbilityButtonFrame5)
        call BlzFrameSetAbsPoint(AbilityButtonFrame5, FRAMEPOINT_BOTTOMLEFT, 0.19, 0.15)
        call BlzFrameClearAllPoints(AbilityButtonFrame6)
        call BlzFrameSetAbsPoint(AbilityButtonFrame6, FRAMEPOINT_BOTTOMLEFT, 0.23, 0.15)
        call BlzFrameClearAllPoints(AbilityButtonFrame7)
        call BlzFrameSetAbsPoint(AbilityButtonFrame7, FRAMEPOINT_BOTTOMLEFT, 0.27, 0.15)
        call BlzFrameClearAllPoints(AbilityButtonFrame8)
        call BlzFrameSetAbsPoint(AbilityButtonFrame8, FRAMEPOINT_BOTTOMLEFT, 0.31, 0.15)
    endfunction

    //===========================================================================
    function InitTrig_User_Interface takes nothing returns nothing
        set gg_trg_User_Interface = CreateTrigger(  )
        call TriggerAddAction( gg_trg_User_Interface, function Trig_User_Interface_Actions )
    endfunction
     
  14. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,611
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    I Forgot to tell type, one has to do that in (v)jass.
    add framehandle as type for the locals

    local framehandle AbilityButtonFrame1
     
  15. watterboy

    watterboy

    Joined:
    Jan 20, 2020
    Messages:
    48
    Resources:
    0
    Resources:
    0
    oh! gotcha - not your fault, I'm just illiterate when it comes to scripting - that worked like a charm though, thank you!
     
  16. watterboy

    watterboy

    Joined:
    Jan 20, 2020
    Messages:
    48
    Resources:
    0
    Resources:
    0
    Is it possible to keep the Status: (buffs) bar from the simpleunitinfo; or is it all or nothing?
     
  17. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,611
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    It is possible but that depends, how you got rid of the other part. If you scaled down the other you have to scale it up again.
     
  18. SebioL

    SebioL

    Joined:
    May 19, 2020
    Messages:
    168
    Resources:
    0
    Resources:
    0
    Perfect @Tasyen , thank you very much. You are a real expert! Now I just need to remove the TC frame at the bottom of the portrait units.
    Everything worked flawlessly. Staying like this:
    upload_2020-9-17_8-58-30.png
    But now the only question is that the last two numbers correspond exactly to the scale shift on the Y-axis "up" and X-axis "to the right". If possible, you could tell if there was a way to reposition the portrait from the point of origin?
    I mean moving the portrait frame completely, moving from the starting point XY, moving more to the left side (next to the minimap) or down a little bit (next to the HP / SP points):
    upload_2020-9-17_8-58-24.png
    Concomitantly, a code to completely reposition the "minimap" to launch it totally to the left of the screen... if possible, in case you can remember ...
     
    Last edited: Sep 17, 2020
  19. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,611
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    I am unsure what you mean with TC Frame.

    One would have to change the point which bounds the frame, then the size extends the frame in a different direction. Or you clear the point then you can use any point to move it.

    On default the minimap can not leave the 4:3 Screen. You have to change the parent of it, to a frame that can leave the 4:3 Screen (but no SimpleFrame). Then you can move it with -x values to the left 16:9 part or beyond that.
    UI: OriginFrames
    UI: OriginFrames

    A common tutorial about this frame position
    [JASS/AI] - UI: Positionate Frames
     
  20. SebioL

    SebioL

    Joined:
    May 19, 2020
    Messages:
    168
    Resources:
    0
    Resources:
    0
    I think when it comes to moving the portrait, the best way would be to clean all the points and have the freedom to move ORIGIN_FRAME_PORTRAIT to any side in frame 4:3.
    Maybe, it could be something like this, correct me if I'm wrong:
    local framehandle portrait = BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT, 0)
    call BlzFrameClearAllPoints(portrait)
    call BlzFrameSetPoint(portrait, FRAMEPOINT_BOTTOMLEFT, BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), FRAMEPOINT_BOTTOMLEFT, 0.0200, 0.009)

    In Minimap we can also clean up all of its points, then add frame point constants to move and maybe even increase its size.
    As used in this script:
    local framehandle frame = BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0)
    call BlzFrameClearAllPoints(frame)
    call BlzFrameSetPoint(frame, FRAMEPOINT_BOTTOMLEFT, BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), FRAMEPOINT_BOTTOMLEFT, 0.0200, 0.009)
    call BlzFrameSetSize(frame, 0.10, 0.09)

    But it is apparently not possible to drag the Minimap all the way to the left. It's not such a common frame, it can hardly be moved outside the 4: 3 frame limit. So this method of yours can work best to drag it as far as possible ... I'll try, thanks!
    TimerStart(CreateTimer(), 0, false, function()
    local parent = BlzGetFrameByName("ConsoleUIBackdrop", 0)
    local frame = BlzGetFrameByName("MiniMapFrame", 0)
    BlzFrameSetParent(frame, parent)
    BlzFrameSetAbsPoint(frame, FRAMEPOINT_BOTTOMLEFT, 0.9, 0.3)
    BlzFrameSetAbsPoint(frame, FRAMEPOINT_TOPRIGHT, 1.05, 0.45)
    end)

    PS.
    Was talking about the TC in relation to TeamColor the frame to the back of the model.
    I was referring to the polygonal frame to be removed directly within the Portrait model, with Retera ModelStudio perhaps.
    In this case, it is just a frame within the model, not exactly the UI. lol

    EDIT: Everything works very well to move only with triggers through the GUI, using vJASS script.
    But as i imagined, you can see in the photo that the 3D portrait is easily positioned to any end without needing to change its parent, but Minimap does not really exceed the limit of the 4: 3 screen, and to reach the end, will be necessary this its revolutionary Lua code itself.
    I'm stupid for JASS, for Lua codes I'm stupid squared.
    @Tasyen , you wouldn't have this LUA code in the form of JASS, I have no idea how to use Lua, neither to trigger it in the GUI without having any function to start it ??
    upload_2020-9-18_9-10-33.png
     
    Last edited: Sep 18, 2020