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
| Field | Type | Default | Description |
|---|---|---|---|
resource | Identifier | The apoli:resource or apoli:cooldown power to modify. Any power with a built-in cooldown also works — see below. | |
modifier | Attribute Modifier | set_base of 0 | The 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. |
position | Integer OR Expression | optional | Which slot of a table resource to modify. Omit it on a table and every slot is modified. Also aliased as index and slot. |
from | Identifier | optional | Copy from this resource instead of computing a value from the modifier. Also aliased as from_resource. |
from_position | Integer OR Expression | optional | Which 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 write | What happens |
|---|---|
position set | only that slot is modified |
position omitted | the 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
positionnorfrom_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_positiononly, that source slot is copied into the same-numbered destination slot. - With both, the copy goes from
from_positiontoposition. - The modifier’s
operationstill applies, soadd_base_earlyadds the source value into the destination instead of overwriting it. The default isset_base— a straight copy.
A single-slot copy is also expressible as an Expression —
{ "operation": "set_base", "value": "example:live[2]" }.fromexists 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 field | Translated into | Notes |
|---|---|---|
change (Integer) | modifier.value | The numeric amount to add/set. |
operation ("add") | modifier.operation = add_base_early | The 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"
}