Skip to content

Constants

The globals the API defines next to its functions. They are plain Lua values: a mode may use the numbers directly, but the names read better and survive a renumbering.

0xRRGGBBAA - red, green, blue, alpha; 0xFF alpha is opaque. Any number of that shape works wherever a color is taken (SendClientMessage, CreateHudText, SetPlayerColor).

Constant Value
COLOR_SERVER 0xFFD070FF amber - the server’s own lines and the freeroam modes’
COLOR_WHITE 0xFFFFFFFF
COLOR_RED 0xFF4040FF
COLOR_GREEN 0x40FF40FF
COLOR_YELLOW 0xFFFF40FF
COLOR_GOLD 0xF6E890FF the game’s own text gold - the name plates, the HUD
COLOR_PURPLE 0xC2A2DAFF the role-play lavender - /me and /do lines, the /ame bubble

The game’s own ids for the human body, as OnPlayerDamage, OnPlayerInjury, GetPlayerInjuries and IsPlayerInjured use them; GetBodyPartName names one. 0 is “unknown” - the record could not be resolved to a part.

Constant Value
BODY_PART_HEAD 1 head
BODY_PART_TORSO 2 torso
BODY_PART_ARM_LEFT 3 arm_left
BODY_PART_ARM_RIGHT 4 arm_right
BODY_PART_LEG_LEFT 5 leg_left
BODY_PART_LEG_RIGHT 6 leg_right

The six zones the game keeps blood on, on the skin and on every piece of clothing, as GetPlayerBlood, SetPlayerBlood and GetPlayerGrime name them - in the order of the BODY_PART_* numbers, so BLOOD_ZONES[BODY_PART_TORSO] is "torso".

BLOOD_ZONES - { "head", "torso", "arm_left", "arm_right", "leg_left", "leg_right" }:

Alias Clip

Where GameText lands on the screen.

Constant Value
GAMETEXT_CENTRE 0 big, in the middle of the screen
GAMETEXT_TOP 1 under the top edge
GAMETEXT_LOWER 2 the lower third, like a subtitle

What a ShowObjectiveEvent banner announces; the game colors and sounds each its own way.

Constant Value
OBJECTIVE_NEW 0 a new objective
OBJECTIVE_DONE 1 an objective completed
OBJECTIVE_FAILED 2 an objective failed

Which of the game’s compass symbols a marker is drawn with.

Constant Value
MARKER_QUEST 0 the quest objective symbol
MARKER_POINT 1 the point-of-interest symbol

Which side of a HUD text sits at its x.

Constant Value
HUD_ALIGN_LEFT 0
HUD_ALIGN_CENTRE 1
HUD_ALIGN_RIGHT 2

The pieces of the game’s own HUD that SetPlayerHudVisible shows and hides. The values are the names of the hud component’s options (SetPlayerInterfaceOptions). Hiding one of the five that are the slots of the mode’s own toasts

  • HUD_INFO_TEXT, HUD_GAME_LOG, HUD_COMMON_EVENT, HUD_FANCY_EVENT and HUD_TUTORIAL_MESSAGE - hides what the mode shows there as well.
Constant Value
HUD_COMPASS "compass" the compass strip
HUD_STATS "stats" the health and stamina bars - one piece, they hide together
HUD_SUBTITLES "subtitles" the subtitles
HUD_HINTS "hints" the action hints
HUD_CURSOR "cursor" the crosshair dot and the item card
HUD_BUFFS "buffs" the icons of the buffs
HUD_INFO_TEXT "info_text" the info line under the compass (ShowInfoText)
HUD_GAME_LOG "game_log" the game’s log toast (ShowGameLog)
HUD_COMMON_EVENT "common_event" one of the game’s two event banners (ShowNotification, ShowObjectiveEvent)
HUD_FANCY_EVENT "fancy_event" the other event banner
HUD_TUTORIAL_MESSAGE "tutorial_message" the tutorial box (ShowTutorial), the party’s invitation and the death box
Constant Value
NO_TEAM -1 no team - what SetPlayerTeam takes to remove a player from theirs and GetPlayerTeam answers without one

How a player stands, as GetPlayerStance answers and OnPlayerStanceChange tells.

Constant Value
STANCE_STANDING 0 on their feet - standing, walking, running, swimming
STANCE_CROUCHING 1 crouching (sneaking)
STANCE_MOUNTED 2 in a horse’s saddle
STANCE_SEATED 3 seated in a cart (a cart’s seat only - a bench, a chair or a bed of the level is GetPlayerSeat)

