Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Global objectClient APIGenerated

Hud

const Hud: object

Defined in: client/api.d.ts:1102

The game’s own HUD messages, shown to the player at this machine. Nothing here is replicated: a message everyone should see is sent to everyone, and each client shows it. Every message call returns false while there is no HUD, which is the case in the main menu and across a level load.

The screen-effect verbs – addScreenEffect and its siblings – put full-screen post effects on this player’s own picture. They are drawn by the game’s renderer rather than the HUD, so they need no HUD and hiding HUD elements leaves them alone.

addScreenEffect(effect, params?, options?): number

Puts a full-screen effect on this player’s own picture – a colour grade, a blur, ghosting or the game’s blood overlay, for intoxication, injury, poison, dreams or a place that should feel wrong – owned by the calling resource. These are the game’s own post-processing passes, driven with the parameters this build actually reads; they are not part of the HUD and showing or hiding HUD elements does not touch them.

This is presentation, not state. Nothing is replicated, nobody else sees it, and none of it makes a player drunk or hurt: whatever decides that – usually the server – keeps it, and a client script asks for the picture to match. Weather and time of day are shared world state and are not touched.

Effects from every resource combine rather than overwrite each other, on top of the game’s own grade – which already desaturates the screen as health runs low – rather than in its place: brightness, contrast and saturation multiply, the colour cast and the hue shift add, and blur, ghosting and blood each draw the strongest one asked for. The result does not depend on which resource asked first, and removing one effect leaves the game’s grade and every other effect as they were.

An effect belongs to the resource that created it: only that resource can change or remove it, and it goes when the resource stops, when the session ends or when the level changes. A cinematic that resets the game’s post-processing clears the screen until the effect next changes. Up to 64 effects are kept across every resource.

"colorGrade" | "blur" | "ghosting" | "screenBlood"

Which effect, as screenEffects names it.

Values for the effect’s own parameters, each clamped into its range. A parameter left out takes its default; one the effect does not take is an error.

number

number

number

number

number

number

number

number

number

fadeInMs brings it up from nothing; fadeOutMs is how long it takes to go, when its duration runs out or when removeScreenEffect is called without a fade of its own; durationMs ends it on its own after that long, before its fade-out – 0, the default, keeps it until it is removed. Fades are up to a minute.

number

number

number

number

A handle for updateScreenEffect, removeScreenEffect and isScreenEffectActive, or 0 when 64 effects are already on screen.

clearNotifications(): boolean

Empties the queue of notifications waiting to be shown. It is the only piece of the HUD’s own state reachable from here; everything else is one-shot.

boolean

True when the HUD took it.

hideCodexActionHint(): boolean

Takes down the codex action hint.

boolean

True when the HUD took it.

hideCurrentTutorial(): boolean

Takes down whichever tutorial is showing, whatever it is.

boolean

True when the HUD took it.

hideInfoText(): boolean

Takes the info text down before its time is up.

boolean

True when the HUD took it.

hideTutorial(name): boolean

Takes one named tutorial down.

string

The tutorial’s own name in the game’s tables.

boolean

True when the HUD took it.

isElementVisible(element): boolean

Whether multiplayer permits the element to show. True when no resource suppresses it; native gameplay rules can still hide it. This is not a pixel-visibility query.

string

The element, by the game’s own name for it, as setElementVisible takes it.

boolean

True while multiplayer allows the element to show.

isInDialogue(): boolean

Whether this player is in a conversation right now – one a server resource opened through Dialogue, or one the game started by itself. Both count, because a resource that acts during the game’s own dialogue is as wrong as one that acts during ours. The game’s half is read from its own dialogue manager, so it is true for real NPC conversations as well.

boolean

True while a conversation owns the screen.

isMonologueEnabled(): boolean

Whether the game voices and subtitles the local character’s monologue.

boolean

False while multiplayer suppresses it, which is the default.

isScreenEffectActive(handle): boolean

Whether an effect is still on screen, fading out included.

number

What addScreenEffect returned.

boolean

False once it has been removed and faded, has run its duration out, or was dropped by its resource stopping, the session ending or the level changing.

removeAllScreenEffects(): number

Takes every effect the calling resource owns off the screen at once. Other resources’ effects stay.

number

How many were removed.

removeScreenEffect(handle, options?): boolean

Takes an effect off the screen. An effect already fading out carries on from where it is.

number

What addScreenEffect returned.

