Player data
ReadyMainCharacter exposes the synchronized state of a player character as a set of small, focused properties and methods, grouped by topic below.
important
Writing to any of these properties only works on an entity you own — see Ownership. Attempting to write to a player you don't own logs an error and does nothing.
Info
PlayerId playerId = player.PlayerId;
string nickname = player.Nickname;
Vitals
bool isDead = player.IsDead;
float hp = player.Hp;
player.Hp = 100f;
float magicka = player.Magicka;
player.Magicka = 50f;
float fatigue = player.Fatigue;
player.Fatigue = 75f;
Movement
Vector3 location = player.Location;
player.Location = new Vector3(0, 0, 0);
Vector3 rotation = player.Rotation;
player.Rotation = new Vector3(0, 90, 0);
Attributes and effects
Attributes, active effects, and social stats are read and written by key, using the CharacterAttribute, CharacterEffect, and CharacterSocialAttribute enums.
float strength = player.GetAttribute(CharacterAttribute.Strength);
player.SetAttribute(CharacterAttribute.Strength, 60f);
float resistFire = player.GetEffectValue(CharacterEffect.ResistFire);
player.SetEffectValue(CharacterEffect.ResistFire, 25f);
float bounty = player.GetSocialAttribute(CharacterSocialAttribute.Bounty);
player.SetSocialAttribute(CharacterSocialAttribute.Bounty, 0f);
Appearance
CharacterSex sex = player.Sex;
player.Sex = CharacterSex.Female;
Animation and status
These are read-only flags reflecting the character's current in-game state.
bool weaponDrawn = player.Animation.WeaponDrawn;
bool isRunning = player.Animation.IsRunning;
bool isSneaking = player.Animation.IsSneaking;
bool isSwimming = player.Animation.IsSwimming;
bool isJumping = player.Animation.IsJumping;
bool isBlocking = player.Animation.IsBlocking;
bool isStaggered = player.Animation.IsStaggered;
bool isFalling = player.Animation.IsFalling;
bool isDodging = player.Animation.IsDodging;
bool inCombat = player.InCombat;
bool inDialogue = player.InDialogue;
Equipment and inventory
Items are identified by their FormId.
player.AddItemToInventory(itemId, 1);
player.RemoveItemFromInventory(itemId); // removes all instances
player.RemoveItemFromInventory(itemId, 3); // removes up to 3
player.ClearInventory();
bool hasTorch = player.HasTorchEquipped;
bool hasQuiver = player.HasQuiverEquipped;
int arrows = player.ArrowCount;