Player

A connected player, with the same object valid for the whole session. Values such as health, position and buffs are what the player's game last reported. Server scripts get all players, and client scripts get those their machine knows about.

player.all()

Player.all()

All connected players, including those still loading.

player.getById()

Player.getById(id)

The player with this network id, or null if none is connected.

player.inRadius()

Player.inRadius(position, radius, options = {})

Players within `radius` metres of a position, nearest first, counting only those with a body in the world. Throws for a position without finite x, y and z, or a radius that is not positive.

player.nearest()

Player.nearest(position, options = {})

The player nearest a position, or null.

player.find()

Player.find(text)

The players a command argument names. A whole number finds that id. Otherwise it looks for exact nicknames ignoring case, then those starting with the text, then those containing it. Gives an empty array for none, and more than one if ambiguous.

player.outfitSets()

Player.outfitSets(gender)

The game's outfits, or those made for one gender if given.

player.setDimension()

setDimension(world)

Moves the player to another dimension. Players and entities see each other only in the same one, and 0 is the shared one everyone starts in.

player.showOnlyTo()

showOnlyTo(player)

Lets one other player see this player, even in different dimensions.

player.revive()

revive(options = {})

Gets the player up after playerDied, with full health. By default it also cures injuries, poison and bleeding, as heal() does, and revive({ keepEffects: true }) leaves them. Returns true when sent, and false if they are not down or a revival was already requested.

player.dog

dog

Their dog companion, or null.

player.horse

horse

The server horse they ride, or null.

player.mounted

mounted

Whether they sit in the saddle of a server horse.

player.carrying

carrying

Who they have on their shoulder, or null.

player.heldBy

heldBy

The player carrying this one's body, or null.

player.putDown()

putDown()

Has them put down the carried body with the game's put-down, and playerPutDown follows when it lands. Returns false if they carry no one or are disconnected.

player.playAnimation()

playAnimation(fragment, options)

Makes their body play one of the game's animations on all screens, until stopAnimation or the next playAnimation. playerAnimationEnd follows once per request, as finished, interrupted, refused, stopped or replaced. A seated player plays it in the seat and stays seated, as with Guest_DrinkBeer at a tavern table. An empty fragment with only tags sets a walk or stance style until stopAnimation, such as drunk, injured, r_sack, and monk on a man's body only. That fires playerAnimationEnd only if none of the tags fits the body, as 'refused' with the fragment ''. Returns false before they have a body, or while cuffed.

player.setAnimationSpeed()

setAnimationSpeed(speed)

Sets the running animation's speed on all screens, and a paused one stays still until resumeAnimation. Returns true when the order goes out, and false with no running playAnimation.

player.pauseAnimation()

pauseAnimation()

Holds the running animation still on all screens until resumeAnimation. Returns true once sent, and false with no running playAnimation.

player.resumeAnimation()

resumeAnimation()

Continues a paused animation at its speed. Returns true once sent, and false with no running playAnimation.

player.animationSpeed

animationSpeed

The running animation's speed, 0 while paused, or null with none.

player.setAnimationProps()

setAnimationProps(props)

Changes the running animation's props on all screens without restarting it, which helps tune a held prop while the hand moves. Returns true when the order goes out, and false with no running playAnimation.

player.playPairedAnimation()

playPairedAnimation(other, fragment, options)

Plays one of the game's two-person animations with another player. This player, the master, stays put and plays `fragment`. The other, the slave, is moved and turned to where the pair needs them, and plays its Slave fragment or `slaveFragment`. Both are held still, with lockMovement true by default, and do not push each other. Returns true when it goes out, and false for a player with no body, a cuffed one, the same player twice, players in other dimensions, or a fragment either body lacks. playerAnimationEnd follows for each.

player.setExpression()

setExpression(fragment, options)

Sets the face's expression on all screens: FE_Default, FE_DialogueIdle or FE_DialogueSpeaking, with `tags` for a mood, happy, angry, sad, nervous, pensive, arogant or drunk, alongside the body's animation. "" returns the face to the game. Returns true once sent, and false with no body yet or if cuffed.

player.setSpeaking()

setSpeaking(talking, style)

Moves the mouth as if talking on all screens until setSpeaking(false), with a loop of the game's face clip, not lip-sync. Returns true once sent, and false with no body yet.

player.setTalkingStyle()

