Stats Entity
The stats entity defines custom statistics for players and NPCs beyond traditional HP/MP, enabling fully customizable attribute systems.
Managing stats in the admin panel
Stats are in the Users section of the admin sidebar, under Stats (/reldens-admin/stats). The values of each player are in Users > Players Stats, and the values of each object in Game Objects > Objects - Stats:
To create a stat:
- Log in to the admin panel at /reldens-admin and open Users > Stats.
- Click Create New (the form opens at /reldens-admin/stats/edit).
- Fill in the Key (required and unique, for example stamina). Modifiers reference the stat by this key, for example stats/stamina.
- Fill in the Label (required, the name shown to the players) and the Description (required).
- Fill in the Base Value (required), the starting value.
- Optionally fill in the CustomData JSON, for example {"showBase":true} to display the value with its base value, as the default hp and mp stats do.
- Click Save and restart the server, the stats are loaded on startup.
In the form, r marks a required field and u a field that must be unique. Every player created after the stat exists gets it with the base value; the players created before need their row added in Users > Players Stats. To show the stat as a bar in the game UI, see Stat Bars Configuration.
Key Properties
- key: Unique stat identifier (e.g., 'attack', 'defense', 'speed')
- label: Display name
- description: Stat description
- base_value: Default starting value
- customData: JSON custom configuration
Custom Stats System
Reldens is not limited to traditional RPG stats. Create any stat you need:
- Combat: attack, defense, aim, dodge, critChance
- Resources: hp, mp, stamina, energy
- Attributes: strength, dexterity, intelligence, vitality
- Skills: mining, fishing, crafting, cooking
- Resistances: fireRes, iceRes, poisonRes
- Custom: Any stat your game requires
Stat Values
Stats can be modified through:
- Base Value: Initial value from stats entity
- Level Modifiers: Applied on level up
- Equipment: Bonuses from equipped items
- Skills: Temporary or permanent effects
- Buffs/Debuffs: Time-limited modifications
Property Path Support
Stats support nested property paths using '/' separator:
- stats/combat/attack
- stats/combat/defense
- stats/resources/hp
- stats/attributes/strength
Common Stat Examples
- hp: Health points (base_value: 100)
- mp: Magic/mana points (base_value: 50)
- stamina: Stamina/energy (base_value: 100)
- atk: Attack power (base_value: 10)
- def: Defense power (base_value: 5)
- mgAtk: Magic attack (base_value: 10)
- mgDef: Magic defense (base_value: 5)
- aim: Accuracy/aim (base_value: 50)
- dodge: Dodge chance (base_value: 30)
- speed: Movement/attack speed (base_value: 100)
Modifier Integration
Stats work seamlessly with the @reldens/modifiers system:
- Modifiers target stats by key or property path
- Operations: INC, DEC, MUL, DIV, INC_P, DEC_P, SET
- Conditional modifiers based on stat values
- Revertible operations for temporary effects
Database Relations
- players_stats: Player stat values
- objects_stats: NPC stat values
Package
Stat system integrated with @reldens/modifiers and @reldens/skills packages.
reldens