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