Skip to content

Game Events

Sleys edited this page Sep 22, 2026 · 1 revision

Game Events are animation events designed to make animations react to gameplay conditions and entities.

Unlike visual events, which primarily affect rendering, Game Events can be used to introduce conditional or targeted behavior into an animation. They can also trigger other animation events, allowing complex behaviors to be built directly inside animation JSON.

Like every animation event, each entry uses the generic event wrapper:

type
side
start / process
params

This page focuses only on the Game Events available in this category and the parameters contained in params.

💡 Game Events are generally suitable for gameplay logic and can execute on both sides unless otherwise specified.

Available Events

Event Description Required Side
random_dice Executes other events with a configurable random chance. both
on_target_entity Executes other events on one or more entities affected by the animation. The event triggered in the chain regarding this one will take the struck entity as its "owner" both

Target Modes

impacted_target

Targets the animation's current target.

"target_mode": "impacted_target"

The events in do are executed on that target.

This is useful when the animation has a single relevant target.


all_impacted_target

Targets every entity currently affected by the animation.

"target_mode": "all_impacted_target"

Each affected entity receives the events in do.

This is particularly useful for attacks that can hit multiple entities.


random_impacted_target

Selects one random entity from the entities currently affected by the animation.

"target_mode": "random_impacted_target"

Only the selected entity receives the events in do.


📄 Example — Current Target

The following example executes a command on the animation's current target:

"in_time_events": [
  {
    "type": "on_target_entity",
    "side": "server",
    "start": 0.0,
    "params": {
      "target_mode": "impacted_target",
      "do": [
        {
          "type": "command_payload",
          "params": {
            "command": "say You were hit!"
          }
        }
      ]
    }
  }
]

📄 Example — All Impacted Targets

This example executes an event on every entity affected by the animation:

"in_time_events": [
  {
    "type": "on_target_entity",
    "side": "server",
    "start": 0.0,
    "params": {
      "target_mode": "all_impacted_target",
      "do": [
        {
          "type": "command_payload",
          "params": {
            "command": "say Area attack!"
          }
        }
      ]
    }
  }
]

If the animation affects three entities, the event is executed once for each of those entities.


📄 Example — Random Impacted Target

This example selects one random entity from the entities affected by the animation:

"in_time_events": [
  {
    "type": "on_target_entity",
    "side": "server",
    "start": 0.0,
    "params": {
      "target_mode": "random_impacted_target",
      "do": [
        {
          "type": "command_payload",
          "params": {
            "command": "say You were randomly selected!"
          }
        }
      ]
    }
  }
]

If multiple entities were affected, only one of them is selected.


🔗 Event Chains

The do field accepts a list of event invocations, rather than a fixed event type.

This means that events inside do can themselves contain another do list.

For example:

random_dice
    │
    └── on_target_entity
            │
            └── another "do" or "then/otherwise"
                          │
                          └── any event

A chain can therefore combine multiple Game Events and other animation events.

💡 Everything is constrained by the event side: if the origin is "server," all events must be "server"... Otherwise, the flow will be cut off!

The following is a complete example:

{
  "process": "on_begin",
  "type": "random_dice",
  "side": "server",
  "params": {
    "chance": 50,
    "do": [
      {
        "type": "on_target_entity",
        "params": {
          "target_mode": "impacted_target",
          "do": [
            {
              "type": "command_payload",
              "params": {
                "command": "say you lucky!"
              }
            }
          ]
        }
      }
    ]
  }
}

In this example:

  1. random_dice performs a 50% random check.
  2. If successful, on_target_entity selects the current target.
  3. command_payload is then executed for that target.

💡 Advanced: The do field accepts event invocations recursively. This means an event can invoke another event, which can invoke another event, and so on. There is no need to think of do as being limited to only one level of nesting.


⚠️ Notes

  • Game Events are intended primarily for gameplay-related logic rather than visual effects.
  • Both random_dice and on_target_entity support both sides.
  • random_dice interprets chance as a percentage between 0 and 100.
  • on_target_entity defaults to impacted_target when target_mode is omitted.
  • on_target_entity only operates on entities currently available as targets of the animation.
  • all_impacted_target executes the nested events independently for every affected entity.
  • random_impacted_target selects only one affected entity.
  • The do field is optional for both events and defaults to an empty list.
  • Events inside do are regular animation event invocations and can themselves contain nested events.

EF: Extended Datapacks

📦 Data

🧰 Core

👁️ Visuals

⚔️ Combat

🗝️ Skill Builder

🛠️ Innate Builder

🗡️ Animation Operations

⚙️ Third-Party

Clone this wiki locally