Changes
Page history
added back trigger table
authored
Dec 31, 2022
by
Phillip
Show whitespace changes
Inline
Side-by-side
Skills/Triggers.md
View page @
92b98861
...
...
@@ -8,33 +8,35 @@ itself.
**Table of all available triggers:**
| Trigger | When it fires... |
|------------------------|--------------------------------------------------------------|
|------------------------
----------------
|--------------------------------------------------------------|
| onCombat | Default |
|
[
onAttack
](
#
~
on
A
ttack
)
| When the mob hits something |
| onDamaged | When the mob is damaged |
| onSpawn | When the mob spawns |
| onDespawn | When the mob is despawned |
| on
FirstSpawn
| Triggered the first time a mob is spawned from a spawner |
| onLoad | When the mob is loaded (spawning or loading after a restart) |
| onDeath | When the mob dies |
| onTimer:
*#*
| Every
\#
ticks (where
\#
is the interval in ticks) |
| onInteract | When the mob is right-clicked |
| on
Kill
| When
something
kills a
mob
|
| on
KillPlayer | When the mob kills a player
|
| on
PlayerDe
at
h
| When
a player dies for any reason
|
| on
EnterCombat
| When the mob
enters combat
(requires threat tables be on)
|
| on
DropCombat
| When the mob
leaves combat (requires threat tables be on)
|
| on
ChangeTarget
| When the
mob changes t
arge
t
s
(requires threat tables be on)
|
| on
Explode
| When the mob
explode
s (typically only used for
creepers)
|
| on
Prime | When the creeper charges up for an explosion
|
| on
Teleport
| When the mob
teleports (typically only used for endermen)
|
| on
Signal
| When the mob
receives a signal
|
| on
Signal:
*[signal]*
| When the mob re
ceives a specific signal
|
| on
Shoot
| When the
mob fires a projectile
|
| onTame | When the mob gets tamed |
| onBreed | When the mob breeds with another mob. |
| onTrade | When the Villager completes a trade. Requires Paper |
|
[
onAttack
](
#on
a
ttack
)
| When the mob hits something |
|
[
onDamaged
](
#ondamaged
)
| When the mob is damaged |
|
[
onSpawn
](
#onspawn
)
| When the mob spawns |
|
[
onDespawn
](
#ondespawn
)
| When the mob is despawned |
|
[
on
Ready
](
#onready
)
| Triggered the first time a mob is spawned from a spawner |
|
[
onLoad
](
#onload
)
| When the mob is loaded (spawning or loading after a restart) |
|
[
onDeath
](
#ondeath
)
| When the mob dies |
|
[
onTimer:*#*
](
#ontimerticks
)
| Every
\#
ticks (where
\#
is the interval in ticks) |
|
[
onInteract
](
#oninteract
)
| When the mob is right-clicked |
|
[
on
PlayerKill
](
#onplayerkill
)
| When
the mob
kills a
player
|
|
[
on
EnterCombat
](
#onentercombat
)
| When the mob enters combat (requires threat tables be on)
|
|
[
on
DropCombat
](
#ondropcomb
at
)
| When
the mob leaves combat (requires threat tables be on)
|
|
[
on
ChangeTarget
](
#onchangetarget
)
| When the mob
changes targets
(requires threat tables be on) |
|
[
on
Explode
](
#onexplode
)
| When the mob
explodes (typically only used for creepers)
|
|
[
on
Prime
](
#onprime
)
| When the
creeper ch
arges
up for an explosion
|
|
[
on
Teleport
](
#onteleport
)
| When the mob
teleport
s (typically only used for
endermen)
|
|
[
on
Signal:*[signal]*
](
#onsignalsignal
)
| When the mob receives a signal
|
|
[
on
Shoot
](
#onshoot
)
| When the mob
fires a projectile
|
|
[
on
Tame
](
#ontame
)
| When the mob
gets tamed
|
|
[
on
Breed
](
#onbreed
)
| When the mob
b
re
eds with another mob.
|
|
[
on
Trade
](
#ontrade
)
| When the
Villager completes a trade. Requires Paper
|
<!--
ADD THIS TRIGGER BACK WHEN IT WORKS
| onKill | When something kills a mob |
-->
Using Triggers
--------------
...
...
@@ -141,6 +143,17 @@ EXAMPLE_MOB:
-
message{m=DAMAGED} @World ~onDamaged
```
#### ~onDespawn
Executes the skill when the mob despawns.
```
yml
EXAMPLE_MOB
:
Type
:
CHICKEN
Skills
:
# sends a message to all the players in the world
# when the mob takes damage
-
message{m=DESPAWNED} @World ~onDespawn
```
#### ~onExplode
Executes the skill when the mob explodes.
Generally, this trigger only works with creepers and TNTs since other mobs tend to not explode...
...
...
@@ -328,3 +341,25 @@ EXAMPLE_MOB:
# when the mob's target changes
-
message{m=TRADED} @World ~onTrade
```
#### ~onReady
Executes the skill when the mob is ready to spawn from a
[
spawner
](
Spawners
)
```
yml
EXAMPLE_MOB
:
Type
:
VILLAGER
Skills
:
# sends a message to all the players in the world
# when the mob is about to spawn from a spawner
-
message{m=READY TO SPAWN FROM A SPAWNER} @World ~onReady
```
#### ~onLoad
Executes the skill when the mob is loaded after a server restart.
```
yml
EXAMPLE_MOB
:
Type
:
VILLAGER
Skills
:
# sends a message to all the players in the world
# when the mob is loaded after a server restart
-
message{m=LOADED} @World ~onLoad
```
\ No newline at end of file