Skip to main content

Run Function (Entity Action Type)

Runs an apoli:function power by ID and passes it arguments.

Type ID: apoli:run_function

The entity doesn't need to hold the function power. The ID is looked up in the loaded powers, so one function serves every power in the pack.

Fields

FieldTypeDefaultDescription
functionIdentifierrequiredThe apoli:function power to run.
argumentsObject{}One entry per parameter the function declares. A value can be any JSON the target field accepts.

Examples

{
  "type": "apoli:run_function",
  "function": "example:hurt",
  "arguments": {
    "amount": 3
  }
}

Without arguments:

{
  "type": "apoli:run_function",
  "function": "example:launch"
}

Notes

note

The function's own condition is checked before it runs, so a function can gate itself for every caller at once.

note

A missing power, a power that isn't an apoli:function, a missing argument, or going past the cap of 16 nested calls each log a warning once per function ID per data pack load, then do nothing. None of them interrupt the surrounding action list.