How long it takes to fade out. Left out, it fades over the fadeOutMs it was created with; 0 takes it off at once.

number

boolean

False when the handle is gone or belongs to another resource.

screenEffects(): ScreenEffect[]

Every effect addScreenEffect accepts, with each parameter’s range, default and neutral value.

ScreenEffect[]

The effects, in a fixed order.

setElementVisible(element, visible): boolean

Retains a visibility request for one HUD element, including before the HUD is ready. Hidden clips are suppressed before each HUD render, across movie and level reloads. Turning an element on releases multiplayer suppression; the current native HUD rules still apply. Suppression is released when its owning resource stops or the session ends. No console variables are changed.

string

The element, by the game’s own name for it: Stats is the health, stamina and nourishment bars along the bottom. One of Compass, Stats, QAMWeapon, QAMFood, Subtitles, InfoText, GameLog, Hints, DialogLeft, DialogRight, Cursor, Crime, Wanted, PopUpBackground, TutorialMessage, FancyEvent, SkillCheck, ItemTransfer, Buffs, CommonEvent, DiceCursor, Trespassing, RatioStrips, ShootingContest, Bubbles, TutorialInDialog, DiceContainer, Vignette, compared exactly.

boolean

False hides the element, true lets the game show it again.

boolean

True when the request is retained; application waits for the native HUD when it is not ready yet.

setMonologueEnabled(enabled): void

The local character’s own monologue – photo-mode comments, the sharpening remark – is spoken in Henry’s voice and captioned with his name whoever is playing, so multiplayer suppresses it and raises each line as monologueSuppressed. Releasing it lasts until the session ends.

boolean

True lets the game voice and subtitle it again; false suppresses it.

void

showComboLearned(iconName, name): boolean

Shows the combo-learned toast.

string

Icon from the game’s own atlas, by name.

string

Line beside the icon, as written.

boolean

True when the HUD took it.

showInfoText(message, durationMs?, priority?): boolean

Shows the single line of info text above the HUD.

string

Text to show, as written.

number

How long to hold it, in real milliseconds; defaults to 3000.

number

What an already-showing message does to this one; defaults to 0.

boolean

True when the HUD took it.

showNotification(message): boolean

Shows the plain notification: one line, no icon, no payload.

string

Text to show, as written.

boolean

True when the HUD took it.

showPerkGained(iconName, name): boolean

Shows the perk-gained toast, which is the one the game plays when a perk is earned.

string

Icon from the game’s own atlas, by name.

string

Line beside the icon, as written.

boolean

True when the HUD took it.

showPerkUsed(iconName, name): boolean

Shows the perk-used toast: an icon and a line.

string

Icon from the game’s own atlas, by name – perk_alchemist, say. It is not text and is not translated.

string

Line beside the icon, as written.

boolean

True when the HUD took it.

showRandomEventResult(type, result, name): boolean

Shows the random-event result panel.

number

Which result the HUD draws it as.

string

Result line, as written.

string

Name of what it was, as written.

boolean

True when the HUD took it.

showReputationChanged(eventId, message): boolean

Shows the reputation-change message.

number

Which reputation event the HUD draws it as.

string

Line to show, as written.

boolean

True when the HUD took it.

showTutorial(name): boolean

Shows one of the game’s tutorials. This drives the HUD slot directly, which is past whatever the mod suppresses at the source.

string

The tutorial’s own name in the game’s tables, such as OB_O20_Inventory. Not text.

boolean

True when the HUD took it.

showXpGain(stat, statName, type?): boolean

Shows the experience-gain toast.

string

The stat’s own unique name – str, say. It is an identifier, not text, and is not translated.

string

What to call it on screen, as written.

number

Which XP bar the HUD draws it against; defaults to 0.

boolean

True when the HUD took it.

updateScreenEffect(handle, params, options?): boolean

Changes an effect while it is on screen – a drunkenness that deepens with every drink, a wound that worsens.

number

What addScreenEffect returned.

New values for some of the effect’s parameters. The others keep theirs.

number

number

number

number

number

number

number

number

number

fadeMs moves the parameters to their new values over that long, from wherever they are now; 0, the default, moves them at once.

number

boolean

False when the handle is gone or belongs to another resource.

worldToScreen(point): ScreenPoint | null

Projects a world point through the camera this frame is drawn with, so a resource can pin its own overlay to the world.

Vector3

World position to project.

ScreenPoint | null

Its screen position, or null when the point is behind the camera or there is no view to place it in.