Skip to content

SetPlayerHudVisible

Shows or hides one of the game’s own HUD pieces - the compass, the health bars, the hints - on a player’s screen.

The game draws its own HUD - the compass, the bars, the prompts, the toasts - and a mode can take one piece of it away for a player and give it back, without touching the rest. The pieces have names, and each name is a constant:

piece what it is
HUD_COMPASS the compass strip
HUD_STATS the health and stamina bars - one piece, they hide together
HUD_SUBTITLES the subtitles
HUD_HINTS the action hints, the “press a key” prompts
HUD_CURSOR the crosshair dot and the item card
HUD_BUFFS the icons of the buffs
HUD_INFO_TEXT the info line under the compass - where ShowInfoText draws
HUD_GAME_LOG the game’s log toast - ShowGameLog
HUD_COMMON_EVENT one of the game’s two event banners - ShowNotification and ShowObjectiveEvent draw in them
HUD_FANCY_EVENT the other event banner
HUD_TUTORIAL_MESSAGE the tutorial box - ShowTutorial, the party’s invitation and the death box

Five of these are the slots of the mode’s own toasts: hiding HUD_INFO_TEXT, HUD_GAME_LOG, HUD_COMMON_EVENT, HUD_FANCY_EVENT or HUD_TUTORIAL_MESSAGE hides what the mode and the server show there as well - a hidden tutorial box takes a party invitation and the death box with it. Hide those pieces only when the mode shows nothing in them.

The name is read loosely - case, _, - and spaces do not count, so "InfoText" is HUD_INFO_TEXT - and a name that is no piece is refused with "no such piece". The setting is the hud component’s option of that name (SetPlayerInterfaceOptions sets the same thing, and SetInterfaceOptionsForAll does it for everyone); it holds until the mode changes it, the player leaves or the mode is reloaded, and a player’s game puts the piece back as it found it when the session ends - a player’s own choice in the game’s settings survives.

The answer is true when the request was handed to the player’s game, or false and the reason: "no such player" or "no such piece".

SetPlayerHudVisible(pid, piece, visible)
Parameter Type
pid number the player
piece string a piece - HUD_COMPASS, HUD_STATS … - as the constants of this page name them
visible boolean true shows the piece (the default state), false hides it

true, or false, reason - the reason as a person reads it ("no such piece", "no such player")

-- a cutscene: no compass and no bars while it plays
function startCutscene(pid)
SetPlayerHudVisible(pid, HUD_COMPASS, false)
SetPlayerHudVisible(pid, HUD_STATS, false)
end
function endCutscene(pid)
SetPlayerHudVisible(pid, HUD_COMPASS, true)
SetPlayerHudVisible(pid, HUD_STATS, true)
end

SetPlayerInterfaceOptions · SetInterfaceOptionsForAll · ShowInfoText · ShowTutorial · the GameText and HUD group of the index