Triggers are used to determine how a skill is triggered from within the mobs skill configuration section.
TRIGGERS CANNOT BE USED IN META-SKILLS AND SHOULD NOT BE INCLUDED IN THEM.
Triggers can only be used to activate the meta-skill itself (in the mob's configuration file).
Each trigger starts with a
on
string. That string is case sensitive, so make sure to write it correctly or the trigger will not work
Additional Triggers
Links to triggers added by addon plugins. Any triggers from these links will not work without that plugin installed.
Triggers
Table of all available triggers:
Trigger | When it fires... |
---|---|
onCombat | Default |
onAttack | When the mob hits something |
onDamaged | When the mob is damaged |
onSpawn | When the mob spawns |
onDespawn | When the mob is despawned |
onReady / onFirstSpawn | Triggered the first time a mob is spawned from a spawner |
onLoad | When the mob is loaded after a server restart |
onSpawnOrLoad | When the mob either spawns or loads |
onDeath | When the mob dies |
onTimer:# | Every # ticks (where # is the interval in ticks) |
onInteract | When the mob is right-clicked |
onPlayerKill | When the mob kills a player |
onEnterCombat | When the mob enters combat (requires threat tables be on) |
onDropCombat | When the mob leaves combat (requires threat tables be on) |
onChangeTarget | When the mob changes targets (requires threat tables be on) |
onExplode | When the mob explodes (typically only used for creepers) |
onPrime | When the creeper charges up for an explosion |
onCreeperCharge | When the creeper is charged (when lightning hits a creeper) |
onTeleport | When the mob teleports (typically only used for endermen) |
onSignal:[signal] | When the mob receives a signal |
onShoot | When the mob fires a projectile |
onBowHit | When the mob's fired projectile hits an entity |
onTame | When the mob gets tamed |
onBreed | When the mob breeds with another mob. |
onTrade | When the Villager completes a trade. Requires Paper |
onChangeWorld | When the mob changes world |
onBucket | When the cow is milked or an entity is bucketed (axolotl etc.) |
onSkillDamage | When the mob deals damage to other entities via a mechanic |
onHear | When the mob hears a sound, if enabled |
Using Triggers
Triggers are defined in the skill section of the mob configuration and must use a tilde (~) in front of them. In the case of the Timer, a time in ticks is also required.
SkeletalWizard_Fire:
Type: WITHER_SKELETON
Display: '&Skeletal Fire Wizard'
Health: 50
Damage: 0.5
Skills:
- ignite{ticks=100} @target ~onAttack
- skill{s=FireShield} @trigger ~onDamaged 0.1
- skill{s=AOEFire} ~onTimer:300
In this example the mob will also set its target on fire when melee-attacking, will use a "FireShield" skill when taking damage, and will use the "AOEFire" skill every 300 ticks, or every 15 seconds.
Not using Triggers...
Skill triggers give far more flexibility in determining exactly when a skill should go off. It is highly recommended that you trigger all your skills using advanced triggers as opposed to the old, legacy methods.
If a skill does not have a trigger, it will default to the ~onCombat
trigger which will execute when these events occur:
- When the mob deals or takes damage
- When the mob spawns
- When the mob dies
SkeletalWarrior:
Mobtype: skeleton
Display: '<blue>A Skeletal Warrior</blue>'
Skills:
- skill{s=Bash} =10%-90%
In this instance the Bash skill is triggered when the mob deals or takes damage when it is between 10% and 90% health.
The @trigger Targeter
You may have noticed there is an @trigger
targeter in the examples
shown above, and listed in the targeters section. The @trigger
will target the
entity that "caused" the skill to trigger, i.e. when a player damages a mob and
that mob has an ~onDamaged skill, it will target that player.
If a signal is being sent to a mob, it will target the mob that sent
the signal, and so on.