What a world entity is: GetEntityKind answers one, GetEntities and GetNearestEntity filter by one.

Constant Value
ENTITY_PLAYER 0 a player’s body - never an entity id a mode holds; players are pids
ENTITY_HORSE 1 a horse (CreateHorse)
ENTITY_ITEM 2 a pickup lying in the world (CreatePickup, a player’s drop)
ENTITY_NPC 3 an NPC actor (CreateActor)
ENTITY_PROP 4 a static mesh (CreateProp)
ENTITY_DOG 5 a player’s dog (CreateDog)
ENTITY_CART 6 a horse-drawn cart (CreateCart, a route’s)
ENTITY_ANIMAL 7 an animal - a wolf, a boar, a deer … (CreateAnimal)
ENTITY_CARRY 8 a carry item - a sack, a basket, a bucket carried in the hands (CreateCarryItem)
ENTITY_SIEGE 9 a siege engine - a trebuchet, a cannon, a siege ladder or a pile of stones (CreateSiegeEngine)
ENTITY_INTERACTION 10 an interaction point - an invisible spot with your use prompt (CreateInteraction)
ENTITY_SURFACE 11 a web surface - a page of your web interface drawn on a board in the world (CreateWebSurface)

Which screen a vendor’s shop opens on, for SetShopScreen / GetShopScreen. A shop opened without a vendor is always on the panel.

Constant Value
SHOP_SCREEN_TRADE 0 the game’s own trade screen - the player’s side and the vendor’s, a basket, “Close deal” (the default)
SHOP_SCREEN_PANEL 1 the shop panel - a list with a Buy tab and a Sell tab, driven with the keys

The game’s own dog modes, for SetDogMode / GetDogMode (the dog’s state bag key mode holds the number). Stay, follow and free are the tested ones; the rest are passed to the game as they are.

Constant Value
DOG_STAY 0 waits where it is
DOG_FOLLOW 1 at its master’s heel (what a new dog does)
DOG_FREE 2 roams near its master
DOG_AGGRESSIVE 3 the game’s aggressive mode
DOG_SEARCH 4 the game’s search mode
DOG_HUNT 5 the game’s hunt mode
DOG_GUARD 6 the game’s guard mode
DOG_AMBUSH 7 the game’s ambush mode

Why a rider was thrown off their horse, the cause of OnPlayerThrown.

Constant Value
THROW_HEAD_HIT 1 a head hit on a low branch or a beam
THROW_HORSE 2 the horse threw them
THROW_OTHER 3 the rider’s game threw them and the server could not tell why
THROW_MODE 4 the mode’s own order (ThrowPlayerFromHorse)

A nil value vanishes from a Lua table, so a NULL parameter of a database query is written as this value: db:Execute("UPDATE players SET note = @n WHERE id = @id", { n = DB_NULL, id = 7 }).

Constant Value
DB_NULL "\0null\0" a NULL parameter value

The kinds of what a player discovered, as SetDiscoveryTracking, GetPlayerDiscovery and OnPlayerDiscoveryChange name them. They are the plain words - "places", "reading", "ui", "fog" - and a set of kinds is a list of them.

Constant Value
DISCOVERY_PLACES "places" the named places and points of interest found, per level
DISCOVERY_READING "reading" the books read, global
DISCOVERY_UI "ui" the map pin and the legend’s switched-off categories, per level
DISCOVERY_FOG "fog" the parts of the world map uncovered (the fog of war, with [ui] map_fog on), per level

ACTOR_ANIM is a table of aliases SetActorAnim accepts in place of a clip name; the value is the clip of the animation list it stands for, |once marking the ones that play once. A mode may add its own: ACTOR_ANIM.salute = "quest_stand_salute_v01|once", ACTOR_ANIM.wave_small = "greetings_wave_small_over|once".

ACTOR_ANIM - the pose aliases, alias -> clip:

Alias Clip
sit behavior_sitting_variation01_loop loops
wave greetings_wave_big_over once
bow greetings_bow once
nod greetings_head_nod_over once
pray pray_stand_long loops
chop woodchopping_loop_01 loops
sweep sweeping_floor_idle_loop loops
smith armorsmith_loop loops

In a game mode print is Log: it writes to the server log, never to a player’s screen.