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

LocalPlayer

const LocalPlayer: object

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

The player this client controls, as it was captured this frame. Read-only: the server’s Player changes it. Other players are not reachable on the client, which holds one only while it streams in.

dropItem(form, count?): boolean

Drops items the player carries into the world in front of them, as the Pip-Boy’s drop does. In a session the server’s itemDrop follows and may refuse it, which takes the item back.

string | number

The base object.

number

How many; 1 when left out.

boolean

False when they carry fewer, or the game dropped nothing.

fastTravel(destination): boolean

Asks to fast travel to a reference, as picking it on the Pip-Boy map does: the server’s playerFastTravel decides, and the player travels when no script refuses.

string | number

The reference to arrive at: a map marker, or any other placed reference.

boolean

True when asked; false when the reference is not here or the player does not stand in the world.

getAimPitch(): number | null

Aim pitch, in radians.

number | null

Null outside a session or before the player stands in the world.

getBaseValue(value): number | null

An actor value’s base on the player.

string | number

The ActorValueInfo form ID, such as 0x2D4 for Health.

number | null

Null for a form ID that is no actor value, or before the player stands in the world.

getBodyPoints(): { eyeLevel: number; lookAt: Vector3; parts: Vector3[]; standingEyeHeight: number; } | null

Where the game places the points of the player’s body, in world units: the height of the eyes above the feet in the current pose and the standing height the game keeps for the player, the point others look at, and the four points the game keeps on the body, from the eyes down.

{ eyeLevel: number; lookAt: Vector3; parts: Vector3[]; standingEyeHeight: number; } | null

Null while the player is not in the world.

getCritMeter(): { charge: number; max: number; stored: number; } | null

The player’s critical meter as the game holds it: the charge towards the next stored critical, how many are stored and how many can be.

{ charge: number; max: number; stored: number; } | null

Null before the player exists.

getFurnitureState(): "none" | "sitting" | "sleeping" | "moving"

Whether the player is in a piece of furniture: seated, lying asleep, or on their way in or out of one.

"none" | "sitting" | "sleeping" | "moving"

getHeading(): number | null

Facing, in radians around Z.

number | null

Null outside a session or before the player stands in the world.

getHolotape(): { form: number; playing: boolean; } | null

The holotape in the player’s Pip-Boy and whether it runs now; null for none.

{ form: number; playing: boolean; } | null

getInventory(): InventoryItem[]

What the player carries, counted from their game.

InventoryItem[]

One entry per base object, condition and mods; empty before the player stands in the world.

getItemCount(form): number

How many of an item the player carries.

string | number

The base object.

number

The count; 0 when they carry none.

getLevel(): number

The player’s level.

number

0 before the player stands in the world.

getLocation(): number | null

The named location the player is in, a BGSLocation form ID, as ObjectReference.GetCurrentLocation reads it.

number | null

Null in the open, where the game names no location.

getMapWaypoint(): { x: number; y: number; z: number; } | null

Where the player’s own map marker is: the waypoint dropped on the Pip-Boy map.

{ x: number; y: number; z: number; } | null

Null while there is none.

getMovement(): PlayerMovement | null

What the player’s body is doing: stance, weapon, Pip-Boy.

PlayerMovement | null

Null outside a session or before the player stands in the world.

getOutfit(): OutfitPiece[]

What the player wears.

OutfitPiece[]

One entry per armor piece; empty outside a session.

getPerkPoints(): number

Perk points the player has to spend.

number

0 before the player stands in the world.

getPosition(): { x: number; y: number; z: number; } | null

Where the player stands, in world units of their space.

{ x: number; y: number; z: number; } | null

Null outside a session or before the player stands in the world.

getPowerArmor(): PlayerPowerArmor | null

The power armor frame the player wears.

PlayerPowerArmor | null

Null when they wear none, and outside a session.

getSpace(): PlayerSpace | null

The worldspace or interior cell the player is in.

PlayerSpace | null

Null outside a session or before the player stands in the world.

getTimeUnderwater(): number

The seconds the player has been under water (isUnderwater) without coming up; 0 above it. Fallout 4 has no drowning of its own: this is what a script builds one on.

number

getValue(value): number | null

An actor value’s current value on the player.

string | number

The ActorValueInfo form ID, such as 0x2D4 for Health.

number | null

Null for a form ID that is no actor value, or before the player stands in the world.

getVelocity(): { x: number; y: number; z: number; } | null

How fast the player moves, in world units per second.

{ x: number; y: number; z: number; } | null

Null outside a session or before the player stands in the world.

getVitals(): PlayerVitals | null

Health and armor, as captured at most a tenth of a second ago.

PlayerVitals | null

Null outside a session or before the player stands in the world.

getWeapon(): PlayerWeapon | null

The weapon in the player’s hands.

PlayerWeapon | null

Null for empty hands, and outside a session.

getXp(): number

The player’s XP.

number

0 before the player stands in the world.

hasPerk(perk): boolean

Whether the player holds a perk rank.

string | number

The rank’s BGSPerk form ID.

boolean

isBleedingOut(): boolean

Whether the player is in the game’s bleedout.

boolean

isCollisionEnabled(): boolean

Whether the player has their collision: false after setCollision(false) or the console’s tcl.

boolean

isDead(): boolean

Whether the player is down.

boolean

False outside a session.

isInvulnerable(): boolean

Whether the game holds the player invulnerable: setInvulnerable, or the game’s own god mode.

boolean

False before the player exists.

isJetpackFiring(): boolean

Whether the jetpack of the player’s power armor thrusts. The thrust drains the fusion core; the fJetpack* settings tune it.

boolean

isKnockedDown(): boolean

