Math Resource

Power Type

Provides a variable who's value is given by the value of the provided Expression.

Type ID: origins-math:math_resource

Warning

Expression values can be stored as a Float, but Resources have to be stored as an Integer. Therefore, you should be cautious when using this power as a resource, as the value will have it's decimal counterpart removed, effectively being truncated, when doing so.

If you are using this resource as a variable to either the Math Resource (Power Type) or the Variable Change Resource (Entity Action Type), then it's Float counterpart is used instead.

Fields

Field Type Default Description
expression Expression The mathematical expression that gives the value of this resource.
variables Variable Declaration optional A variable declaration declaring variables used in the expression.

Examples

{
    "type": "origins-math:math_resource",
    "expression": "9 + 10"
}

This example will use the resulting value of 9 + 10 as it's value, which is 19.

{
    "type": "origins-math:math_resource",
    "expression": "2(abs(amplifier))",
    "variables": {
        "amplifier": "origins-math:my_awesome_resource"
    }
}

This example will use the resulting value of 2(abs(amplifier)) as it's value, with the value of amplifier being the value of the origins-math:my_awesome_resource resource.