Wax

game

The game tree: game, game.Players and the Instances they give you.

game

The root every mod starts from. It is read-only, and reading a member it does not have raises an error.

Type name: WaxGame.

MemberTypeDescription
WorldWaxInstanceThe current world. Its children are the actors in it.
GameInstanceWaxInstanceAn engine object. Any member not listed here is one of the object's own reflected properties or functions.
GameStateWaxInstanceAn engine object. Any member not listed here is one of the object's own reflected properties or functions.
GameModeWaxInstance?Nil when you are a client in someone else's game.
LocalPlayerWaxInstanceThe local player's controller.
CharacterWaxInstance?The pawn the local player controls. nil at the main menu.
EngineWaxInstanceAn engine object. Any member not listed here is one of the object's own reflected properties or functions.
ViewportWaxInstanceThe game viewport.
MapNamestring?The name of the current world.
InProspectbooleanTrue while you are in a prospect.
PlayersWaxPlayers
CreaturesWaxCreaturesThe animals and enemies in the world, kept as a live list. A kind is named the way the game names it: "Wolf", "Conifer_Wolf", "Cave Worm". Letter case, spaces and underscores do not matter. A wrong name raises an error that suggests the right one.
HighlightWaxHighlightOutlines actors so they show through walls, using the outline the game itself draws. The game has room for four filled colours and three outline-only colours at a time. A colour counts once, however many actors use it.
SignalHandler receivesDescription
MapChangedname: stringFires with the new map's name when the world changes.

game.wrap(object)

The Instance for a UE4SS object, or nil for a null or invalid one. The same object always gives the same Instance.

game.wrap(object: any): WaxInstance?
ParameterType
objectany

Returns WaxInstance?

game:Find(class_name)

The first live object of a class ("PlayerController", "BP_IcarusPlayerCharacterSurvival_C"), or nil.

game:Find(class_name: string): WaxInstance?
ParameterType
class_namestring

Returns WaxInstance?

game:FindAll(class_name)

Every live object of a class. It searches all objects, so never call it per frame.

game:FindAll(class_name: string): WaxInstance[]
ParameterType
class_namestring

Returns WaxInstance[]

game:GetTagged(tag)

Every live Instance carrying the tag.

game:GetTagged(tag: string): WaxInstance[]
ParameterType
tagstring

Returns WaxInstance[]

game:GetChildren()

The top of the tree: World, GameInstance, GameState, GameMode, LocalPlayer, Engine and Viewport, where they exist.

game:GetChildren(): WaxInstance[]

Returns WaxInstance[]

game:GetService(name)

The member of game with this name, the same as game[name].

game:GetService(name: WaxGameMember): any
ParameterType
nameWaxGameMember

Returns any

game.Players

Type name: WaxPlayers.

MemberTypeDescription
LocalPlayerWaxInstanceThe local player's controller, the same as game.LocalPlayer.
SignalHandler receivesDescription
CharacterAddedcharacter: WaxInstanceFires when a player's character appears.
CharacterRemovedcharacter: WaxInstanceFires when a player's character leaves the world.

game.Players:GetPlayers()

One Instance per player in the session (their player state). Works for the host and for clients.

game.Players:GetPlayers(): WaxInstance[]

Returns WaxInstance[]

game.Players:GetCharacters()

The characters those players are controlling right now.

game.Players:GetCharacters(): WaxInstance[]

Returns WaxInstance[]

game.Players:ObserveCharacters(fn)

Calls fn(character) for each player's character that is here now and each that appears later (a join, a respawn). If fn returns a function, that runs when the character is gone or the watch is stopped.

game.Players:ObserveCharacters(fn: fun(character: WaxInstance): (fun()?)): WaxConnection
ParameterType
fnfun(character: WaxInstance): (fun()?)

Returns WaxConnection

game.Players:GetName(character)

The name of the player who controls a character, or nil while the game has not said yet.

game.Players:GetName(character: WaxInstance): string?
ParameterType
characterWaxInstance

Returns string?

game.Players:IsLocal(character)

True for the character this player controls.

game.Players:IsLocal(character: WaxInstance): boolean
ParameterType
characterWaxInstance

Returns boolean

game.Creatures

The animals and enemies in the world, kept as a live list. A kind is named the way the game names it: "Wolf", "Conifer_Wolf", "Cave Worm". Letter case, spaces and underscores do not matter. A wrong name raises an error that suggests the right one.

Type name: WaxCreatures.

SignalHandler receivesDescription
Addedcreature: WaxInstanceFires for each creature that appears from now on.
Removedcreature: WaxInstance, info: WaxCreatureEndFires when a creature leaves the world. The Instance can no longer be used, only compared.
Diedcreature: WaxInstance, info: WaxCreatureEndFires when a creature is killed, a few seconds before it is removed.
ClearednothingFires once when the map changes, in place of one Removed per creature.

