Triggers
Season files cast MythicMobs skills on a regular beat, when a season starts or ends, and when the weather around a player changes. Calendar events also send signals to MythicMobs mobs.
Triggers
A pass is one round of trigger checks, see When skills run.
| Trigger | When it fires... |
|---|---|
| player-tick | Every pass, once for each player in a world that has the season |
| player-tick-particles | Like player-tick, skipped for players who turned season particles off |
| world-tick | Every pass, once for each world that has the season |
| season-start | One tick after a world changes to the season |
| season-end | When a world leaves the season |
| atmosphere-rain-start | When rain or snow starts falling at a player's position |
| atmosphere-rain-stop | When the rain or snow at a player's position stops |
| atmosphere-storm-start | When a storm starts at a player's position |
| atmosphere-storm-stop | When the storm at a player's position ends |
| atmosphere-snow-start | When the precipitation at a player's position starts to fall as snow |
| atmosphere-snow-stop | When the snow at a player's position stops |
| atmosphere-cloud-enter | When a player enters a cloud |
| atmosphere-cloud-exit | When a player leaves a cloud |
startEvent_<id> |
Signal to MythicMobs mobs when a calendar event starts, see Event signals |
endEvent_<id> |
Signal to MythicMobs mobs when a calendar event ends |
Using skill triggers
Add a skill-triggers section to a season file in plugins/MythicSeasons/seasons/. Each key is an optional list of MythicMobs skill names. The shipped example.yml there lists every key.
id: winter
skill-triggers:
player-tick:
- MS_Atmosphere
- MS_ColdSlowness
- MS_ColdFreezing
player-tick-particles:
- MS_ColdBreath
- MS_NightSparks
world-tick:
- Winter_Ambience
season-start:
- Winter_Arrives
season-end:
- Winter_Leaves
atmosphere-rain-start:
- Rain_Begins
atmosphere-rain-stop:
- Rain_Ends
atmosphere-storm-start:
- MS_StormArrives
atmosphere-storm-stop:
- MS_StormPasses
atmosphere-snow-start:
- MS_FirstSnowfall
atmosphere-snow-stop:
- Snow_Ends
atmosphere-cloud-enter:
- MS_CloudEnter
atmosphere-cloud-exit:
- MS_CloudExit
The
MS_*skills come from the bundled pack. Define the others in any MythicMobs skill file.
- Write every key as a list, even for one skill.
- Skills run in order, and names must match the MythicMobs skill exactly, case included.
- An unknown name logs
Skill trigger references unknown MythicMobs skill: <name>once and starts working when the skill exists. - A cast error logs
Failed to cast skill '<name>'and the error, once per skill. - Unknown keys are ignored without a message.
- Season file edits apply after
/ms reload, MythicMobs skill edits after/mm reload.
When skills run
Skill triggers need MythicMobs. A pass runs every performance.skill-trigger-interval ticks, a whole number of at least 1 in config.yml. A change needs a server restart.
performance:
skill-trigger-interval: 5
The default: four passes a second.
Each pass covers every world with players and an active season that has skill-triggers, in this order:
world-tick, once.player-tick, for each player.player-tick-particles, for each player who has not turned particles off.- The
atmosphere-*lists, for each player whose weather changed.
The skill's Cooldown (in seconds) and Conditions apply as usual.
The caster and the targets
The caster is the player the trigger is about, or, for world-tick, season-start and season-end, the first player in the world's player list. No trigger entity is set: use @Self for the caster, since @Trigger selects nothing.
player-tick
Runs for every player in a world with the season, Creative and Spectator included, the whole list for one player before the next. At four passes a second by default, limit the skills with conditions and a Cooldown. The shipped seasons list MS_Atmosphere and the temperature skills here.
player-tick-particles
Like player-tick, but skipped for players who turned season particles off with /toggleseasonparticles (permission mythicseasons.toggleparticles, allowed by default). Put only cosmetic skills here, such as the shipped MS_ColdBreath, MS_NightSparks, MS_FireFlies, MS_Sweat and MS_FallingStars.
For a skill with only some cosmetic lines, list it under player-tick and add ?stringEquals{val1=<mythicseasons.particles>;val2=true} to those lines, as the bundled MS_Atmosphere does.
world-tick
Runs every pass, once for each world with the season and at least one player. The caster is the first player in the world's player list, so write targeters with targetself=true. /toggleseasonparticles does not skip these skills: to leave out players with particles off, filter the targets with ?@stringEquals{val1=<mythicseasons.particles>;val2=true}.
season-start
Fires once for a world, after a change through the calendar, /ms set or /ms nextseason. It is skipped, not delayed, when no player is in the world, and not cast at server start, when the world is already in the season, or when another plugin cancels the change.
season-end
Fires once for a world as it leaves the season, also on /ms disable, before the new season begins. It is skipped when no player is in the world or the change is cancelled. The new season's season-start follows one tick later.
Weather triggers
On every pass MythicSeasons reads four states at each player's feet: precipitation, storm, snow and in cloud. A change casts the matching start or stop list (enter or exit for clouds).
Where the weather comes from
The weather comes from a WorldGuard permanent-weather region (rain and storm only, see Land Claims), then the weather simulation, then weather providers of other plugins, which rank below the simulation unless they declare a higher priority. The vanilla weather is never used: where no source answers, no start or enter list fires, and a player who arrives there with a state on gets its stop or exit list once.
The Atmosphere condition and, on MythicMobs builds with condition providers, the raining, sunny, snowing and thundering conditions fall back to the server weather, so they can disagree with these triggers.
| Triggers | Weather source needed |
|---|---|
atmosphere-rain-start, atmosphere-rain-stop, atmosphere-storm-start, atmosphere-storm-stop |
The simulation running in the world, a WorldGuard permanent-weather region, or an addon provider |
atmosphere-snow-start, atmosphere-snow-stop |
The simulation running in the world, or an addon provider |
atmosphere-cloud-enter, atmosphere-cloud-exit |
The simulation running in the world with a solid cloud layer, or an addon provider |
The simulation never runs in the Nether or the End.
Rules for every weather trigger
- The first pass after login only records the state, so joining in the rain fires nothing.
- Seasons without
atmosphere-*lists are not watched, but the last state is kept until logout, so returning to a watched season can fire astartorstoplist at once. - Several changes in one pass run in this order: rain, storm, snow, cloud.
- The simulation reports precipitation, storm and snow per weather cell (
grid.cell-size.xzblocks wide), and none of them to a player above the top of the simulated cloud in their column (a column without cloud has no such limit). - Until the simulation has data for a player's position, as right after joining or a teleport, nothing fires and the last state is kept, for up to 30 seconds (the hold). Then the weather counts as clear and out of cloud, and the
stopandexitlists of the active states are cast.
atmosphere-rain-start
Precipitation counts once the rain intensity of the weather cell passes weather.rain-precip-threshold (see Weather). In a WorldGuard permanent-weather region it fires for rain and storm.
atmosphere-rain-stop
Also fires on entering a permanent-weather region set to clear, and when the hold runs out.
atmosphere-storm-start
A storm needs precipitation above weather.storm-precip-threshold (default 0.5) and an updraft above weather.storm-updraft-threshold (default 2.5) in the weather cell. It also fires on entering a permanent-weather region set to storm.
atmosphere-storm-stop
Also fires when the hold runs out.
atmosphere-snow-start
Precipitation falls as snow while the air at the ground of the weather cell is colder than weather.snow-temp-threshold (default 0.5 degrees Celsius). If it was not precipitating before, atmosphere-rain-start fires first in the same pass.
atmosphere-snow-stop
Also fires when the snow turns to rain, and when the hold runs out.
atmosphere-cloud-enter
The cloud is the one drawn for the first solid layer (opacity 1.0) in clouds.layers, whether anyone sees it or not (see Cloud Layers). Without a solid layer, players are never in a cloud.
atmosphere-cloud-exit
Also fires when the hold runs out.
Event signals
Calendar events (files in plugins/MythicSeasons/events/) signal MythicMobs mobs when they start and end. Catch the signal with the ~onSignal trigger.
| Signal | Sent when |
|---|---|
startEvent_<id> |
The event starts in a world |
endEvent_<id> |
The event ends in a world |
<id> is the event file's id in lowercase, such as startEvent_halloween. The name is case sensitive.
Pumpkin_Watcher:
Type: ZOMBIE
Skills:
- message{m="Halloween has begun."} @PlayersInRadius{r=30} ~onSignal:startEvent_halloween
- message{m="Halloween is over."} @PlayersInRadius{r=30} ~onSignal:endEvent_halloween
The mob is both the caster and the
@Triggerof the signal skill.
- Every active MythicMobs mob in the event's world gets the signal. Mobs that spawn later get nothing.
- Signals go out on calendar day changes and on
/ms event startor/ms event stop. An event already running at server start sends no start signal. - A
dailyevent sendsstartEvent_<id>on every day change andendEvent_<id>only on/ms event stop. - Worlds in the event's
disabled-worldsget no signals. - A named
~onSignalaccepts only letters, digits,_and-, so an event id with other characters cannot be caught by name. - To test whether an event is active, use the IsEvent condition.