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 colour is taken (SendClientMessage, CreateHudText, SetPlayerColour).

Constant Value
COLOUR_SERVER 0xFFD070FF amber - the server’s own lines and the freeroam modes’
COLOUR_WHITE 0xFFFFFFFF
COLOUR_RED 0xFF4040FF
COLOUR_GREEN 0x40FF40FF
COLOUR_YELLOW 0xFFFF40FF

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

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

Which side of a HUD text sits at its x.

Constant Value
HUD_ALIGN_LEFT 0
HUD_ALIGN_CENTRE 1
HUD_ALIGN_RIGHT 2
Constant Value
NO_TEAM -1 no team - what SetPlayerTeam takes to remove a player from theirs and GetPlayerTeam answers without one

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)

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

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.