setTalkingStyle(style)

The style setSpeaking uses for them when given none. No style or 'neutral' returns to normal. Returns true if set, and false if they left.

player.talkingStyle

talkingStyle

Their talking style, 'neutral' by default.

player.talking

talking

The style the mouth moves in now, or null if not talking.

player.stopAnimation()

stopAnimation(options)

Ends what playAnimation started at once and removes its props. { standUp: true } plays the game's way back to standing. Returns true once sent, and false if cuffed.

player.setCuffed()

setCuffed(cuffed)

Holds their hands behind the back on all screens, and they can only walk and look around, until setCuffed(false). playerCuffedChange(player, cuffed) follows. Returns true if set, and false if they left.

player.mount()

mount(horse, options = {})

Puts them in a horse's saddle, using the game's get-on or an instant seat, so nearby players see it, and horseMount follows once they sit. They must be close, so teleport them first if needed. Returns false if the horse is dead, knocked out or ridden by someone else, or the player is not in the world.

player.keyBypass

keyBypass

Whether this player, such as an admin, opens all doors and chests the server holds with no key. Their game shows those locks as unlocked and the server lets them through, and for others the locks stay. A level chest the server has not adopted keeps the game's lock. Throws a TypeError for anything except true or false.

player.dismount()

dismount()

Dismounts them through their client, then fires horseDismount. Returns false if they are not riding.

player.setInteraction()

setInteraction(name, allowed)

Sets one of the game's interactions for this player: true, false, or null for the server's setting. Returns true if set, and false if they left.

player.interactionAllowed()

interactionAllowed(name)

Whether they have that interaction now.

player.setTrespassAllowed()

setTrespassAllowed(allowed)

Lets them be in the game's private and prohibited areas, with no warning and the game's AI told not to react. Returns true if set, and false if they left.

player.trespassAllowed

trespassAllowed

Whether they can be in private and prohibited areas now.

player.whistle()

whistle()

Whistles for their horse like the game's companion key, so it comes and nearby players hear it, firing playerWhistle. Returns true when the order goes out, and false if they are not yet in the world.

player.cuffed

cuffed

Whether they are cuffed. It can still be read in playerDisconnect, so a resource can cuff a returning player again.

player.attachTo()

attachTo(other, options)

Attaches this player to another, like a rider on a horse. Their game keeps the body at `offset`, turned by `rotation` degrees, and lets through only looking around and menus. Returns false if they left, for the player themselves, or for a circle of attachments.

player.detach()

detach()

Ends attachTo, returning their body where they are. Returns false if not attached.

player.attachedTo

attachedTo

The player this one is attached to, or null.

player.frozen

frozen

Holds their body and controls, as Npc.frozen does. Their game lets through only looking around and menus, and a body that moves anyway is put back. It ends when they leave.

player.noclipAllowed

noclipAllowed

Whether they can fly with NoClip. False ends a running flight and makes their NoClip.enable() return 'notAllowed'. It resets when they leave, so set it in playerConnect to keep flying for some players.

player.putInPillory()

putInPillory(entityName)

Puts them in the pillory whose holder entity has that name, or the nearest with no name. They stay until releaseFromPillory or another player picks its lock, and playerPilloryReleased(player, 'script' | 'lockpicked') follows. Returns true once sent, and false with no body yet. A name it cannot send throws.

player.pillory

pillory

The holder entity name of their pillory, or null. It can still be read in playerDisconnect, so a resource can put a returning player back.

player.releaseFromPillory()

releaseFromPillory()

Takes them out of the pillory. Returns true if they were in one.

player.kick()

kick(reason = '')

Ends the player's session. Their client returns to the main menu with "You were kicked from the server: <reason>", and playerDisconnect follows about half a second later. Returns false if they are already gone.

player.disconnect()

disconnect(text = '', options = undefined)

Lets the player go without the word "kicked". Their client returns to the main menu with the text as written, or "You left the server." if empty, or with { quit: true } closes the game. playerDisconnect follows about half a second later, where a resource can save the player. Returns false if they are already gone.

player.ban()

ban(reason = undefined)

Bans the player from this server with a reason and no end, by all identifiers except the address, which could hit strangers behind a shared NAT, on the list KCDS-Admin keeps. They leave at once with "You are banned from this server: <reason>." and are refused on returning, until Bans.remove lifts it. For a set time, your script keeps the end date and lifts it. Returns the ban, or null if they are gone.