Whether the player is knocked down: in their ragdoll or getting up from it, by a script or by the game, a blast for one.

boolean

isPipboyLightOn(): boolean

Whether the player’s Pip-Boy light is on.

boolean

False before the player exists.

isPipboyVisible(): boolean

Whether the Pip-Boy shows on the player’s wrist: false after setPipboyVisible(false).

boolean

isRestrained(): boolean

Whether the player is held in place by setRestrained.

boolean

isSwimming(): boolean

Whether the player swims: in water deep enough that the game took them off their feet.

boolean

isUnderwater(): boolean

Whether the water reaches above the player’s neck, as the game’s IsUnderWater condition answers (the fNeckUnderwaterThreshold setting). A swimmer’s body often keeps it so at the surface too.

boolean

knockDown(force?, from?): boolean

Knocks the player off their feet into their ragdoll, as ObjectReference.PushActorAway does: they fall, lie a moment and get up by themselves. Every other player sees them fall and get up.

number

How hard they are thrown, as ObjectReference.PushActorAway takes it; 0, the default, drops them where they stand.

The point they are thrown away from; their own position by default.

number

number

number

boolean

False before the player stands in the world, while they are dead, down already, bleeding out, held in place or in furniture.

leaveFurniture(): boolean

Has the player get up from the furniture they are in, or stop making for it.

boolean

False when they are in none.

playHolotape(holotape): boolean

Plays a holotape recording in the player’s Pip-Boy, in place of the one in it, without the loading animation: the radio goes quiet while it runs, as when the player loads one. Seen and heard in this game alone.

string | number

The holotape’s form ID. It need not be carried.

boolean

False when the form is no holotape, holds no recording (a game or a terminal tape), or would not start.

setAlpha(alpha, fade?): boolean

Draws the player’s body more or less see-through in this game, as Actor.SetAlpha does. Other players’ games are not told.

number

0, invisible, to 1, opaque.

boolean

Fade there rather than cut (default false).

boolean

False before the player stands in the world.

setBleedingOut(bleedingOut): boolean

Puts the player into the game’s bleedout, or gets them out of it: down on the ground and alive, the camera pulled out, the controls held, as a downed companion is. Every other player sees them down. Nothing kills them there, as nothing kills a downed companion; they stay until a script gets them up or the session ends, and get up at full health.

boolean

True to go down, false to get back up.

boolean

False before the player stands in the world, while they are dead or held in place.

setClipAmmo(rounds): boolean

Loads rounds into the weapon in the player’s hands, as FiveM’s SetAmmoInClip does a ped’s. The rounds come from those the player carries, as a reload takes them: never more than they have; the server’s player.giveItem gives more.

number

The rounds to load, 0 to 100000; more than the weapon’s clip loads a full clip.

boolean

False without a weapon that loads ammo in hand.

setCollision(enabled): void

Takes the player’s collision away or gives it back, as FiveM’s SetEntityCollision does a ped and the console’s tcl the player: without it they move along where they look, through walls and floors, without gravity. An admin’s noclip on foot. It comes back when the session ends.

boolean

False to take the player’s collision away, true to give it back.

void

setInvulnerable(invulnerable): boolean

Makes the player a ghost, as Actor.SetGhost does: attacks in their own game pass through them, and their game refuses the hits other players’ games land on them.

boolean

The flag.

boolean

False before the player exists.

setMapWaypoint(position): boolean

Drops the player’s own map marker, or takes it off, as they would on the Pip-Boy map: the server’s playerMapWaypoint hears of it and may put back what was there.

{ x: number; y: number; z: number; } | null

Where to, in the space the player stands in; null takes it off.

boolean

False before the player stands in the world.

setPipboyLight(on): boolean

Turns the player’s Pip-Boy light on or off, as the light key does, without its sound.

boolean

On or off.

boolean

False before the player stands in the world.

setPipboyVisible(visible): void

Hides or shows the Pip-Boy on the player’s wrist, in first and third person and on every other player’s screen, without taking the item away: a character who owns none. Raising it still opens the menu; Controls.setEnabled("menu", false) keeps it shut. Held until shown again or the player disconnects.

boolean

Shown, or hidden.

void

setRace(race): boolean

Rebuilds the player on another race, as the console’s setrace and Actor.SetRace do: a ghoul. Every other player sees their puppet rebuilt the same way; their head parts stay their own. Only human and ghoul are supported; any other race is refused. The race they had comes back with null, and when the session ends.

string | number | null

0x13746 (HumanRace) or 0xEAFB6 (GhoulRace); null for the race the player had.

boolean

False when the player is not standing in the world.

setRestrained(restrained): boolean

Holds the player in place, as Actor.SetRestrained does: they stand where they are and neither move nor act until let go. Cuffs, a stun, a cutscene.

boolean

Held, or let go.

boolean

False before the player stands in the world, or while they are down or dead.

setWeaponDrawn(drawn): void

Holds the player’s weapon out or away, as FiveM’s SetCurrentPedWeapon forces a ped’s: drawn or holstered at once, then kept so against the ready-weapon key and the game. With no weapon in hand, out raises the fists. Controls.setEnabled("fighting", false) stops attacks too.

boolean | null

True to hold the weapon out, false to keep it away, null to hand it back to the player.

void

stopHolotape(): boolean

Stops the player’s holotape and takes it out.

boolean

False when there was none.

useFurniture(furniture): boolean

Puts the player into a piece of furniture at once, wherever they stand, as Actor.SnapIntoInteraction does: a chair seats them, a bed lays them down, once its animations are loaded. A seated player stands up by moving; one lying in a bed is there until leaveFurniture.

string | number

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

boolean

False before the player stands in the world, while they are down or dead, when the furniture is not loaded here or would not take them.