Network Variable Add
Description
Adds an amount to a number network variable. The proxy adds the amount to the stored value, so adds from several servers add up instead of overwriting each other. A variable that is not set starts at 0. How the new total reaches the servers is explained in Reading and Writing, and the rare cases where an add is lost in Conflicts and Clocks.
This mechanic requires MythicMobs Premium!
Attributes
| Attribute | Aliases | Description | Default |
|---|---|---|---|
| amount | a, value, val, v | The number to add, negative to subtract. Placeholders and math work, such as amount=<skill.var.damage-amount>*2 |
1 |
It also takes var, scope, type, duration and save, see networkVariableSet. It runs once per target, see Targets.
Type Attribute
type must be INTEGER (the default), LONG, FLOAT or DOUBLE.
- The add stores its result with its own type, whatever the variable held before. Use the same
typeon every add to a variable: an add withouttype=DOUBLEturns a DOUBLE variable into an INTEGER. - INTEGER and LONG drop the decimals, so
1plus1.5gives2. - If the variable holds something that is not a number, the add starts from
0and replaces it. - A total above 2147483647 does not fit INTEGER, and the servers ignore it. Use LONG for counters that can grow that large.
Examples
Each boss kill adds 1 to the network-wide boss_kills and to the killer's own bosses_slain. The second line has no targeter, so it targets the killer.
NetworkBoss:
Type: ZOMBIE
Skills:
- networkVariableAdd{var=boss_kills;amount=1} @self ~onDeath
- networkVariableAdd{var=bosses_slain;scope=target;amount=1} ~onDeath
Aliases
- netvaradd
- addnetvar
- networkAddVariable