game.Creatures:GetAll(kind?, options?)

Every creature, or those of one kind. Dead ones are left out unless asked for.

game.Creatures:GetAll(kind?: string, options?: WaxCreatureQuery): WaxInstance[]
game.Creatures:GetAll(options: WaxCreatureQuery): WaxInstance[]
ParameterType
kind (optional)string
options (optional)WaxCreatureQuery

Returns WaxInstance[]

game.Creatures:GetNearest(kind?, options?)

The closest matching creature and its distance in metres, or nil.

game.Creatures:GetNearest(kind?: string, options?: WaxCreatureQuery): WaxInstance?
game.Creatures:GetNearest(options: WaxCreatureQuery): WaxInstance?, number?
ParameterType
kind (optional)string
options (optional)WaxCreatureQuery

Returns WaxInstance? , number?

game.Creatures:Count(kind?)

How many creatures of a kind are in the world now.

game.Creatures:Count(kind?: string): integer
ParameterType
kind (optional)string

Returns integer

game.Creatures:GetKinds()

Every kind this version of the game has, with how many of each are here now.

game.Creatures:GetKinds(): WaxCreatureKind[]

Returns WaxCreatureKind[]

game.Creatures:GetLiveKinds()

The names of the kinds that are in the world now.

game.Creatures:GetLiveKinds(): string[]

Returns string[]

game.Creatures:GetKind(creature)

The kind and variant of a creature, or nil when it is not a creature in the world.

game.Creatures:GetKind(creature: WaxInstance): string?
ParameterType
creatureWaxInstance

Returns string? , string?

game.Creatures:Describe(creature)

The common facts about one creature as plain values.

game.Creatures:Describe(creature: WaxInstance): WaxCreatureFacts
ParameterType
creatureWaxInstance

Returns WaxCreatureFacts

game.Creatures:Observe(kind?, fn)

Calls fn(creature) for each matching creature that is here now and each that appears later. If fn returns a function, that runs when the creature is gone or the watch is stopped.

game.Creatures:Observe(kind?: string, fn: fun(creature: WaxInstance): (fun()?)): WaxConnection
game.Creatures:Observe(fn: fun(creature: WaxInstance): (fun()?)): WaxConnection
ParameterType
kind (optional)string
fnfun(creature: WaxInstance): (fun()?)

Returns WaxConnection

game.Creatures:Highlight(kind?, options?)

Outlines every creature of a kind, now and as more appear. Disconnect the result to stop.

game.Creatures:Highlight(kind?: string, options?: WaxHighlightOptions|WaxHighlightLook): WaxConnection
ParameterType
kind (optional)string
options (optional)WaxHighlightOptions | WaxHighlightLook

Returns WaxConnection

game.Highlight

Outlines actors so they show through walls, using the outline the game itself draws. The game has room for four filled colours and three outline-only colours at a time. A colour counts once, however many actors use it.

Type name: WaxHighlight.

MemberTypeDescription
Colorsstring[]The colour names that can be used.

game.Highlight:Add(target, options?)

