Skip to content
FMFallout Multiplayer Scripting APIScripting guides and API
Global objectClient APIGenerated

References

const References: object

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

The state of a placed reference in this player’s game alone. Nothing here reaches another player: a script that wants everyone to agree tells each client.

activate(ref, defaultProcessingOnly?): boolean

Has the local player activate the reference, wherever they stand, as ObjectReference.Activate does: a door opens, an item is picked up, a container shows its menu. Raises activate like any other.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

boolean

Skip what the reference’s own scripts would do about it (default false).

boolean

False when the reference is not loaded here or the game activated nothing.

applyImpulse(ref, direction, magnitude): boolean

Pushes an object the physics moves, as ObjectReference.ApplyHavokImpulse does: a can flies, a crate slides. In this game alone, as its physics are.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

Which way to push, in world axes; its length does not matter.

number

number

number

number

How hard, as ObjectReference.ApplyHavokImpulse takes it; the game scales it by the object’s mass.

boolean

False when the reference is not loaded here or nothing of it is a physics body. A body the physics holds fixed takes the push and stays where it is.

find(base, radius, limit?): number[]

The placed references around the player, nearest first: what a script looks the world up by before it reads or changes a reference. It walks the cells loaded in this game, so call it when needed, not every frame. Actors are not references here.

string | number | null

The base object the references are placed from, such as a container’s or a door’s form ID; null for any.

number

How far from the player, in world units.

number

How many at most (default 32, never more than 512).

number[]

Empty before the player stands in the world, or when the base is no form.

getAnimationGraph(ref): string | null

The name of the behavior graph that animates the reference, the one playAnimation sends its events to.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

string | null

Null when the reference is not loaded here or no behavior graph animates it.

getEntityBody(entityId): number | null

The form ID of the actor that stands for another player or an NPC in this game: what openTrade and showBarterMenu take. A session’s players and NPCs are this game’s own copies, so the reference ID the server knows an NPC by is not theirs; this one is good only here and only while the body is loaded.

number

The network ID of a player or an NPC, as the server knows it (player.id, npc.id).

number | null

Null for the local player and for an entity with no body loaded here.

getInfo(ref): { base: number; name: string; position: { x: number; y: number; z: number; }; rotation: { x: number; y: number; z: number; }; type: string; } | null

What a reference is and where it stands: the form ID of the base object it is placed from, the base’s record type (“CONT”, “NPC_”, “DOOR”, “WEAP”…), the name the HUD shows for it (“” for none), its position in world units and its rotation in radians about the X, Y and Z axes.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

{ base: number; name: string; position: { x: number; y: number; z: number; }; rotation: { x: number; y: number; z: number; }; type: string; } | null

Null when the reference is not here.

getInventory(ref): InventoryItem[] | null

What a container, a corpse or any actor holds in this game, as LocalPlayer.getInventory counts the player’s: a custom loot screen reads it, openContainer or References.activate takes from it.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

InventoryItem[] | null

Null when the reference is not here; empty when it holds nothing.

getLockLevel(ref): number | null

The level a pick attempt on the reference’s lock faces.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

number | null

Null when it is not here or has no lock.

getMapMarker(ref): { canTravel: boolean; type: number; visible: boolean; } | null

A map marker’s state on this player’s map: whether it shows, whether it is a fast travel destination, and its icon type. The server changes it with Player.discoverLocations and forgetLocations.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

{ canTravel: boolean; type: number; visible: boolean; } | null

Null when the reference is not here or is no map marker.

getScale(ref): number | null

The reference’s scale, 1 being its normal size.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

number | null

Null when it is not here.

getTerminal(ref): { base: number; entries: object[]; header: string; pages: string[]; welcome: string; } | null

What a terminal holds, as its record in the data files has it: the header and welcome lines, the pages it shows on entry, and its menu entries with their item IDs, labels, response lines and what each opens: another menu, a page of text or an image. Entries a condition hides in play are listed too; the controls the game adds for a door, turret or light the terminal is linked to are not in the record, and not listed. A wall terminal placed from the generic DefaultTerminalWall holds nothing of its own.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

{ base: number; entries: object[]; header: string; pages: string[]; welcome: string; } | null

Null when the reference is not here or is not a terminal.

getValue(ref, value): number | null

An actor value on the reference, as ObjectReference.GetValue reads it. A workbench keeps its settlement’s figures this way: its build budget, its population, its power.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

