Modify Resource (Entity Action Type)

Modifies the value of a Resource or Cooldown via an Attribute Modifier.

Modifies the value of a apoli:resource or apoli:cooldown via an Attribute Modifier.

Type ID: apoli:modify_resource (type-aliases: apoli:change_resource, origins:change_resource — the legacy change/operation fields are translated automatically)

Fields

FieldTypeDefaultDescription
resourceIdentifierThe apoli:resource or apoli:cooldown power to modify. Any power with a built-in cooldown also works — see below.
modifierAttribute Modifierset_base of 0The modifier to apply to the current value of the target power. When from is set, only the modifier’s operation is used, and the incoming value is the source slot.
positionInteger OR ExpressionoptionalWhich slot of a table resource to modify. Omit it on a table and every slot is modified. Also aliased as index and slot.
fromIdentifieroptionalCopy from this resource instead of computing a value from the modifier. Also aliased as from_resource.
from_positionInteger OR ExpressionoptionalWhich slot of from to read. Also aliased as from_index and from_slot.

Working on a table resource

When resource names a apoli:resource with a size above 1:

What you writeWhat happens
position setonly that slot is modified
position omittedthe modifier runs on every slot
"entity_action": {
  "type": "apoli:modify_resource",
  "resource": "example:table",
  "position": 2,
  "modifier": {
    "operation": "set_base",
    "value": 5
  }
}

position is an Expression, so the slot can be computed at run time — "position": "example:cursor" writes wherever another resource points.

Copying resources

from copies a value across instead of computing one:

"entity_action": {
    "type": "apoli:modify_resource",
    "resource": "example:backup",
    "from": "example:live"
}
  • With neither position nor from_position, the whole table is copied slot for slot (stopping at whichever of the two is shorter). On scalar resources that is a plain copy of the single value.
  • With from_position only, that source slot is copied into the same-numbered destination slot.
  • With both, the copy goes from from_position to position.
  • The modifier’s operation still applies, so add_base_early adds the source value into the destination instead of overwriting it. The default is set_base — a straight copy.

A single-slot copy is also expressible as an Expression{ "operation": "set_base", "value": "example:live[2]" }. from exists because a whole-table copy would otherwise need one action per slot.

Modifying a power’s cooldown

resource accepts any power type that carries a cooldown field, not just Resource and Cooldown powers — the value it reads and writes is the remaining ticks (0 = ready). The full list is on the apoli:resource condition page. Writes are clamped to 0 … cooldown, so this is how a data pack shortens or clears an ability’s cooldown:

"entity_action": {
  "type": "apoli:modify_resource",
  "resource": "example:dash",
  "modifier": {
    "operation": "set_base",
    "value": 0
  }
}

Legacy field schema (Change Resource compat)

For back-compat with packs that target Apace’s apoli:change_resource, this action also accepts the legacy field shape on the same id:

Legacy fieldTranslated intoNotes
change (Integer)modifier.valueThe numeric amount to add/set.
operation ("add")modifier.operation = add_base_earlyThe default.
operation ("set")modifier.operation = set_base

If modifier is present in the JSON it wins; the legacy shim only fires when modifier is absent and at least one of change / operation is present. This means it’s safe to migrate a pack file-by-file — both schemas coexist on the same type id.

Examples

Add 1 to a resource (canonical):

"entity_action": {
  "type": "apoli:modify_resource",
  "resource": "example:1st_resource",
  "modifier": {
    "operation": "add_base_early",
    "value": 1
  }
}

Set the value of resource A to the current value of resource B (no nesting needed — resource on the inner modifier reads the source):

"entity_action": {
    "type": "apoli:modify_resource",
    "resource": "example:1st_resource",
    "modifier": {
        "operation": "set_base",
        "resource": "example:2nd_resource"
    }
}

Increase a resource by an Expression that scales with the player’s XP level:

"entity_action": {
    "type": "apoli:modify_resource",
    "resource": "example:mana",
    "modifier": {
        "operation": "add_base_early",
        "value": "5 * xp_level"
    }
}

Legacy apoli:change_resource (or origins:change_resource) — still works unmodified:

"entity_action": {
    "type": "apoli:change_resource",
    "resource": "namespace:example",
    "change": 1,
    "operation": "add"
}