1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  4. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  5. The results are out! Check them out.
    Dismiss Notice
  6. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  7. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    Dismiss Notice
  8. 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. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,298
    Resources:
    16
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    4
    JASS:
    1
    Resources:
    16
    Originframetypes are built in frames managing the default game ui. ORIGIN_FRAME_GAME_UI is our key to generate new container frames. In other tutorials and in many examples, ORIGIN_FRAME_GAME_UI is used as parent for custom created frames. That is done because every frame needs a parent.

    One can get a framehandle out of such an originframetype with that native. We need framehandles to use it inside the framehandle natives.
    Code (vJASS):
    native BlzGetOriginFrame takes originframetype frameType, integer index returns framehandle


    For the first argument pick one of the constants, for the second one choose in most cases 0. If the origin frame has more than 1 entity, you can get other ones of that originframetype by using a higher number.

    Example Frame-GameUI:
    BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0)

    OriginframeType InfoTable


    Constant Indexes info2 img
    ORIGIN_FRAME_GAME_UI without it nothing will be displayed.
    ORIGIN_FRAME_WORLD_FRAME the visible playground, units, items, effects, fog... every object participating in the game is displayed on it. World.jpg
    ORIGIN_FRAME_HERO_BAR parent of all HERO_BUTTONS, HeroButtons share the same visibility. HeroBar.jpg
    ORIGIN_FRAME_HERO_BUTTON 0 to 6 the clickable buttons of own/allied heroes on the left of the screen HeroButtons.jpg
    ORIGIN_FRAME_HERO_HP_BAR 0 to 6 connected to HeroButtons Hero_HP&Mana_Bar.jpg
    ORIGIN_FRAME_HERO_MANA_BAR 0 to 6 connected to HeroButtons
    ORIGIN_FRAME_HERO_BUTTON_INDICATOR 0 to 6 The glowing when a hero has skillpoints; connected to HeroButtons. They reappear when a hero gains a new skillpoint even when all originframes are hidden. Hero_Button_Indicator.jpg
    ORIGIN_FRAME_ITEM_BUTTON 0 to 5 Items in the inventory. Reappear/updates every selection, When its parent is visible. ItemButtons.jpg
    ORIGIN_FRAME_COMMAND_BUTTON 0 to 11 the buttons to order units around, like ITEM_BUTTON, Reappear/update every selection. COMMAND_BUTTON.jpg
    ORIGIN_FRAME_SYSTEM_BUTTON 0 to 3 Menu, allies, Log/chat, Quest System Buttons.jpg
    ORIGIN_FRAME_PORTRAIT Face of the main selected Unit PORTRAIT.jpg
    ORIGIN_FRAME_MINIMAP
    ORIGIN_FRAME_MINIMAP_BUTTON 0 to 4 0 is the Button at top to 4 Button at the bottom MiniMap Buttons.jpg
    ORIGIN_FRAME_TOOLTIP
    ORIGIN_FRAME_UBERTOOLTIP Handles the Tooltip window
    ORIGIN_FRAME_CHAT_MSG
    ORIGIN_FRAME_UNIT_MSG print frame for game display message / DisplayTextToPlayer Unit_Msg.jpg
    ORIGIN_FRAME_TOP_MSG Frame: UpKeep Change Warning Message, below the dayTime Clock Top Msg.jpg


    Hiding default UI


    There exists a native to hide all of them.
    call BlzHideOriginFrames(true)
    , After one used it the screen will look like that. The ability buttons will appear as soon the player selected a unit after hide was used.
    HideOriginFrames.jpg

    After one has hidden the default ui, it would be great to use the now gained space with the playable game. The next jass line extents the world to fullscreen. The World_FRAME will copy all points of Game_UI.
    Code (vJASS):
    call BlzFrameSetAllPoints(BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0))

    World Fullscreen.jpg
     

    Attached Files:

    Last edited by a moderator: Jul 4, 2019
  2. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,095
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    I still wonder if it's possible to hide some, and for a specific player.
     
  3. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,298
    Resources:
    16
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    4
    JASS:
    1
    Resources:
    16
    I think that should be doable, afterall frames values/state/pos are local only, handleId and events are synced.
     
  4. Wareditor

    Wareditor

    Joined:
    Jan 16, 2009
    Messages:
    681
    Resources:
    3
    Maps:
    3
    Resources:
    3
    One interesting note is that the portrait is not on the 4:3 screen but on the whole screen.
    (0,0) would place it at the the bottom left corner of your screen and (0.8,0.6) at the top right corner.
    This makes it quite hard (but possible with some math) to place the portrait in relation with other elements that are on the 4:3 screen.
     
  5. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,611
    Resources:
    18
    Maps:
    1
    Spells:
    11
    Tutorials:
    6
    Resources:
    18
    So this shows how to "get" a frame, how to set/hide a specific frame then?
     
  6. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,298
    Resources:
    16
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    4
    JASS:
    1
    Resources:
    16
    One uses
    BlzFrameSetVisible takes framehandle frame, boolean visible returns nothing
    on the frame. This is not recommended for SimpleFrame childs of type String or Texture.

    That line would show the Hero_Bar. One should use it, if one wants the hero Icons back after one used
    BlzHideOriginFrames

    Code (vJASS):

    call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_HERO_BAR,0), true)
     
     
  7. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,095
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    But if one wants to show/hide for one player, then we have to do it by local player, right? It's the only option?
     
  8. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,298
    Resources:
    16
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    4
    JASS:
    1
    Resources:
    16
    I think so, yes. One has to do use GetLocalPlayer for that. In that context some people on hive discord said that using BlzGetOriginFrame inside a local block can disconnect. They recommended to use BlzGetOriginFrame synced and do only the action (show, hide, enable, repos ...) inside the GetLocalPlayer block.

    Edit: BlzGetOriginFrame and/or BlzGetFrameByName will dc the game, if used localy only.

    Edit Edit Added 16 July 2019 : This is only partly correct. BlzGetFrameByName/BlzGetOriginFrames can be used in GetLocalPlayer blocks without desync when the function using the same arguments was called at an earlier time for all players. My explanition for that is, this functions are creating a new handle when that frame did not have a handle yet. I was wondering before why the handleIds of basic frames where so instable different in my tests. When the first call is in a GetLocalPlayer block the handle stack gets desync and the game breaks. Custom Created Frames get handles at creation and won't desync, when they were created for all players.
     
    Last edited: Jul 16, 2019
  9. burner89

    burner89

    Joined:
    Mar 11, 2019
    Messages:
    27
    Resources:
    0
    Resources:
    0
    How do I show a units HP/mana numbers and the inventory/minimap after hiding the UI? And I can't seem to make the unit's 3d portrait hidden either.
     
    Last edited: Jun 17, 2019
  10. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,298
    Resources:
    16
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    4
    JASS:
    1
    Resources:
    16
    I do not know how to access that frame. Its one of the 5 (buffs, time clock texture, hp/Mp, Idle wroker and targeting error/help message)

    Some examples to make frames visible again.
    Code (vJASS):

    call BlzFrameSetVisible(BlzGetFrameByName("UpperButtonBarFrame",0),true) //Show Quests, Menu, Allies, Log
    call BlzFrameSetVisible(BlzGetFrameByName("ResourceBarFrame",0),true) //Show Gold, Lumber, food and Upkeep; also enables /fps /ping /apm
    call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT,0), true) //show the 3D Face
    call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_HERO_BAR,0), true) //Show the Hero Icons at left top of the screen
    call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP,0), true) //Show MiniMap
    call BlzFrameSetVisible(BlzFrameGetParent(BlzGetFrameByName("SimpleInfoPanelUnitDetail",0)),true)//Show the parent of the SimpleInfoPanelUnitDetail will show unit stats and inventory
    call BlzFrameSetParent(BlzFrameGetParent(BlzGetOriginFrame(ORIGIN_FRAME_ITEM_BUTTON, 0)), BlzFrameGetParent(BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 0)))//Change parentShip of the Inventory to the command_Buttons Parent. Normaly the Inventory belongs to the SimpleInfoPanelUnitDetail parent, which could be still hidden.
     
     
    Last edited: Jun 25, 2019
  11. burner89

    burner89

    Joined:
    Mar 11, 2019
    Messages:
    27
    Resources:
    0
    Resources:
    0
    Cool thanks for your help. Sorry I'm a big noob when it comes to this so I have a dumb question, if I change "true" to "false" would it remove them instead?
     
  12. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,298
    Resources:
    16
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    4
    JASS:
    1
    Resources:
    16
    Yes, false would hide them instead.
     
  13. burner89

    burner89

    Joined:
    Mar 11, 2019
    Messages:
    27
    Resources:
    0
    Resources:
    0
    Hmmm for some reason this code


    Code (Text):
    function InitUI takes nothing returns nothing
     
     
        call BlzHideOriginFrames(true)
        call BlzFrameSetAllPoints(BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0))
        call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT,0), false)

    endfunction
    looks like this
    hmmmmm.png
    Am I doing something wrong?
     
    Last edited: Jun 17, 2019
  14. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,095
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    And what are you trying to achieve exactly?
     
  15. burner89

    burner89

    Joined:
    Mar 11, 2019
    Messages:
    27
    Resources:
    0
    Resources:
    0
    To get rid of the 3d unit portrait
     
  16. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,298
    Resources:
    16
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    4
    JASS:
    1
    Resources:
    16
    the 3d-face should be hidden after using call BlzHideOriginFrames(true), atleast that happens for me.
     
  17. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,095
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Yes, calling BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT,0), false) makes no sense if you're already hiding everything...
     
  18. burner89

    burner89

    Joined:
    Mar 11, 2019
    Messages:
    27
    Resources:
    0
    Resources:
    0
    wtf12312333.png well, it looks like this with just that...wtf???
     
  19. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,095
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Probably because you deleted
    Code (vJASS):
    call BlzFrameSetAllPoints(BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0))
    too?
    For future reference use jass tags instead of code ones when showing code.
     
  20. burner89

    burner89

    Joined:
    Mar 11, 2019
    Messages:
    27
    Resources:
    0
    Resources:
    0
    Nope, I put it back in and it just removes the black bar. Of course the unit portrait/buttons disappear when a unit isn't selected, but when I select the villager it comes back.
    222f2f2ff.png
     
    Last edited: Jun 17, 2019