Lua API

Trait module

Functions for working with traits.

Currently only the player can have traits.

Usage

local Trait = ELONA.require("core.Trait")

Functions

level (trait_id) Obtains the player's level in a trait.
min (trait_id) Obtains the minimum possible level of a trait.
max (trait_id) Obtains the maximum possible level of a trait.
set (trait_id, level) Sets the level of a trait, bounded within its min and max.
modify (trait_id, delta) Modifies the level of a trait, bounded within its min and max.

Functions

# level (trait_id)

Obtains the player's level in a trait.

It may be negative if the trait is harmful.

Parameters:
  • trait_id : (num) the trait id
Returns:
  • (num) the player's trait level
Or
# min (trait_id)

Obtains the minimum possible level of a trait.

Parameters:
  • trait_id : (num) the trait id
Returns:
  • (num) the trait's minimum level.
Or
# max (trait_id)

Obtains the maximum possible level of a trait.

Parameters:
  • trait_id : (num) the trait id
Returns:
  • (num) the trait's maximum level.
Or
# set (trait_id, level)

Sets the level of a trait, bounded within its min and max.

Parameters:
  • trait_id : (num) the trait id
  • level : (num) the new trait level
# modify (trait_id, delta)

Modifies the level of a trait, bounded within its min and max.

Parameters:
  • trait_id : (num) the trait id
  • delta : (num) the amount to change the trait level by