Skip to content

A. Defining Character Attributes

Ketei edited this page Nov 21, 2025 · 1 revision

I. Purpose

Character attributes refer to Stats, Skills and Traits declared inside of their respective scripts which will become available for use in two tools of Nexus Forge: Characters and Species.

When an attribute is declared correctly and the relevant script is saved (Ctrl + S), all new attributes will appear in their respective sections.


II. Defining Stats

To define stats you need to open the StatBlock[1] script; In there you need to declare variables and they need to fulfill 3 requirements:

  1. It needs to be a variable declaration, not a constant.
  2. It needs to have an export flag. 2 common export flags are @export and @export_storage.
  3. It needs to be a typed variable, the type being either RangeInt or RangeFloat.

Example of valid stats:

@export var health: RangeInt
@export_storage var stamina: RangeFloat
@export var mana: RangeInt = RangeInt.new() # Initialized on declaration

Note

Not initializing an object will initialize it with a value of null. This is harmless when the object is only used for character sheets but if you need to make sure new StatBlock objects have all their range variables initialized pass true on the constructor: StatBlock.new(true)

Here is an example of variables declared that will NOT appear in the GUI as they are not considered "valid".

const health: RangeInt = RangeInt.new() # This is a constant, not a variable.
var stamina: RangeFloat # This doesn't have an export flag
@export var mana = RangeInt.new() # The variable isn't typed to RangeInt

III. Defining Skills

To define traits you need to open the SkillSet[2] script; In there you need to declare variables that fulfill 3 requirements:

  1. It needs to be a variable declaration, not a constant.
  2. It needs to have an export flag.
  3. It needs to be a typed integer variable.

Example of valid skills:

@export var acrobatics: int
@export_storage var medicine: int
@export var persuasion: int = 1

Example of invalid skills:

@export var acrobatics: float # This variable declared as a float number
@export_storage var medicine # Variable type not declared
var persuasion: int = 1 # Variable missing the export flag.

Tip

Initializing a skill with a value will also make that the "default" value for the Nexus Forge editor.


IV: Defining Traits

Traits are defined exactly the same as skills bit in the TraitBlock[3] script. They must also fullfil the same requirements:

  1. It needs to be a variable declaration, not a constant.
  2. It needs to have an export flag.
  3. It needs to be a typed integer variable.

Example of valid traits:

@export var cold_resist: int
@export_storage var night_vision: int
@export var damage_mitigation: int = 1

Example of invalid traits:

@export var cold_resist: float # This variable declared as a float number
@export_storage var night_vision # Variable type not declared
var damage_mitigation: int = 1 # Variable missing the export flag.

Tip

Initializing a trait with a value will also make that the "default" value for the Nexus Forge editor.


V. Footnotes

  1. StatBlock script default path: res://addons/nexus_forge/resources/stat_block.gd.
  2. SkillSet script default path: res://addons/nexus_forge/resources/skill_set.gd.
  3. TraitBlock script default path: res://addons/nexus_forge/resources/trait_block.gd.

Clone this wiki locally