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.
| Member | Type | Description |
|---|---|---|
World | WaxInstance | The current world. Its children are the actors in it. |
GameInstance | WaxInstance | An engine object. Any member not listed here is one of the object's own reflected properties or functions. |
GameState | WaxInstance | An engine object. Any member not listed here is one of the object's own reflected properties or functions. |
GameMode | WaxInstance? | Nil when you are a client in someone else's game. |
LocalPlayer | WaxInstance | The local player's controller. |
Character | WaxInstance? | The pawn the local player controls. nil at the main menu. |
Engine | WaxInstance | An engine object. Any member not listed here is one of the object's own reflected properties or functions. |
Viewport | WaxInstance | The game viewport. |
MapName | string? | The name of the current world. |
InProspect | boolean | True while you are in a prospect. |
Players | WaxPlayers | |
Creatures | WaxCreatures | 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. |
Highlight | WaxHighlight | 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. |
| Signal | Handler receives | Description |
|---|---|---|
MapChanged | name: string | Fires 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?| Parameter | Type |
|---|---|
object | any |
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?| Parameter | Type |
|---|---|
class_name | string |
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[]| Parameter | Type |
|---|---|
class_name | string |
Returns WaxInstance[]
game:GetTagged(tag)
Every live Instance carrying the tag.
game:GetTagged(tag: string): WaxInstance[]| Parameter | Type |
|---|---|
tag | string |
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| Parameter | Type |
|---|---|
name | WaxGameMember |
Returns any
game.Players
Type name: WaxPlayers.
| Member | Type | Description |
|---|---|---|
LocalPlayer | WaxInstance | The local player's controller, the same as game.LocalPlayer. |
| Signal | Handler receives | Description |
|---|---|---|
CharacterAdded | character: WaxInstance | Fires when a player's character appears. |
CharacterRemoved | character: WaxInstance | Fires 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| Parameter | Type |
|---|---|
fn | fun(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?| Parameter | Type |
|---|---|
character | WaxInstance |
Returns string?
game.Players:IsLocal(character)
True for the character this player controls.
game.Players:IsLocal(character: WaxInstance): boolean| Parameter | Type |
|---|---|
character | WaxInstance |
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.
| Signal | Handler receives | Description |
|---|---|---|
Added | creature: WaxInstance | Fires for each creature that appears from now on. |
Removed | creature: WaxInstance, info: WaxCreatureEnd | Fires when a creature leaves the world. The Instance can no longer be used, only compared. |
Died | creature: WaxInstance, info: WaxCreatureEnd | Fires when a creature is killed, a few seconds before it is removed. |
Cleared | nothing | Fires 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[]| Parameter | Type |
|---|---|
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?| Parameter | Type |
|---|---|
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| Parameter | Type |
|---|---|
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?| Parameter | Type |
|---|---|
creature | WaxInstance |
Returns string? , string?
game.Creatures:Describe(creature)
The common facts about one creature as plain values.
game.Creatures:Describe(creature: WaxInstance): WaxCreatureFacts| Parameter | Type |
|---|---|
creature | WaxInstance |
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| Parameter | Type |
|---|---|
kind (optional) | string |
fn | fun(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| Parameter | Type |
|---|---|
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.
| Member | Type | Description |
|---|---|---|
Colors | string[] | 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| Parameter | Type |
|---|---|
target | WaxInstance |
options (optional) | WaxHighlightOptions | WaxHighlightLook |
Returns WaxHighlightMark
game.Highlight:Remove(target)
game.Highlight:Remove(target: WaxInstance)| Parameter | Type |
|---|---|
target | WaxInstance |
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| Parameter | Type |
|---|---|
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 }| Parameter | Type |
|---|---|
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.
| Property | Type | Description |
|---|---|---|
Name | string | The object's name. |
ClassName | string | The name of the object's class. |
FullName | string | The engine's full name for the object: its class, then its path. |
Parent | WaxInstance? | What GetParent() returns. |
Raw | any | The 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| Parameter | Type |
|---|---|
name | string |
Returns any
instance:Set(name, value)
Writes a reflected property by name, converting and checking the value first.
instance:Set(name: string, value: any)| Parameter | Type |
|---|---|
name | string |
value | any |
Returns nothing.
instance:Call(name, ...)
Calls a reflected function by name, converting and checking the arguments first.
instance:Call(name: string, ...: any): any| Parameter | Type |
|---|---|
name | string |
... | any |
Returns any
instance:IsValid()
False once the object has been destroyed or the map has changed.
instance:IsValid(): booleanReturns 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| Parameter | Type |
|---|---|
class_name | string |
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?| Parameter | Type |
|---|---|
name | string |
recursive (optional) | boolean |
Returns WaxInstance?
instance:FindFirstChildOfClass(class_name)
The first child of exactly this class, or nil.
instance:FindFirstChildOfClass(class_name: string): WaxInstance?| Parameter | Type |
|---|---|
class_name | string |
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?| Parameter | Type |
|---|---|
class_name | string |
Returns WaxInstance?
instance:GetDescendants(limit?)
Every Instance below this one, nearest first, stopping at limit (default 5000).
instance:GetDescendants(limit?: integer): WaxInstance[]| Parameter | Type |
|---|---|
limit (optional) | integer |
Returns WaxInstance[]
instance:GetAttribute(name)
The value SetAttribute stored on the Instance under name, or nil.
instance:GetAttribute(name: string): any| Parameter | Type |
|---|---|
name | string |
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)| Parameter | Type |
|---|---|
name | string |
value | any |
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)>| Parameter | Type |
|---|---|
name | string |
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)| Parameter | Type |
|---|---|
tag | string |
Returns nothing.
instance:RemoveTag(tag)
Takes a tag off the Instance.
instance:RemoveTag(tag: string)| Parameter | Type |
|---|---|
tag | string |
Returns nothing.
instance:HasTag(tag)
True when the Instance carries the tag.
instance:HasTag(tag: string): boolean| Parameter | Type |
|---|---|
tag | string |
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)| Parameter | Type |
|---|---|
options | WaxHighlightOptions |
Returns nothing.
WaxHighlightMark
One outlined actor.
You get one from game.Highlight:Add. Below, mark stands for one of these.
| Property | Type | Description |
|---|---|---|
Instance | WaxInstance | An engine object. Any member not listed here is one of the object's own reflected properties or functions. |
Active | boolean | False 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)| Parameter | Type |
|---|---|
options | WaxHighlightOptions |
Returns nothing.
mark:SetColor(color)
mark:SetColor(color: string|{ R: number, G: number, B: number })| Parameter | Type |
|---|---|
color | string | { R: number, G: number, B: number } |
Returns nothing.
WaxCreatureQuery
Used by game.Creatures:GetAll, game.Creatures:GetNearest.
| Field | Type | Description |
|---|---|---|
within (optional) | number | Only 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) | boolean | True 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.
| Field | Type | Description |
|---|---|---|
Name | string | The kind's name in the game's data, such as "Wolf". |
DisplayName | string | The name the game shows players. |
Tag | string | The game's own tag for the kind, such as "NPC.Wolf". |
Variants | string[] | The versions of the kind, such as "Conifer_Wolf" and "Snow_Wolf". |
Count | integer | How many are in the world now. |
WaxCreatureFacts
Returned by game.Creatures:Describe.
| Field | Type | Description |
|---|---|---|
Kind | string | |
Variant | string | |
DisplayName | string | |
ClassName | string | |
Name | string | |
IsAlive | boolean | |
Health | integer? | |
MaxHealth | integer? | |
Level | integer? | |
Position | { X: number, Y: number, Z: number } | In the engine's units: 100 is one metre. |
WaxCreatureEnd
| Field | Type |
|---|---|
Kind | string |
Variant | string |
ClassName | string |
Name | string |
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.
| Option | Type | Description |
|---|---|---|
Color | string | { R: number, G: number, B: number } | A name from game.Highlight.Colors, "#rrggbb", or values from 0 to 1. "Red" when omitted. |
Fill | boolean | Also tints the whole model. True when omitted. |
FillColor | string | { R: number, G: number, B: number } | false | The 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".