player.setKnockoutVision()

setKnockoutVision(percent)

How much they see while knocked out, as a percentage. 0, the default, is a black screen, and 1 to 100 darkens the world to that percentage, in the game's red low-health tint.

player.setAppearance()

setAppearance(appearance)

Gives them other character parts, with names from Appearances.options, where '' restores the game's part. Returns true when the request goes out.

player.setVisible()

setVisible(visible)

Asks their client to stop or resume drawing their body, changing only the drawing. Returns true when the request goes out.

player.setDisguise()

setDisguise(model)

Asks their client to draw their body as a prop catalogue mesh, or as themselves with null. Returns true when the request goes out.

player.attachProp()

attachProp(options)

Hangs a mesh on a joint for as long as the script wants, such as cuffs on wrists, a sack on a head or a noose on a neck. All players see it follow the joint, even while cuffed. It has no physics and goes when the player leaves. It returns the Prop, with `attachedTo` set to the player, and `position` and `rotation` as the offset from the joint, up to 5 m. Throws a TypeError for a model not in the catalogue or a joint that is not a name, and a RangeError for an offset past 5 m.

player.brand

brand

The game's brand on the left of the neck: 0 none, 1 fresh and red, 2 darker, as if healed. All players see it, including later joiners, until it changes or the player leaves. It is only the mark, so for the game's penalties also add the buff `crime_punishment_brand`.

player.addMark()

addMark(options)

Adds a mark on the skin, a flat textured mesh, your resource's or the game's, on a joint close to the skin. All players see it, until removeMark or the player leaves. Returns its id, and throws for unusable options.

player.removeMark()

removeMark(id)

Removes a mark from addMark. Returns true if the id was one of this player's.

player.marks

marks

The ids of their marks, oldest first.

player.detachProp()

detachProp(prop)

Removes a prop attachProp hung on this player, for all players. Returns true if it was this player's, and false for a prop in the world or on someone else.

player.wearItem()

wearItem(item)

Puts clothing on them for a while without it being in their inventory, such as a noose, sack or shackles. All players see it, the server's inventory does not change, and they can take it off by hand. Returns true if it was not already worn this way. Throws a TypeError for an unknown class, and a RangeError for one that is not clothing or past 8 pieces.

player.removeWorn()

removeWorn(item)

Removes a piece wearItem put on. Returns true if it was worn this way.

player.wornItems

wornItems

Ids of item classes wearItem put on them.

player.setNameplateVisible()

setNameplateVisible(visible)

Shows or hides their plate on other players' screens. Each player can still hide all plates for themselves with the client's Nameplates.

player.isNameplateVisible()

isNameplateVisible()

Whether their plate shows on all screens.

player.setNameplateHealthVisible()

setNameplateHealthVisible(visible)

Turns their plate's health bar on or off, on all screens.

player.isNameplateHealthVisible()

isNameplateHealthVisible()

Whether their plate shows the health bar. True by default.

player.setNameplateNameVisible()

setNameplateNameVisible(visible)

Whether their plate shows the name. With the health bar alone, the bar takes its place.

player.isNameplateNameVisible()

isNameplateNameVisible()

Whether their plate shows the name. True by default.

player.setNameplateMode()

setNameplateMode(mode)

What a shown plate has: 'both' (default), 'name', 'health' or 'none', the same as setting the name and health switches together.

player.getNameplateMode()

getNameplateMode()

What their plate shows: 'both', 'name', 'health' or 'none'.

player.setNameplateText()

setNameplateText(text)

Text their plate shows in place of the nickname, on all screens. '' restores the nickname.

player.getNameplateText()

getNameplateText()

The plate's text, or '' for the nickname.

player.setNameplateTitle()

setNameplateTitle(title, color, size)

A title above the name on all screens, such as a role. A larger title grows only upward.

player.getNameplateTitle()

getNameplateTitle()

The title above their name, or ''.

player.getNameplateTitleColor()

getNameplateTitleColor()

The title's colour, or 0 for the default gold.

player.getNameplateTitleSize()

getNameplateTitleSize()

The title's size, or 0 for the default.

player.setNameplateColor()

setNameplateColor(color)

The plate's colour on all screens.

player.showOverheadText()

showOverheadText(text, durationMs, color, range)