Outlines anything with a shape: an actor (a creature, a player's character, an item, something built) or one mesh part of an actor.

game.Highlight:Add(target: WaxInstance, options?: WaxHighlightOptions|WaxHighlightLook): WaxHighlightMark
ParameterType
targetWaxInstance
options (optional)WaxHighlightOptions | WaxHighlightLook

Returns WaxHighlightMark

game.Highlight:Remove(target)

game.Highlight:Remove(target: WaxInstance)
ParameterType
targetWaxInstance

Returns nothing.

game.Highlight:Clear()

Takes every outline off.

game.Highlight:Clear()

Returns nothing.

game.Highlight:GetAll()

The actors that are outlined now.

game.Highlight:GetAll(): WaxInstance[]

Returns WaxInstance[]

game.Highlight:Look(options?)

A look to give to many outlines, so one call changes them all.

game.Highlight:Look(options?: WaxHighlightOptions): WaxHighlightLook
ParameterType
options (optional)WaxHighlightOptions

Returns WaxHighlightLook

game.Highlight:Configure(options)

Settings every outline shares: Fill is how strongly a filled model is tinted (0 to 1), Width the line width (1 to 4).

game.Highlight:Configure(options: { Fill?: number, Width?: number }): { Fill: number, Width: number }
ParameterType
options{ Fill?: number, Width?: number }

Returns { Fill: number, Width: number }

WaxInstance

An engine object. Any member not listed here is one of the object's own reflected properties or functions.

You get one from game.Players:GetPlayers, game.Players:GetCharacters, game.Creatures:GetAll, game.Creatures:GetNearest, game.Highlight:GetAll, game.wrap, game:Find, game:FindAll and others. Below, instance stands for one of these.

PropertyTypeDescription
NamestringThe object's name.
ClassNamestringThe name of the object's class.
FullNamestringThe engine's full name for the object: its class, then its path.
ParentWaxInstance?What GetParent() returns.
RawanyThe UE4SS object itself, for unchecked access.
any other key ([string])any

instance:Get(name)

Reads a reflected property by name, including one whose name Wax also uses (Name, Parent ...).

instance:Get(name: string): any
ParameterType
namestring

Returns any

instance:Set(name, value)

Writes a reflected property by name, converting and checking the value first.

instance:Set(name: string, value: any)
ParameterType
namestring
valueany

Returns nothing.

instance:Call(name, ...)

Calls a reflected function by name, converting and checking the arguments first.

instance:Call(name: string, ...: any): any
ParameterType
namestring
...any

Returns any

instance:IsValid()

False once the object has been destroyed or the map has changed.

instance:IsValid(): boolean

Returns boolean

instance:IsA(class_name)

True when the object's class is, or inherits from, the named class ("Actor", "BP_IcarusPlayerCharacterSurvival_C").

instance:IsA(class_name: string): boolean
ParameterType
class_namestring

Returns boolean

instance:GetClassChain()

The class names from this object's own class up to Object.

instance:GetClassChain(): string[]

Returns string[]

instance:GetMembers()

Every property and function name this object has, sorted.

instance:GetMembers(): string[]

Returns string[]

instance:GetParent()

The actor or component this one is attached to. For an actor attached to nothing it is the world, and for anything else the object's outer.

instance:GetParent(): WaxInstance?

Returns WaxInstance?

instance:GetChildren()

The children: actors for the world, components and attached actors for an actor, attached components for a component.

instance:GetChildren(): WaxInstance[]

Returns WaxInstance[]

instance:FindFirstChild(name, recursive?)

The first child with this Name, or nil. recursive searches every descendant.

instance:FindFirstChild(name: string, recursive?: boolean): WaxInstance?
ParameterType
namestring
recursive (optional)boolean

Returns WaxInstance?

instance:FindFirstChildOfClass(class_name)

The first child of exactly this class, or nil.

instance:FindFirstChildOfClass(class_name: string): WaxInstance?
ParameterType
class_namestring

Returns WaxInstance?

instance:FindFirstChildWhichIsA(class_name)

The first child of this class or a class derived from it, or nil.

instance:FindFirstChildWhichIsA(class_name: string): WaxInstance?
ParameterType
class_namestring

Returns WaxInstance?

instance:GetDescendants(limit?)

Every Instance below this one, nearest first, stopping at limit (default 5000).

instance:GetDescendants(limit?: integer): WaxInstance[]
ParameterType
limit (optional)integer

Returns WaxInstance[]

instance:GetAttribute(name)

The value SetAttribute stored on the Instance under name, or nil.

instance:GetAttribute(name: string): any
ParameterType
namestring

Returns any

instance:GetAttributes()

A copy of every attribute, as name -> value.

instance:GetAttributes(): table<string, any>

Returns table<string, any>

instance:SetAttribute(name, value)

Stores a value on the Instance under name. nil removes it.

instance:SetAttribute(name: string, value: any)
ParameterType
namestring
valueany

Returns nothing.

instance:GetAttributeChangedSignal(name)

A signal for one attribute, fired with (value, previous). Without a name it covers every attribute and fires with (name, value, previous).

instance:GetAttributeChangedSignal(name: string): WaxSignal<fun(value: any, previous: any)>
instance:GetAttributeChangedSignal(): WaxSignal<fun(name: string, value: any, previous: any)>
ParameterType
namestring

Returns WaxSignal<fun(value: any, previous: any)>

instance:AddTag(tag)

Marks the Instance with a tag. game:GetTagged(tag) finds it again.

instance:AddTag(tag: string)
ParameterType
tagstring

Returns nothing.

instance:RemoveTag(tag)

Takes a tag off the Instance.

instance:RemoveTag(tag: string)
ParameterType
tagstring

Returns nothing.

instance:HasTag(tag)

True when the Instance carries the tag.

instance:HasTag(tag: string): boolean
ParameterType
tagstring

Returns boolean

instance:GetTags()

The Instance's tags, sorted.

instance:GetTags(): string[]

Returns string[]

WaxHighlightLook

A colour and fill that many outlines share. Changing it changes all of them at once.

You get one from game.Highlight:Look. Below, look stands for one of these.

look:Set(options)

look:Set(options: WaxHighlightOptions)
ParameterType
optionsWaxHighlightOptions

Returns nothing.

WaxHighlightMark

One outlined actor.

You get one from game.Highlight:Add. Below, mark stands for one of these.

PropertyTypeDescription
InstanceWaxInstanceAn engine object. Any member not listed here is one of the object's own reflected properties or functions.
ActivebooleanFalse once it was removed or its actor is gone.

mark:Remove()

Takes the outline off. Safe to call twice, and after the actor is gone.

mark:Remove()

Returns nothing.

mark:Set(options)

mark:Set(options: WaxHighlightOptions)
ParameterType
optionsWaxHighlightOptions

Returns nothing.

mark:SetColor(color)

mark:SetColor(color: string|{ R: number, G: number, B: number })
ParameterType
colorstring | { R: number, G: number, B: number }

Returns nothing.

WaxCreatureQuery

Used by game.Creatures:GetAll, game.Creatures:GetNearest.

FieldTypeDescription
within (optional)numberOnly creatures this many metres away or nearer. The result is then sorted nearest first.
from (optional)WaxInstance | { X: number, Y: number, Z: number }Where to measure from. Your character when omitted.
dead (optional)booleanTrue also returns bodies that have not been cleared away yet.
sort (optional)"nearest"Sorts nearest first without a distance limit.

WaxCreatureKind

Returned by game.Creatures:GetKinds.

FieldTypeDescription
NamestringThe kind's name in the game's data, such as "Wolf".
DisplayNamestringThe name the game shows players.
TagstringThe game's own tag for the kind, such as "NPC.Wolf".
Variantsstring[]The versions of the kind, such as "Conifer_Wolf" and "Snow_Wolf".
CountintegerHow many are in the world now.

WaxCreatureFacts

Returned by game.Creatures:Describe.

FieldTypeDescription
Kindstring
Variantstring
DisplayNamestring
ClassNamestring
Namestring
IsAliveboolean
Healthinteger?
MaxHealthinteger?
Levelinteger?
Position{ X: number, Y: number, Z: number }In the engine's units: 100 is one metre.

WaxCreatureEnd

FieldType
Kindstring
Variantstring
ClassNamestring
Namestring
Reason"Destroyed" | "Unloaded"
Position (optional){ X: number, Y: number, Z: number }

WaxHighlightOptions

Used by game.Creatures:Highlight, look:Set, mark:Set, game.Highlight:Add, game.Highlight:Look.

OptionTypeDescription
Colorstring | { R: number, G: number, B: number }A name from game.Highlight.Colors, "#rrggbb", or values from 0 to 1. "Red" when omitted.
FillbooleanAlso tints the whole model. True when omitted.
FillColorstring | { R: number, G: number, B: number } | falseThe tint's colour when it is not the outline's. false goes back to the outline's colour.

Named values

Short names for a fixed set of values. Where a function asks for one of these, pass one of the values listed.

WaxGameMember

One of "World", "GameInstance", "GameState", "GameMode", "LocalPlayer", "Character", "Engine", "Viewport", "MapName", "InProspect", "Players", "Creatures", "Highlight", "MapChanged".

On this page

gamegame.wrap(object)game:Find(class_name)game:FindAll(class_name)game:GetTagged(tag)game:GetChildren()game:GetService(name)game.Playersgame.Players:GetPlayers()game.Players:GetCharacters()game.Players:ObserveCharacters(fn)game.Players:GetName(character)game.Players:IsLocal(character)game.Creaturesgame.Creatures:GetAll(kind?, options?)game.Creatures:GetNearest(kind?, options?)game.Creatures:Count(kind?)game.Creatures:GetKinds()game.Creatures:GetLiveKinds()game.Creatures:GetKind(creature)game.Creatures:Describe(creature)game.Creatures:Observe(kind?, fn)game.Creatures:Highlight(kind?, options?)game.Highlightgame.Highlight:Add(target, options?)game.Highlight:Remove(target)game.Highlight:Clear()game.Highlight:GetAll()game.Highlight:Look(options?)game.Highlight:Configure(options)WaxInstanceinstance:Get(name)instance:Set(name, value)instance:Call(name, ...)instance:IsValid()instance:IsA(class_name)instance:GetClassChain()instance:GetMembers()instance:GetParent()instance:GetChildren()instance:FindFirstChild(name, recursive?)instance:FindFirstChildOfClass(class_name)instance:FindFirstChildWhichIsA(class_name)instance:GetDescendants(limit?)instance:GetAttribute(name)instance:GetAttributes()instance:SetAttribute(name, value)instance:GetAttributeChangedSignal(name)instance:AddTag(tag)instance:RemoveTag(tag)instance:HasTag(tag)instance:GetTags()WaxHighlightLooklook:Set(options)WaxHighlightMarkmark:Remove()mark:Set(options)mark:SetColor(color)WaxCreatureQueryWaxCreatureKindWaxCreatureFactsWaxCreatureEndWaxHighlightOptionsNamed valuesWaxGameMember