Hiding HUD with SetHUDVisible

edited March 2015 in Tutorials

There's a function currently missing from the API page: SetHUDVisible(int, bool) which I want to document here.

Credits to BMD for this list:

HUD Component int value
DOTA_HUD_VISIBILITY_TOP_TIMEOFDAY 0
DOTA_HUD_VISIBILITY_TOP_HEROES 1
DOTA_HUD_VISIBILITY_TOP_SCOREBOARD 2
DOTA_HUD_VISIBILITY_ACTION_PANEL 3
DOTA_HUD_VISIBILITY_ACTION_MINIMAP 4
DOTA_HUD_VISIBILITY_INVENTORY_PANEL 5
DOTA_HUD_VISIBILITY_INVENTORY_SHOP 6
DOTA_HUD_VISIBILITY_INVENTORY_ITEMS 7
DOTA_HUD_VISIBILITY_INVENTORY_QUICKBUY 8
DOTA_HUD_VISIBILITY_INVENTORY_COURIER 9
DOTA_HUD_VISIBILITY_INVENTORY_PROTECT 10
DOTA_HUD_VISIBILITY_INVENTORY_GOLD 11
DOTA_HUD_VISIBILITY_SHOP_SUGGESTEDITEMS 12

Note that changing it once doesn't let you change it back without restarting tools, so this shouldn't be used to manipulate the HUD after the game loads.

Usage

Somewhere in a game started event, I used player_connect_full

mode = GameRules:GetGameModeEntity()
mode:SetHUDVisible(hud_component_value, false)


DOTA_HUD_VISIBILITY_TOP_TIMEOFDAY

mode:SetHUDVisible(0, false)

http://puu.sh/fAOer/20a271530e.jpg


DOTA_HUD_VISIBILITY_TOP_HEROES

mode:SetHUDVisible(1, false)

http://puu.sh/fAOiv/1035acf865.jpg


DOTA_HUD_VISIBILITY_TOP_SCOREBOARD

mode:SetHUDVisible(2, false)

http://puu.sh/fAOpV/887d94d3b1.jpg


DOTA_HUD_VISIBILITY_ACTION_PANEL

mode:SetHUDVisible(3, false) 

http://puu.sh/fAOuF/dfe961a286.jpg

:bug: Hiding the action panel has this issue: http://puu.sh/fAOSh/9fc90dc654.jpg


DOTA_HUD_VISIBILITY_ACTION_MINIMAP

mode:SetHUDVisible(4, false)

http://puu.sh/fAOBz/e1018a097b.jpg


DOTA_HUD_VISIBILITY_INVENTORY_PANEL

mode:SetHUDVisible(5, false) 

http://puu.sh/fAPiT/e6b2af6fd8.jpg


DOTA_HUD_VISIBILITY_INVENTORY_SHOP

mode:SetHUDVisible(6, false) 

http://puu.sh/fAP4b/4159ddae39.jpg


DOTA_HUD_VISIBILITY_INVENTORY_ITEMS

mode:SetHUDVisible(7, false) 

http://puu.sh/g9Ywi/56095d4467.jpg


DOTA_HUD_VISIBILITY_INVENTORY_QUICKBUY

mode:SetHUDVisible(8, false) 

http://puu.sh/fAOQx/7ff8fddbc1.jpg


DOTA_HUD_VISIBILITY_INVENTORY_COURIER

:success: This one is fairly useful if your map doesn't use courier.

mode:SetHUDVisible(9, false) 

http://puu.sh/g9YoK/096d9a4a95.jpg


DOTA_HUD_VISIBILITY_INVENTORY_PROTECT

:question: Nothing changed?

mode:SetHUDVisible(10, false) 

http://puu.sh/fAPAp/5e003ec96f.jpg


DOTA_HUD_VISIBILITY_INVENTORY_GOLD

mode:SetHUDVisible(11, false) 

http://puu.sh/fAPEV/8b3e7d0808.jpg

muh shekels are gone! :biblethump:


DOTA_HUD_VISIBILITY_SHOP_SUGGESTEDITEMS

:success: This one actually disables that mostly useless window, unlike SetRecommendedItemsDisabled(bool)

mode:SetHUDVisible(12, false) 

http://puu.sh/fAPKp/6e8f843dda.jpg


For a more flexible HUD manipulation, Flash Scaleform tutorials will be coming SOON(TM)

The concept of Modding Community doesn't go well together with Competitive Business
My Project Page || My GitHub Profile ||

Comments

  • Posts: 29

    You can fix the issue with hiding the action panel by adding the following code in your addon:

    Convars:SetInt("dota_render_crop_height", 0)

    By default, Dota 2 doesn't render the bottom (and top) part of the screen which is hidden by the UI. This console command changes the bottom crop height so that it shows everything. If you want to change the top crop height, add the following as well:

    Convars:SetInt("dota_render_y_inset", 0)

  • Posts: 3

    Just wanted to say thanks, this is some really useful information I'm looking forward to updates. I'm particularly interested in adding some HUD panels of my own.

  • Posts: 1,669

    To add your own panels you'll need to use Flash and Actionscript, the basic guide is here, and there are many more complex UI examples on github after you get the hang of it.

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • Posts: 3

    Awesome, I haven't used flash since the launch of AS3 but I'm sure I can pick it up.

  • Posts: 1,669

    Deprecated. Use Panorama DotaDefaultUIElement_t instead

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||