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. dhguardianes

    dhguardianes

    Joined:
    Jun 19, 2011
    Messages:
    82
    Resources:
    13
    Models:
    10
    Skins:
    1
    Maps:
    2
    Resources:
    13
    Hey Tasyen, I want to move the minimap but no matter which ways i tried, i couldn't manage to do it. Can you show me how? Thanks
     
  2. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,610
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    One needs to set 2 opposite corner Points to move the minimap, a Lua example.

    Code (Lua):
    do
        local realFunc = MarkGameStarted
        function MarkGameStarted()
          realFunc()
          local frame = BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0)
          BlzFrameSetAbsPoint(frame, FRAMEPOINT_BOTTOMLEFT, 0.2, 0.2)
          BlzFrameSetAbsPoint(frame, FRAMEPOINT_TOPRIGHT, 0.4, 0.4)
        end
    end
    Edited: Replaced selfexecution with a less problematic approach
     
    Last edited: Sep 22, 2020
  3. bgcy_ro002

    bgcy_ro002

    Joined:
    Sep 6, 2013
    Messages:
    15
    Resources:
    2
    Icons:
    1
    Skins:
    1
    Resources:
    2
    Hello Tasyen,

    I want mouse click to console interface area and keep the console buttons (i just move the buttons).
    It seems that the console interface area is still hidden there.
    i tried fucntion
    Code (Text):
    BlzFrameSetAbsPoint(BlzGetFrameByName("ConsoleUI", 0), FRAMEPOINT_BOTTOM, 0.4, -0.18)
    but button position is deviated.

    Could you help me how to mouse click to console interface area and keep the console buttons?

    upload_2020-3-8_1-30-26.png
     
  4. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,610
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    Did you use that line at map init?
    Code (vJASS):
    BlzFrameSetAbsPoint(BlzGetFrameByName("ConsoleUI", 0), FRAMEPOINT_BOTTOM, 0.4, -0.18)

    After the console was moved on can move the Command Buttons at for examaple 0.0s.
     
  5. bgcy_ro002

    bgcy_ro002

    Joined:
    Sep 6, 2013
    Messages:
    15
    Resources:
    2
    Icons:
    1
    Skins:
    1
    Resources:
    2
    I have understood my problem.
    Thank you.
     
  6. watterboy

    watterboy

    Joined:
    Jan 20, 2020
    Messages:
    48
    Resources:
    0
    Resources:
    0
    So how exactly do I show the inventory of units after I've hidden origin frames and the console background?
    This doesn't seem to work:
    call BlzFrameSetVisible(BlzGetFrameByName("ORIGIN_FRAME_ITEM_BUTTON", 0), true)
     
  7. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,610
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    Hide origin Frames does not hide the item buttons itself, it hides one of their ancestors. A Frame needs all of his ancestor-Frames visible, to be visible itself.
    The item buttons are an offspring of the Parent of the bottom center Unit Info Panel, hence you will end up with both of them visible.
    If that is not a problem then this line of code would show them:
    BlzFrameSetVisible(BlzFrameGetParent(BlzGetFrameByName("SimpleInfoPanelUnitDetail", 0)), true)


    In the past I suggested to change parentship of the item buttons. But doing that stoped the item cooldown models form being shown.
     
  8. watterboy

    watterboy

    Joined:
    Jan 20, 2020
    Messages:
    48
    Resources:
    0
    Resources:
    0
    Thank you for elaborating! All these scripts befuddle me - these all seem extremely useful; I just wish Blizz built all of this stuff into the GUI; SC2 had more UI related stuff built right into its trigger editor - I was surprised to see that they didn't do the same with Reforged.
     
  9. watterboy

    watterboy

    Joined:
    Jan 20, 2020
    Messages:
    48
    Resources:
    0
    Resources:
    0
    One other thing - is it normal that when you go in and out of cinematic mode that the game messes up the UI? I've been having to re-run the hide origins scripts whenever I go out of cinematic mode, but I may be doing something wrong
     
  10. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,610
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    In reforged that happens to me as well (but not in 1.31.1). The bottom Center Unit Info Frames and the Portrait are visible again after having Entered & Left the cinimatic mode.

    Warcraft 3's GUI Triggers misses a lot of features that the game provide, even outside of this frame-UI features.
     
  11. pr114

    pr114

    Joined:
    Mar 26, 2017
    Messages:
    145
    Resources:
    0
    Resources:
    0
    Hello Tasyen.

    I cannot seem to be able to make the ORIGIN_FRAME_PORTRAIT_HP_TEXT reappear after hiding all UI;
    Code (Lua):
    BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT,0)
    Trying to set its parent causes an immediate crash;
    Code (Lua):
    BlzFrameSetParent(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT_HP_TEXT,0), BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT,0))
    Is there any way to do this?
     
  12. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,610
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    I do not know of any.
    Except for not hiding all UI.
     
  13. pr114

    pr114

    Joined:
    Mar 26, 2017
    Messages:
    145
    Resources:
    0
    Resources:
    0
    Aww that is a shame. I was almost there with my desired UI settings :(
    Indeed I will have to do it the other way around then, and see if I am able to hide all unwanted UI elements.

    Thanks for the answer.
     
  14. pr114

    pr114

    Joined:
    Mar 26, 2017
    Messages:
    145
    Resources:
    0
    Resources:
    0
    Well I have to say, hiding unwanted UI elements turned out to not be so cumbersome. I just had to hide some Origin Frames, and overwrite the racial UI textures with a blank image.

    There is just one thing I want to hide, and I cannot find it among origin frames and simple frames: the Idle Worker button.
    It does hide with BlzHideOriginFrames, so I reckon this is an Origin Frame. Do you perhaps know how to hide this?
     
  15. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,610
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    No Idea, how to access the idle worker button.
     
  16. Macadamia

    Macadamia

    Joined:
    Jan 30, 2020
    Messages:
    876
    Resources:
    0
    Resources:
    0
    Hello there !!!

    @Tasyen : sorry to bother you again, but I just found out about a terrible problem with one of the origin frames :

    If you try to move ORIGIN_FRAME_UNIT_MSG, the frame that actually displays all messages to players, it will actually move (although in a strange way),
    But it will cause random (in some cases systematical) crashes when using the Lua print command.

    This has given me nightmares for more than a week because I had no idea what caused these crashes.
    With the help of @Planetary 's advice, I disabled all my script functions and re-enabled them one by one until I found the faulty part :

    Code (Lua):

        -- Messages
        fh=BlzGetOriginFrame(ORIGIN_FRAME_UNIT_MSG, 0)
        -- BlzFrameSetVisible(fh, true)
        BlzFrameClearAllPoints(fh)
        BlzFrameSetAbsPoint(fh, FRAMEPOINT_TOPLEFT, 0.15, 0.44)
        BlzFrameSetAbsPoint(fh, FRAMEPOINT_BOTTOMRIGHT, 0.50, 0.12)
     
    This just makes the map impossible to debug because of these print or debug_msg attempts that crash the whole game.

    It would be nice to add this information to your tutorial, to save other players the same trouble that was honestly discouraging (before finding out).


    The other problem it leads to is : how can we move that frame properly after :
    BlzFrameSetAbsPoint(BlzGetFrameByName("ConsoleUI", 0), FRAMEPOINT_BOTTOM, 0.0, -0.24)
    as the UNIT_MSG Frame follows the Console and thus is shifted towards the bottom...


    I also have another simple question.

    Currently, you might have noticed my map displays text on the floor.

    I use a special model made of 81 planes with appropriate TVertices to each cover a letter on a grid of 9x9 letters in a Texture.
    I am actually currently remaking this model to have higher resolution text, a nicer font and a 10x10 grid for more characters.
    It uses 100 animations (lazy, I am using "Stand - 0" to "Stand - 99" and set the animations by ID to makes things easier.

    Anyways, the question I have is : is there any way to display a custom frame (that won't move) on the ground ? Or maybe a picture ?
    If this is the case, I wouldn't need a dedicated complex model anymore.

    Take care !!!
     
    Last edited: Apr 20, 2020
  17. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,610
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    There was some problem with moving ORIGIN_FRAME_UNIT_MSG to the original minimap coords which is this bottomright y=0.12 in your example code. If it would be a little bit higher you would not encounter crashes when I remeber right, did some time ago test together with doomsheep who was telling my about that problem.

    Sounds silly but, one could wait 1 second after having moved the ConsoleUI.
     
  18. Macadamia

    Macadamia

    Joined:
    Jan 30, 2020
    Messages:
    876
    Resources:
    0
    Resources:
    0
    Oops I was so drawn in my attempts to access the inactive worker Icon frame that I nearly miss your reply !!!

    As for the coordinates, I tried to change them :
    Code (Text):

        -- Messages
        fh=BlzGetOriginFrame(ORIGIN_FRAME_UNIT_MSG, 0)
        BlzFrameClearAllPoints(fh)
        BlzFrameSetAbsPoint(fh, TOPLEFT, 0.11, 0.42)
        BlzFrameSetAbsPoint(fh, BOTTOMRIGHT, 0.52, 0.14)
     
    But it still crashes my print() attempts. Is the 0.11 x coordinate the issue ?

    I had another important question :
    - let's say I manage to position the message frame properly, how do the coordinates like in this example :
    function DisplayMessageTimed(d)   DisplayTimedTextToPlayer(Player(LocalPn-1), 0.15, 0.42, d, Message) end

    work once the frame position is changed ? It seems like the coordinates are still absolute because my text does not seem to move as expected.

    Maybe a custom frame would do a better job, I'll have to try this alternative...

    I have to admit I had not thought of that, I'll give this a try too.

    Thank you !!!
     
  19. Kain88

    Kain88

    Joined:
    May 26, 2020
    Messages:
    5
    Resources:
    0
    Resources:
    0
    Help me=)
    How to hide this text?
     

    Attached Files:

  20. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,610
    Resources:
    21
    Tools:
    2
    Maps:
    3
    Spells:
    11
    Tutorials:
    4
    JASS:
    1
    Resources:
    21
    Can't read that but it looks like "SimpleNameValue" , "SimpleClassValue" and "InventoryText".
    InventoryText can be get rid of with Game Interface, their one can change the displayed text to a space " ". One also could do that with code requires the newest version (while the Game Interface works also in 1.31.1)
    "SimpleNameValue" and "SimpleClassValue" are probaly most easiest made invisible with a 0 size font.
    Code (Lua):
    do
      local real = MarkGameStarted
      function MarkGameStarted()
        real()
        local frame = BlzGetFrameByName("SimpleNameValue", 0)
        BlzFrameSetFont(frame, "", 0, 0)
        frame = BlzGetFrameByName("SimpleClassValue", 0)
        BlzFrameSetFont(frame, "", 0, 0)
        --below does not work in V1.31
        frame = BlzGetFrameByName("InventoryText", 0)
        BlzFrameSetText(frame, "")
      end
    end
    Edited: Replaced selfexecution with a less problematic approach
     
    Last edited: Sep 22, 2020