Modding - Smart Value

Smart Values
Smart values differ from regular values in how their syntax and how they are configured in the config files. They allow to apply several multipliers on a base value, which allows to more easily re-use values when used with Inheritance (see Configuration File Structure for more info about inheritance)

armor: { health: { base: 100 } } armor-tier1: { health: { tier1-mul: 1 } } armor-tier2: { health: { tier2-mul: 1.8 } } base-armor: { parents: [ "armor" ] } light-armor: { parents: [ "armor" ] health: { light-mul: 0.85 } } heavy-armor: { parents: [ "armor" ] health: { light-mul: 1.25 } } The example above defines several armor "archetypes" and "tiers". The "health" parameter here is a smart value, and so instead of assigning it a simple number, it is an object, and each member of that object is a number. starwood-armor: { parents: [ "light-armor", "armor-tier1" ] } We can now define "starwood-armor" like shown above, which will have it inherit both the attributes of "light-armor" and those of "armor-tier1". starwood-armor: { health: { base: 100 // inherited from "armor", since "light-armor" inherits from "armor" light-mul: 0.85 // inherited from "light-armor" tier1-mul: 1 // inherited from "armor-tier1" } } When parsing the configuration file, the above is what "starwood-armor" would compile to. The "health" object will have several values, inherited from all its parents. Since "health" is a smart value, these values are then multiplied with each other to produce the final result - which would be 85. starwood-armor: { health: 85 } You could just enter the value directly like this, and it would work just as well. However, using smart values allows you to easily make global changes, like changing the light-armor multiplier from 0.85 to 0.75, without having to change all the individual armor sets. Smart values can be assigned simple values if you prefer.