References
constReferences: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.
Type Declaration
Section titled “Type Declaration”activate()
Section titled “activate()”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.
Parameters
Section titled “Parameters”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.
defaultProcessingOnly?
Section titled “defaultProcessingOnly?”boolean
Skip what the reference’s own scripts would do about it (default false).
Returns
Section titled “Returns”boolean
False when the reference is not loaded here or the game activated nothing.
applyImpulse()
Section titled “applyImpulse()”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.
Parameters
Section titled “Parameters”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.
direction
Section titled “direction”Which way to push, in world axes; its length does not matter.
number
number
number
magnitude
Section titled “magnitude”number
How hard, as ObjectReference.ApplyHavokImpulse takes it; the game scales it by the object’s mass.
Returns
Section titled “Returns”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()
Section titled “find()”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.
Parameters
Section titled “Parameters”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.
radius
Section titled “radius”number
How far from the player, in world units.
limit?
Section titled “limit?”number
How many at most (default 32, never more than 512).
Returns
Section titled “Returns”number[]
Empty before the player stands in the world, or when the base is no form.
getAnimationGraph()
Section titled “getAnimationGraph()”getAnimationGraph(
ref):string|null
The name of the behavior graph that animates the reference, the one playAnimation sends its events to.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”string | null
Null when the reference is not loaded here or no behavior graph animates it.
getEntityBody()
Section titled “getEntityBody()”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.
Parameters
Section titled “Parameters”entityId
Section titled “entityId”number
The network ID of a player or an NPC, as the server knows it (player.id, npc.id).
Returns
Section titled “Returns”number | null
Null for the local player and for an entity with no body loaded here.
getInfo()
Section titled “getInfo()”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.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”{ 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()
Section titled “getInventory()”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.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”InventoryItem[] | null
Null when the reference is not here; empty when it holds nothing.
getLockLevel()
Section titled “getLockLevel()”getLockLevel(
ref):number|null
The level a pick attempt on the reference’s lock faces.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”number | null
Null when it is not here or has no lock.
getMapMarker()
Section titled “getMapMarker()”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.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”{ canTravel: boolean; type: number; visible: boolean; } | null
Null when the reference is not here or is no map marker.
getScale()
Section titled “getScale()”getScale(
ref):number|null
The reference’s scale, 1 being its normal size.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”number | null
Null when it is not here.
getTerminal()
Section titled “getTerminal()”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.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”{ base: number; entries: object[]; header: string; pages: string[]; welcome: string; } | null
Null when the reference is not here or is not a terminal.
getValue()
Section titled “getValue()”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.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”number | null
Null when the reference is not here or the form ID is no actor value.
isActivationBlocked()
Section titled “isActivationBlocked()”isActivationBlocked(
ref):boolean
Whether activating the reference is refused.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”boolean
False when it is not here.
isDestroyed()
Section titled “isDestroyed()”isDestroyed(
ref):boolean
The game’s destroyed flag.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”boolean
False when it is not here.
isEnabled()
Section titled “isEnabled()”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.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”boolean | null
Null when this game holds no such reference now.
isHarvested()
Section titled “isHarvested()”isHarvested(
ref):boolean
Whether a flora or produce reference is picked.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”boolean
False when it is not here.
isLoaded()
Section titled “isLoaded()”isLoaded(
ref):boolean
Whether the reference is in this game with its 3D loaded.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”boolean
False when it is not here.
openContainer()
Section titled “openContainer()”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.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”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()
Section titled “openTrade()”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.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”boolean
False when the reference is no actor loaded here.
playAnimation()
Section titled “playAnimation()”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.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”boolean
False when the reference is not loaded here or no graph of its took the event.
setActivationBlocked()
Section titled “setActivationBlocked()”setActivationBlocked(
ref,blocked):boolean
Blocks or allows activating the reference.
Parameters
Section titled “Parameters”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.
blocked
Section titled “blocked”boolean
The flag.
Returns
Section titled “Returns”boolean
False when it is not here.
setActorRestrained()
Section titled “setActorRestrained()”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.
Parameters
Section titled “Parameters”string | number
The actor’s form ID in this game, as getEntityBody gives it.
restrained
Section titled “restrained”boolean
Held, or let go.
Returns
Section titled “Returns”boolean
False when the actor is not loaded here, or is down or dead.
setDestroyed()
Section titled “setDestroyed()”setDestroyed(
ref,destroyed):boolean
Sets the game’s destroyed flag: a destroyed reference cannot be activated.
Parameters
Section titled “Parameters”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.
destroyed
Section titled “destroyed”boolean
The flag.
Returns
Section titled “Returns”boolean
False when it is not here.
setHarvested()
Section titled “setHarvested()”setHarvested(
ref,harvested):boolean
Shows a flora or produce reference picked, or grown back.
Parameters
Section titled “Parameters”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.
harvested
Section titled “harvested”boolean
The flag.
Returns
Section titled “Returns”boolean
False when it is not here or is neither.
setLockLevel()
Section titled “setLockLevel()”setLockLevel(
ref,level):boolean
Sets the level of the reference’s lock; one with no lock gets an unlocked one.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”boolean
False when it is not here.
setMotionType()
Section titled “setMotionType()”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.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”boolean
False when the reference is not loaded here, its model has no physics, or it is an actor.
setScale()
Section titled “setScale()”setScale(
ref,scale):boolean
Scales the reference.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”boolean
False when it is not here.
setValue()
Section titled “setValue()”setValue(
ref,value,amount):boolean
Sets an actor value on the reference, as ObjectReference.SetValue does.
Parameters
Section titled “Parameters”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.
amount
Section titled “amount”number
The new value.
Returns
Section titled “Returns”boolean
False when the reference is not here or the form ID is no actor value.
showBarterMenu()
Section titled “showBarterMenu()”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.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”boolean
False when the reference is no actor loaded here.
useFurniture()
Section titled “useFurniture()”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.
Parameters
Section titled “Parameters”string | number
The actor’s form ID in this game, as getEntityBody gives it.
furniture
Section titled “furniture”string | number
The furniture reference: a chair, a bed, a workbench.
Returns
Section titled “Returns”boolean
False when the actor or the furniture is not loaded here, or the furniture would not take it.