Shows a temporary line above this player's plate for nearby players in their dimension, including themselves, as role-play servers do for /me and /do. Each game draws it as a Nameplates label, and players coming near later do not get it. '' removes it. Returns how many players received it. Throws a TypeError for non-string text or a colour not in 0xAARRGGBB, and a RangeError for over 256 UTF-8 bytes, a duration outside 1 to 3600000 ms, or a range outside (0, 500] metres.

player.getNameplateColor()

getNameplateColor()

The plate's colour, 0xffffffff while untinted.

player.spawn()

spawn(position, rotation)

Places the player. In a playerSpawning handler, this answers that request, and they appear there as their body enters the world, behind the loading screen. At other times it moves a player already in the world. Returns true if accepted, and false for a position not in a world or a player no longer connected.

player.teleport()

teleport(position, label)

Asks the player's client to move them on its next frame. Returns true once sent, and false for a position not in a world or a player no longer connected.

player.getStat()

getStat(stat)

A writable stat's latest reported value in the game's units, or 0 before the first report. Throws for an unknown stat.

player.derivedStat()

derivedStat(stat)

The latest value of a computed stat from DerivedPlayerStat in the game's units, or 0 before the first report.

player.trackOf()

trackOf(track)

Their place on one track, with level, XP toward the next, its cost and unspent points, or null before their client's first report. Throws for an unknown track.

player.hasPerk()

hasPerk(perk)

Whether their last report included the perk, by name or GUID.

player.learnRecipe()

learnRecipe(recipe)

Teaches a smithing or alchemy recipe from Recipe at once, as reading its sketch would, by giving the recipe's perk. Returns true when the order goes out or they know it, and false for a recipe no perk teaches, such as a row a table patch added. Throws for an unknown recipe.

player.forgetRecipe()

forgetRecipe(recipe)

Makes them forget a recipe, removing all perks that teach it. Returns true when an order goes out, and false if they did not know it. Throws for an unknown recipe.

player.knowsRecipe()

knowsRecipe(recipe)

Whether their last report shows the recipe as known. Throws for an unknown recipe.

player.equipment

equipment

Item classes the body wears, 32 hex digits each, and empty for a bare body.

player.rightHandItem

rightHandItem

What the right hand holds: an item class in hex, or '' for nothing.

player.leftHandItem

leftHandItem

What the left hand holds: an item class in hex, or '' for nothing.

player.heldWeapon

heldWeapon

The weapon in the right hand, as their client last reported, by item class GUID as Items.info and Inventory accept. It is '' if that hand holds no weapon, such as when empty or with food or a tool. The game counts a torch as a weapon. Read-only.

player.language

language

Their game's language, such as 'english' or 'czech', which chooses their KCDS texts through Locales. '' until reported.

player.grime

grime

How dirty, bloody and worn the body and each worn piece are, each 0 to 1, as { body: { dirt, blood: { head, torso, leftArm, rightArm, leftLeg, rightLeg } }, items: [{ item, dirt, blood, wear }] }, or null until reported.

player.seated

seated

Whether they sit on one of the game's seats, such as a chair, bench or dice table's chair, which their game holds for them. False until reported.

player.clean()

clean(options)

Washes the body, the worn clothes or both, by default both, in their game, and all players see it. Returns false if they are gone.

player.soil()

soil(options)

Adds dirt and blood, { dirt, blood } from 0 to 1, with { body, clothes }, in their game.

player.setItemLimit()

setItemLimit(item, max)

Sets the most units of an item, by GUID or table name, they can hold, over the server's item config. null clears it. Returns the limit now applying, or null.

player.itemLimit()

itemLimit(item)

The limit on an item now applying to them, or null.

player.setEquippedWeightPercent()

setEquippedWeightPercent(percent)

Sets the percentage of what they wear that counts toward their load, over the server's value. null clears it. Returns the value now applying.

player.equippedWeightPercent

equippedWeightPercent

The percentage of what they wear that counts toward their load: their own value, otherwise the server's.

player.giveItem()

giveItem(item, amount = 1)

Adds items of a class to the inventory the server holds. The amount must be 1 to 10000. Returns false if it is not, if the item is unknown, or if the player has no inventory.

player.showItemNotice()

showItemNotice(item, amount = 1, received = true)

