Executes the skill when the mob dies. The entity that killed the mob is the `@trigger`.
Executes the skill when the mob dies. The entity that killed the mob is the `@trigger`.<br>
If the server is a Paper one, it is possible to cancel the death event as long as the cancelevent mechanic is synched. The health that the mob has after this is based on what is specified in the `ReviveHealth` Option.
```yml
```yml
EXAMPLE_MOB:
EXAMPLE_MOB:
Type:CHICKEN
Type:CHICKEN
...
@@ -121,7 +122,20 @@ EXAMPLE_MOB:
...
@@ -121,7 +122,20 @@ EXAMPLE_MOB:
# when the mob dies
# when the mob dies
-message{m=DEATH} @World ~onDeath
-message{m=DEATH} @World ~onDeath
```
```
```yaml
ImmortalCow:
Type:COW
Display:'&eImmortalCow'
Health:20
Options:
ReviveHealth:-1
Skills:
-skill{s=[
- cancelevent
- e:p{p=HEART;hs=0.5;vs=0.5;y=1.5}
- speak{m=Call an ambulance, but not for me!}
];sync=true} @self ~onDeath
```
#### ~onAttack
#### ~onAttack
Executes the skill when the mob attacks an entity.
Executes the skill when the mob attacks an entity.
The `@trigger` is the entity that took damage from the attack.
The `@trigger` is the entity that took damage from the attack.