Skip to content

Skill Management

Unturned tracks each player's skills and experience through the game's skill system. RocketMod exposes four methods on UnturnedPlayer for working with skills, plus an Experience property for reading and writing the player's experience balance. The finer-grained skill data model (categories, the Skill struct, the PlayerSkills component) lives in the SDG.Unturned layer, not in the RocketMod API surface, so this article covers only the RocketMod endpoints you can call directly.

This article documents the UnturnedPlayer skill methods, the Experience property, and the UnturnedSkill class that exists in the RocketMod namespace.

Prerequisites

  • Articles 1 through 7 (Fundamentals track), especially article 6 (Event Subscription and Lifecycle) for event-driven skill management.
  • Article 29 (Join Validation and Connection Filtering) for context on player lifecycle timing.

What you will learn

  • The four skill-related methods on UnturnedPlayer: GetSkill, GetSkillLevel, SetSkillLevel, and MaxSkills.
  • How to read and set a player's experience through the Experience property.
  • That the UnturnedSkill class exists in Rocket.Unturned.Skills.

UnturnedPlayer skill methods

The UnturnedPlayer class (namespace Rocket.Unturned.Player) exposes four methods for working with player skills. The parameter signatures below reflect the return types visible in the API surface; full parameter lists are drawn from the SDG.Unturned layer and are not captured here.

MethodReturn typeWhat it does
GetSkill(Skill)SkillReturns a Skill reference for the player. The Skill type comes from the SDG layer.
GetSkillLevel(byte)byteReturns the current level of a skill as a byte value.
SetSkillLevel(void)voidSets the level of a skill for the player.
MaxSkills(void)voidMaximises all of the player's skills in one call.

These are the only skill-related members on UnturnedPlayer confirmed present in the RocketMod API surface. There is no EPlayerSkill enum, no PlayerSkills component, and no skills array in the RocketMod surface -- those belong to the SDG.Unturned layer.

Basic usage

csharp
using Rocket.Unturned.Player;

UnturnedPlayer player = UnturnedPlayer.FromName("Notch");
if (player == null)
    return;

// Read a skill (returns a Skill object from the SDG layer)
var skill = player.GetSkill(/* Skill parameter */);

// Read a skill level (returns a byte)
byte level = player.GetSkillLevel(/* byte parameter */);

// Set a skill level
player.SetSkillLevel(/* parameters */);

// Max all skills
player.MaxSkills();

The Skill parameter on GetSkill, and the Skill return type, both refer to a type in the SDG.Unturned layer. This type is not present in the RocketMod API surface, so its members (level, name, etc.) are not documented here.

Experience property

UnturnedPlayer has an Experience property you can read and write directly:

PropertyTypeDescription
ExperienceuintThe player's current experience point balance. Readable and writable.
csharp
using Rocket.Unturned.Player;

UnturnedPlayer player = UnturnedPlayer.FromName("Notch");
if (player == null)
    return;

// Read experience
uint currentXp = player.Experience;

// Set experience
player.Experience = 5000;

// Grant experience
player.Experience += 250;

Unlike the skill methods, Experience is a plain property. RocketMod does not expose helper methods such as GrantExperience, DeductExperience, or SetExperience -- you manipulate the property directly.

UnturnedSkill class

The Rocket.Unturned.Skills namespace contains an UnturnedSkill class at Rocket.Unturned/Skills/UnturnedSkill.cs. The API surface extraction confirms the class exists but does not list any methods, properties, or events on it. Its role relative to the UnturnedPlayer skill methods is not fully captured by the surface.

Edge cases

Player not found

UnturnedPlayer.FromName(string) returns null when no player matches. Always check for null before calling skill methods:

csharp
UnturnedPlayer player = UnturnedPlayer.FromName("Notch");
if (player == null)
{
    Rocket.Core.Logging.Logger.Log("Player not found.");
    return;
}

Player not spawned

The UnturnedPlayer.Player property accesses the underlying player GameObject. Early in the connection lifecycle (during OnBeforePlayerConnected or immediately after OnPlayerConnected), the player's character may not have spawned yet and Player may be null. Delay skill access until the character is ready.

Frequently asked questions

Do skill changes persist across server restarts?

Yes. Unturned saves player data -- including skills and experience -- to the player's character save file. Changes made through the UnturnedPlayer methods are included in that save.

Can I modify skills for an offline player?

Not through the UnturnedPlayer API. The UnturnedPlayer object exists only for players currently connected to the server. Offline skill modification would require editing the player's save file directly, which is a binary format that changes between Unturned versions.

Cross-references

What changed in this revision

  • Removed the EPlayerSkill enum and skill categories table (type not found in RocketMod API surface).
  • Removed the PlayerSkills component access chain (player.Player.skills), Skill struct field descriptions, and SendSkill/SendExperience methods (all SDG.Unturned types, not in RocketMod API surface).
  • Removed invented helper methods: GrantExperience, DeductExperience, SetExperience, GetExperience, ApplyPreset, ResetSkills, CalculateTotalExperienceSpent, EnforceSkillCaps, FormatSkillSummary.
  • Removed the SkillIndices helper class, SkillCapsConfiguration, and SkillPreset types (all invented, not in API surface).
  • Removed the skill preset command example (used R.Permissions.HasPermission which does not exist on the R class in the real API).
  • Removed the IsConnected edge case guard (IsConnected is not a property on UnturnedPlayer in the API surface).
  • Removed the experience overflow guard (referenced skills.experience, an SDG type not in the RocketMod surface).
  • Removed FAQ entries relying on EPlayerSkill or unverifiable skill data model claims.
  • Retained and documented only the four confirmed UnturnedPlayer skill methods, the Experience property, and the UnturnedSkill class.