Shows the game's notice of units of a class received or given away, without changing their inventory. The amount must be 1 to 1000000. Returns false if it is not, if the item is unknown, or if they left.

player.takeItem()

takeItem(item, amount = 1)

Takes units of a class across its rows, all or none. The promise is already settled when returned.

player.getInventory()

getInventory()

The same as Inventory.get(player).

player.dropAll()

dropAll(options = {})

Moves their rows, up to 128, into a container at their body, with the reason 'drop'. `keepEquipped` keeps what the body wears or holds. Returns the container, or null if nothing moved.

player.stopFight()

stopFight(opponent)

Ends melee combat between this player and an opponent. Both clients drop their lock, then playerCombatCancelled fires. Returns false for a player who is gone or not playing, the same player, or another dimension.

player.holdItem()

holdItem(item)

Has them carry an item in their arms: a new one, by the name of an item the game has a carrying walk for, or a carryable GroundItem they pick up. Returns false if they cannot act, are riding, already carrying or not playing, or the ground item is out of reach or being taken. The carry takes effect once their client reports it, firing playerCarryItem. Throws for another item name, or one with no walk for their body.

player.dropHeldItem()

dropHeldItem(options = {})

Has them put down the carried item with the game's put-down, or with `immediate`, let go at once. It becomes a carryable GroundItem where it lands. Returns false if they carry nothing.

player.heldItem

heldItem

The name of the item carried in their arms, or null.

player.knockedOut

knockedOut

Whether they lie knocked out after playerDied, and have not been revived.

player.lootable

lootable

Whether others can search their body with the game's Search while they are knocked out. True unless a script says otherwise. Changing it while they are down adds or removes the body's container.

player.setOutfit()

setOutfit(preset)

Dresses the body in one of the game's outfits for their gender. Current clothing comes off and stays in the inventory, and the outfit's is added and worn a moment later. Returns false for an unknown outfit or the other gender's.

player.injuries

injuries

Which limbs are injured, as their game last reported, all false until the first report.

player.hasBuff()

hasBuff(buff)

Whether the player has a status effect, by name or GUID, including your custom buffs.

player.addBuff()

addBuff(buff)

Asks the player's client to apply a status effect, which lands a moment later, firing playerBuffAdded. Returns false for an unknown buff, a player with no world, or the game's unconsciousness, since setHealth(0) and revive() control knock-outs.

player.removeBuff()

removeBuff(buff)

Asks the player's client to remove a status effect: the instances the last report named, otherwise all. Returns false if the buff is unknown or they are not in a world.

player.clearBuffs()

clearBuffs(tag)

Clears all effects of one family from Buffs.tags. Returns false if no buff has that tag or they are not in a world.

player.addXp()

addXp(track, xp, options)

Gives XP on a track through the game's path on their client, so their perks' XP multipliers apply and a level crossed gives its points. Returns true when the order goes out. { notify: false } leaves out the game's notice of levels gained.

player.setLevel()

setLevel(track, level, options)

Sets a track to a level, returning false for one past the cap. A higher level is the game's level-up, with { notify: false } leaving out its notice. A lower one is exact: that level with no XP toward the next, and no reward, point or notice.

player.setXp()

setXp(track, xp)

Sets a track to a total XP from level 0, rounded down to 1/128 XP, and its level follows, up or down. Progression.xpNeeded gives a level's cost. It gives no reward, perk point or notice. Returns false before the first progression report, or for XP past the track's cap. Before 0.3.4, it set XP within the current level.

player.removeXp()

removeXp(track, xp)

Subtracts XP from a track's total as last reported, with its level following down, to zero at least. It gives no notice, and perks and perk points stay. Returns false before the first progression report.

player.addPerk()

addPerk(perk)

Gives a perk outright, with no point spent and no requirement checked by the perk screen.

player.removePerk()

removePerk(perk)

Removes a perk without refunding its point.

player.addPerkPoints()

addPerkPoints(track, count)

Gives unspent perk points in one tree, a track name or 'main'.

player.resetPerks()

resetPerks()

Runs the game's respec, removing perk-screen perks and rebuilding all trees' points.

player.loadProgression()

loadProgression(snapshot, options)

Restores stored progression, raising tracks as the game's level-ups, with { notify: false } leaving out their notice. { exact: true } writes the snapshot as it is, so a track above it comes down too, with no reward, point or notice.

player.setPace()

setPace(mode)

