Skip to main content

Action On Hit (Power Type)

Runs an action when the entity that has the power hits another entity, after the hit's damage lands. The actor is the entity with the power, and the target is the entity that was hit.

Type ID: apoli:action_on_hit

Fields

Every field below works under every ID this power type answers to. The legacy ID you write only decides where a legacy entity_action runs. It never turns other fields off.

FieldTypeDefaultDescription
bientity_actionBi-entity Action TypeoptionalRuns on the actor and target pair when the hit lands.
self_actionEntity Action TypeoptionalRuns on the actor, the entity that has the power.
attacker_actionEntity Action TypeoptionalRuns on the attacker. Here the attacker is the entity with the power, so this does the same as self_action.
target_actionEntity Action TypeoptionalRuns on the target, the entity that was hit.
entity_actionEntity Action TypeoptionalLegacy field. Runs on whichever side entity_action_target names.
entity_action_target"self", "attacker" or "target""self"Which entity entity_action runs on. The legacy IDs below set it for you.
bientity_conditionBi-entity Condition TypeoptionalMust pass for the actor and target pair before the power fires.
target_conditionEntity Condition TypeoptionalMust pass for the target.
attacker_conditionEntity Condition TypeoptionalMust pass for the attacker, the entity with the power.
damage_conditionDamage Condition TypeoptionalMust pass for the damage that was dealt.
cooldownInteger or Expression1Ticks the power needs to recharge between fires.
hud_renderHUD Render{"should_render": false}How the cooldown is shown on the HUD.

All action and condition fields are optional. Setting several actions runs all of them, in the order listed above.

Inside any of these actions, the damage expression variable holds the damage amount of the hit.

Apace compatibility

This power type takes in three legacy Apace types, and JSON written for the old IDs loads unchanged.

Legacy IDentity_action runs onNotes
apoli:action_on_hitthe actorApace's main type used bientity_action. Here entity_action is an Apoli extension.
apoli:self_action_on_hitthe actorApace's variant that ran the action on the actor.
apoli:target_action_on_hitthe targetApace's variant that ran the action on the target.

The legacy IDs are only aliases. They don't rename or consume fields, so a power written as apoli:target_action_on_hit can still use bientity_action, self_action and target_action alongside its entity_action, and apoli:action_on_hit accepts entity_action too. To run entity_action on a side the alias doesn't imply, set entity_action_target.

Examples

Knockback on hit

{
    "type": "apoli:action_on_hit",
    "bientity_action": {
        "type": "apoli:add_velocity",
        "z": 2
    }
}

Heal the attacker with self_action_on_hit

{
    "type": "apoli:self_action_on_hit",
    "entity_action": {
        "type": "apoli:heal",
        "amount": 2
    }
}

This loads as apoli:action_on_hit, with entity_action running on the actor.

Set the target on fire with target_action_on_hit

{
    "type": "apoli:target_action_on_hit",
    "entity_action": {
        "type": "apoli:set_on_fire",
        "duration": 4
    },
    "target_condition": {
        "type": "apoli:living"
    }
}

This loads as apoli:action_on_hit, with entity_action running on the target and target_condition kept as written.