string | number

An ActorValueInfo form ID.

number | null

Null when the reference is not here or the form ID is no actor value.

isActivationBlocked(ref): boolean

Whether activating the reference is refused.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

boolean

False when it is not here.

isDestroyed(ref): boolean

The game’s destroyed flag.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

boolean

False when it is not here.

isEnabled(ref): boolean | null

Whether the reference is in the world: false once ObjectReference.Disable, a quest’s enable parent or the server’s Objects.setEnabled took it out.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

boolean | null

Null when this game holds no such reference now.

isHarvested(ref): boolean

Whether a flora or produce reference is picked.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

boolean

False when it is not here.

isLoaded(ref): boolean

Whether the reference is in this game with its 3D loaded.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

boolean

False when it is not here.

openContainer(ref): boolean

Opens the game’s container menu on a container, wherever the player stands, as activating it does but without its lock or its opening animation. In a session the server’s containerOpen runs first and the menu opens once it lets the player in, holding what a server script filled the container with there: a stash or a shop of the player’s own.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

boolean

False when the reference is not loaded here or is no container, when another player has it open, or while this player has a container open.

openTrade(ref): boolean

Opens the give-and-take screen on an actor, the one the game shows for a companion, as Actor.OpenInventory does when forced.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

boolean

False when the reference is no actor loaded here.

playAnimation(ref, event): boolean

Sends an animation event to the reference’s behavior graph, as ObjectReference.PlayAnimation does: a machine starts, a prop moves, without the activation and what it would trigger. Seen in this game alone. Only objects animated by a behavior graph take one; getAnimationGraph tells which are.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

string

The animation event’s name, as the object’s behavior graph knows it.

boolean

False when the reference is not loaded here or no graph of its took the event.

setActivationBlocked(ref, blocked): boolean

Blocks or allows activating the reference.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

boolean

The flag.

boolean

False when it is not here.

setActorRestrained(actor, restrained): boolean

Holds an actor in place, as Actor.SetRestrained does: it stays as it is and its own behavior stops until it is let go. It holds while this game simulates the actor.

string | number

The actor’s form ID in this game, as getEntityBody gives it.

boolean

Held, or let go.

boolean

False when the actor is not loaded here, or is down or dead.

setDestroyed(ref, destroyed): boolean

Sets the game’s destroyed flag: a destroyed reference cannot be activated.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

boolean

The flag.

boolean

False when it is not here.

setHarvested(ref, harvested): boolean

Shows a flora or produce reference picked, or grown back.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

boolean

The flag.

boolean

False when it is not here or is neither.

setLockLevel(ref, level): boolean

Sets the level of the reference’s lock; one with no lock gets an unlocked one.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

number

0 to 255.

boolean

False when it is not here.

setMotionType(ref, type): boolean

Says whether the physics moves an object, as ObjectReference.SetMotionType does: freeze a crate in mid-air, or let a fixed prop fall. In this game alone.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

"dynamic" | "keyframed"

Dynamic: the physics moves it, so it falls and can be pushed. Keyframed: it stays where it is put, whatever hits it.

boolean

False when the reference is not loaded here, its model has no physics, or it is an actor.

setScale(ref, scale): boolean

Scales the reference.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

number

0.01 to 10.

boolean

False when it is not here.

setValue(ref, value, amount): boolean

Sets an actor value on the reference, as ObjectReference.SetValue does.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

string | number

An ActorValueInfo form ID.

number

The new value.

boolean

False when the reference is not here or the form ID is no actor value.

showBarterMenu(ref): boolean

Opens the game’s barter screen on an actor, as Actor.ShowBarterMenu does: it sells what the game works out as that actor’s vendor stock.

string | number

The reference’s form ID: a placed object, or an actor’s, such as a body getEntityBody, World.raycast or the crosshair gives.

boolean

False when the reference is no actor loaded here.

useFurniture(actor, furniture): boolean

Puts an actor into a piece of furniture at once, without walking to it, as Actor.SnapIntoInteraction does: a chair seats it, a bed lays it down asleep. It lasts while this game simulates the actor and its own behavior leaves it there.

string | number

The actor’s form ID in this game, as getEntityBody gives it.

string | number

The furniture reference: a chair, a bed, a workbench.

boolean

False when the actor or the furniture is not loaded here, or the furniture would not take it.