Restricts how the player can move: making walking the pace they fall back to, forbidding running and sprinting, or both. Keys left out are not restricted. Returns true when the rule goes out.

player.setStat()

setStat(stat, value)

Asks their game to set a writable stat. Returns true once sent, and false if the player has no living body.

player.addStat()

addStat(stat, delta)

Adds to a writable stat in their game, and a negative amount lowers it, staying between 0 and the maximum. Bringing health to 0 counts as the game's fatal damage. Returns true when the request goes out.

player.fillStat()

fillStat(stat)

Sets a writable stat to its maximum: full health or stamina, a full night's sleep with 'exhaust', or a full stomach with 'hunger'.

player.setHealth()

setHealth(value, options = {})

Sets health in their game, as setStat('health', value). setHealth(0, { fall: true }) knocks them out with the body dropping at once, where the game's ragdoll otherwise stands it for about half a second. `fall` is refused with any value except 0.

player.setHunger()

setHunger(value)

Sets nourishment, the game's hunger stat, in their game, as setStat('hunger', value).

player.heal()

heal(options = {})

Heals them in the game's way: it applies the buffs remove_injuries and remove_all_posions, stops bleeding, then raises health if it is lower. It does not revive. Returns true when the orders go out.

player.steamId

steamId

Their SteamID, verified, from the KCDS Master pass when the store is Steam. All servers require the pass, so it is set on all of them, listed or not. '' for another store.

player.epicId

epicId

Their Epic Games account id, verified, from the pass if they own the game on Epic. '' for another store. A client's own claim is never accepted.

player.store

store

The store their licence was verified in: 'steam', 'epic', 'xbox' or 'gog'.

player.storeAccount

storeAccount

Their account id in that store, verified through the pass.

player.discordId

discordId

The Discord user signed in to their Discord app, as the client reports it, unverified. '' if Discord is not running.

player.deviceId

deviceId

A SHA-256, 64 hex characters, of their Windows installation id and board UUID, as the client reports it, unverified. '' if unreadable. It recognises a machine but proves nothing.

player.ip

ip

Server only. The IPv4 address their connection came from, useful for bans and finding several accounts on one connection. Several players behind a shared NAT have the same address.

player.ping

ping

Server only. Their round-trip time in milliseconds, smoothed by the transport and refreshed every 2 seconds, or 0 before the first measurement.

player.getIP()

getIP()

Server only. The address their connection came from, the same as `player.ip`.

player.emit()

emit(name, payload)

Server only. Sends an event to this player's game, as Events.broadcast does for all. The client's Events.on(name) handlers get the payload parsed from JSON, up to 32 KB. A string that is JSON text is sent as is, and any other string arrives as that string. Sent before their client resources run, it waits and arrives in order once they do, and playerResourcesReady follows. Returns false if they have left.

player.identifiers

identifiers

Server only. All their identifiers, as { kind, id, verified }. The kinds are 'steam', 'epic', 'xbox' or 'gog', the store account from the pass, verified; 'discord' and 'hardware', reported by the client, unverified; and 'ip', where the connection came from, verified. Kinds they lack are left out. It is frozen, so read it again for the current list.

player.getIdentifier()

getIdentifier(kind)

Server only. Their id of one kind, or '' if they have none. Other kinds throw a TypeError. Base bans on a verified kind, since a changed client can fake 'discord' and 'hardware'.

player.appearance

appearance

Their body's look, as their game last published it.

player.disguise

disguise

The prop mesh their body is drawn as with setDisguise, or null.

player.levels

levels

Each track's level as their game last reported, by track name, with zeros before the first report.

player.health

health

Current health, in the game's units.

player.stamina

stamina

Current stamina.

player.exhaust

exhaust

How rested they are, the game's energy stat.

player.hunger

hunger

How fed they are, the game's nourishment stat.

player.bleeding

bleeding

How strongly they are bleeding, or 0.

player.sleeping

sleeping

The game's sleeping stat, non-zero while asleep.

player.consciousness

consciousness

The game's consciousness stat, 0 while knocked out.

player.drunkenness

drunkenness

How drunk they are.

player.poisoning

poisoning

How poisoned they are.

player.maxHealth

maxHealth

Their highest possible health now.

player.maxStamina

maxStamina

Their highest possible stamina now.

player.staminaCap

staminaCap

