Variable Modification - TheComputerGeek2/MagicSpells GitHub Wiki
- These options are documented in base spell configuration.
-
type
can becast
,casted
, andtarget
(modifies target's variables unless since 4.0 Beta 13 this format is used:caster:varName <varMod>
). - The format:
variable-mods-<type>:
- varName1 <assignment>
- varName2 <assignment>
. . .
Format: /ms variable modify <variable> <player> <assignment>
.
For this example we'll use the always
condition, which passes always because in this case, we don't need a condition.
# The following two are the same because the default variable owner is "caster".
modifiers:
- always variable varName;<assignment>
- always variable caster:varName;<assignment>
# This supports "target" variable owner. Note that target modifiers only work on targeted spells.
target-modifiers:
- always variable target:varName;<assignment>
- always variable caster:varName;<assignment>
The format for this is: <operator><expression>
(e.g. =42
, or +1
- add 1 to base value).
-
expression
can be text of any length you'd like if it's not a variable name. Supports the=
assignment operator.
Warning
The rest of documentation about this section is only possible since 4.0 Beta 13.
-
expression
may be a String Expression. -
operator
:-
=
- Set the variable to what expression is. -
+
- Append expression text to the variable's current value. -
*
- Set the variable to what the current value is then repeated as many times as the expression defines. Thus, the expression should evaluate into a number for this operation. If it's a plain string, the variable will be set to empty.
-
-
expression
may be a double value or a variable name. -
operator
can be:-
=
- Set base value to the expression following the operator. -
+
- Default operator if omitted. Add expression to the base value. Note that there is no-
operator, but subtraction is possible because you can negate expressions, and addition is default behaviour - therefore subtraction. -
*
- Multiply base with the expression. -
/
- Divide base with the expression. -
^
- Exponentiation, where the expression is the exponent. -
%
- Modulo operator - returns the remainder after dividing base with the expression. -
?
- A pseudorandom number generated from 0 (inclusive) to the expression value.
-
-
-
can be used before the expression to negate it.
Warning
The rest of documentation about this section is only possible since 4.0 Beta 13.
-
expression
may be a Function Expression. - If
expression
is a variable name it may be prepended withtarget:
to refer to the target's variable value for assignment (e.g.+target:meta_current_health
).