Update cancelevent authored by Amy's avatar Amy
Mechanic: CancelEvent
=====================
## Description
Cancel the Event that triggered the skill. This mechanic has several
important requirements in order to execute properly:
- The mechanic or initial skill must be run with sync=true. Example: -
skill{s=CancelEventSkill;sync=true} ~onDamaged
- **The mechanic or initial skill must be run with sync=true. Example: -
skill{s=CancelEventSkill;sync=true} ~onDamaged**
- No delays allowed.
- Not all triggers support it.
- Other mechanics within that skill can still be triggered.
Possible Triggers
-----------------
### Compatible Triggers
- ~onAttack
- ~onBucket
- ~onDamaged
- ~onDeath
- ~onExplode
......@@ -24,26 +23,27 @@ Possible Triggers
- ~onUse (Requires Crucible)
- ~onConsume (Requires Crucible)
Example
-------
## Examples
Skill.yml:
CancelDamageEvent:
Skills:
- CancelEvent
- message{m="&cYou cannot hurt this mob!"} @trigger
```yaml
CancelDamageEvent:
Skills:
- CancelEvent
- message{m="&cYou cannot hurt this mob!"} @trigger
```
Mob.yml:
NoDamageMob:
Type: villager
Skills:
- skill{s=CancelDamageEvent;sync=true} ~onDamaged
Or to prevent a skeleton from shooting:
customskeleton:
Type: skeleton
Skills:
- cancelevent{sync=true} ~onShoot
\ No newline at end of file
```yaml
NoDamageMob:
Type: villager
Skills:
- skill{s=CancelDamageEvent;sync=true} ~onDamaged
```
You can use it in-line too! This example will prevent the mob from shooting its bow, and from taking any damage.
```yaml
customskeleton:
Type: skeleton
Skills:
- cancelevent{sync=true} @self ~onShoot
- cancelevent{sync=true} @self ~onDamaged
```
\ No newline at end of file