Attribute Definitions
Character attribute definition system for the Lilia framework.
Overview
The attribute system provides functionality for defining character attributes within the Lilia framework. Attributes represent character statistics that can be modified, boosted, and used in gameplay calculations. The system includes automatic attribute loading from directories, localization support for attribute names and descriptions, and hooks for custom attribute behavior. Attributes can be configured with maximum values, starting limits, and whether they appear in character creation. The system supports attribute boosts through the character system and validation through callback methods that are automatically invoked during character setup.
name
đ Purpose
Sets the display name of the attribute
â° When Called
During attribute definition
đĄ Example Usage
desc
đ Purpose
Sets the description of the attribute that appears in tooltips and UI
â° When Called
During attribute definition
đĄ Example Usage
maxValue
đ Purpose
Sets the maximum value this attribute can reach
â° When Called
During attribute definition (used by GetAttributeMax hook)
đĄ Example Usage
startingMax
đ Purpose
Sets the maximum value this attribute can have during character creation
â° When Called
During attribute definition (used by GetAttributeStartingMax hook)
đĄ Example Usage
noStartBonus
đ Purpose
Prevents this attribute from appearing in character creation attribute allocation
â° When Called
During attribute definition (checked in character creation UI)
đĄ Example Usage
OnSetup
đ Purpose
Hook function called when setting up attributes for a character
â° When Called
When a character spawns or when their attributes are initialized
đ Realm
Server
âī¸ Parameters
| Parameter | Type | Description |
|---|---|---|
client |
Player | The client whose character is being set up |
value |
number | The current attribute value |
âŠī¸ Returns
- None
đĄ Example Usage
function ATTRIBUTE:OnSetup(client, value)
local char = client:getChar()
if not char then return end
-- Set default attribute value if not already set
if value == 0 then
char:setAttrib(self.uniqueID, 10)
end
end