Stats
“Stat” means a number of a plugin or of the game that a player sees: the maximum health an item gives, a critical chance, the kills an achievement counts, the experience of a skill tree. The values stay where they live (an attribute, an item trait, an achievement counter). The stat register only says how each one is named and written, so tooltips, menus, the docs and the debugger show the same name and format for it everywhere.
Every stat is a gameplay tag below Pulse.Stat (the root lives in Pulse Foundation, with the four stats of its attributes). Plugins register their stats when their module starts, and a project adds its own in the project settings.
Entries
| Field | What it is |
|---|---|
Tag | The stat (Pulse.Stat.MaxHealth). |
DisplayName | Name for the player (“Maximum health”). Empty: the last part of the tag with spaces (“Max Health”). |
Description, Category | What it means and its group (“Combat”, “Survival”), for stat screens and the docs. |
Icon | Texture or material for menus and tooltips (soft reference). |
Kind | Value (a number with decimals and unit), Percent (percent points: 25 is written “25 %”) or Counter (a whole number that counts up, written with digit grouping). |
Decimals | Digits after the decimal point of a Value or Percent (0 to 3). |
Unit | Written after the number of a Value or Counter (“/s”, “cm”). |
Plugin | Who registered it; empty for entries of the project. |
A plugin registers a stat in StartupModule of the module that owns the number and removes it in ShutdownModule:
FPulseStatEntry stat;
stat.Tag = TAG_StatHealthRegen;
stat.DisplayName = LOCTEXT("HealthRegen", "Health regeneration");
stat.Category = LOCTEXT("Survival", "Survival");
stat.Kind = EPulseStatKind::Value;
stat.Decimals = 1;
stat.Unit = LOCTEXT("PerSecond", "/s");
stat.Plugin = TEXT("PulseGameplay");
Pulse::Stats::RegisterStat(stat);
Stats of the project
Project Settings > Pulse > Foundation > Stats holds the entries of the project: stats of the game (its own tags below Pulse.Stat) and entries that replace the name, icon or format of a stat of a plugin (same tag). Registered Stats below it lists the stats of the enabled plugins (read only), to copy a tag from.
Reading
| C++ | Blueprint | What it answers |
|---|---|---|
Pulse::Stats::Find(Tag, OutStat) | Find Stat | The entry: the one of the project, else the one of a plugin |
Pulse::Stats::GetDisplayName(Tag) | Get Stat Display Name | The name, or the last part of the tag for a tag without an entry |
Pulse::Stats::FormatValue(Tag, Value, bShowSign) | Format Stat Value | The value as its entry says; bShowSign writes “+” in front of positive values (bonuses of items). A tag without an entry is written as a Value without decimals |
Pulse::Stats::GetStats() | Get Stats | Every stat of the plugins and the project, sorted by category and tag |
Pulse.Stats.List prints every stat with kind, decimals, unit, name, category and who describes it (Console).
Stats of the Pulse plugins
| Stat | Kind | Plugin | What it is |
|---|---|---|---|
Pulse.Stat.Health | Value | PulseFoundation | Health, an attribute of the Foundation (“Health”) |
Pulse.Stat.MaxHealth | Value | PulseFoundation | Maximum health (“Max Health”); items of PulseInventoryEffects raise it while they are equipped |
Pulse.Stat.Stamina | Value | PulseFoundation | Stamina (“Stamina”) |
Pulse.Stat.MaxStamina | Value | PulseFoundation | Maximum stamina (“Max Stamina”); items of PulseInventoryEffects raise it as well |
Pulse.Stat.MaxShield | Value | PulseGameplay | Maximum shield |
Pulse.Stat.HealthRegen | Value, 1 decimal, “/s” | PulseGameplay | Health regeneration per second |
Pulse.Stat.StaminaRegen | Value, 1 decimal, “/s” | PulseGameplay | Stamina regeneration per second |
Pulse.Stat.DamageBonus | Percent | PulseGameplay | More damage dealt (PulseCombatInventory) |
Pulse.Stat.DamageReduction | Percent | PulseGameplay | Less damage taken |
Pulse.Stat.CriticalChance | Percent | PulseGameplay | Chance of critical hits |
Pulse.Stat.Resistance.Physical, .Fire, .Frost, .Lightning, .Poison, .Magic | Percent | PulseGameplay | Less damage of one type |
Pulse.Stat.Hunger, Pulse.Stat.Thirst | Value | PulseSurvival | The hunger and thirst bars |
The four stats of the Foundation are registered once, by Pulse Foundation: PulseInventoryEffects still defines the tags Pulse.Stat.MaxHealth and Pulse.Stat.MaxStamina for its items, but no longer registers them, so the entries stay when one of the modules shuts down and Pulse.Stats.List shows each stat once. Plugins that bring more attributes (shield, hunger, armor) register those stats themselves.
Counters of a game (the kills an achievement counts, the experience of a progression) are tags of the game; describe them in the project settings with the kind Counter. Pulse Skill registers the experience of each progression asset as a counter when it is loaded (Pulse Skill).