The stamina they can reach while healthy, which the game lowers with injuries.

player.maxExhaust

maxExhaust

The maximum of the exhaust stat.

player.maxHunger

maxHunger

The maximum of the hunger stat.

player.level

level

Their main level.

player.strength

strength

Strength as the game evaluates it.

player.agility

agility

Agility as the game evaluates it.

player.vitality

vitality

Vitality as the game evaluates it.

player.healthPercent

healthPercent

Health against its maximum, 0 to 100, as a plate's health bar shows.

player.alive

alive

Whether they have health left. False until their game's first report.

player.ableToAct

ableToAct

Whether their body can do anything: alive, conscious, not asleep and not knocked out.

player.skills

skills

Levels of the game's nine skills, by name.

player.scaledSkills

scaledSkills

The nine skills as the engine's relative values rather than levels.

player.inAir

inAir

Whether the body is off the ground, jumping or falling.

player.crouched

crouched

Whether the body is crouched.

player.guard

guard

1 while they hold their guard in combat, otherwise 0.

player.guardUp

guardUp

Whether their weapon or fists are raised.

player.physicsProfile

physicsProfile

The body's physics profile, a number from the game, or 255 if none is reported.

player.fightZone

fightZone

The combat star direction they aim at, a row of the game's zone table, or -1.

player.buffs

buffs

Status effects on their body as their game last reported, plus your custom buffs.

player.perks

perks

All perks they own, by name.

player.progression

progression

Their whole progression as plain JSON, which loadProgression takes, or null before their game's first report. Store it to restore a returning player's levels.

player.scaledStats

scaledStats

Strength, agility and vitality as the engine's relative values.

player.visorDown

visorDown

True while their helmet visor is closed, according to their client, and false with no visor helmet or body. Scripts can only read it, on both sides, for any player they know, and only the player can open or close it.

player.visible

visible

Whether their body is drawn at all, as their client publishes it, so false a moment after setVisible(false) reached them. Client scripts can read it for all players they know, including the local one. A hidden player still stands, collides and can be hit.

player.dimension

dimension

Their dimension, read-only. Change it with setDimension.

player.position

position

Their location in world coordinates. Assigning a Vector3 moves them.

player.velocity

velocity

The body's speed and direction, measured by their game, and zero until reported.

player.gaze

gaze

The direction their head and eyes are turned, and zero until reported.

player.rotation

rotation

The direction they face, as a Quaternion. Assigning Euler degrees or a Quaternion turns them.

player.setLockable()

setLockable(targetable)

Client only. Sets whether combat targeting on this computer can pick another player, which helps for someone lying wounded. It changes only this client, so send it to all clients to apply it to everyone. If this client is locked on that player, the lock ends. Attacks can still connect, so refusing damage is up to the server. It holds until changed or the session ends. Throws a TypeError for a non-boolean.

player.nickname

nickname

The name the player joined with.

player.playerIndex

playerIndex

The player's connection slot. Unlike `id`, it is reused after they leave.

player.ready

ready

Whether their body is in the world. False while loading.

player.local

local

True if this object is the local player.

player.entityId

entityId

Client only. The player's engine entity on this machine, or 0 before it exists.

player.renderPosition

renderPosition

Client only. Where this machine draws the player's body now. Another player's position moves in steps as updates arrive, 40 to 150 ms apart, while the game draws the body smoothly, so use this for anything drawn on the body. Null before the body is here.

player.jointPosition()

jointPosition(joint)

Client only. Where this machine draws a joint now, in the world, by biped name, such as 'Bip01 Head' or 'Bip01 R Hand', or game name, such as 'Head' or 'RightHand'. Null if the body or joint is not here, and an empty or non-string name throws a TypeError.

player.horseId

horseId

The network id of the horse they ride, or 0 on foot.

player.movePace

movePace

Client only. The pace tag this machine's animation system chose for the body, a raw tag id, or 255 for none.

player.moveDirection

moveDirection

The movement-direction tag this machine's animation system chose for the body, a raw tag id, or 255 for none.

player.bodyStance

bodyStance

The stance tag this machine's animation system chose for the body, a raw tag id, or 255 for none. A seated player has the sitting stance, even if the animation set none.

player.state

state

Their shared state: values your resources attach to them, sent according to each key's scope.

player.id

id: number

The network id, unique while the server runs and never reused.