Reagents
Reagents are the resources a player spends to cast a spell — mana is the canonical example. MythicRPG ships with one hardcoded reagent and lets you define any number of custom reagents, each of which can scale dynamically with the stat system.
Hardcoded Reagents
| Reagent | Aliases | Description |
|---|---|---|
health |
hp |
Costs the player health when the spell is cast (deals damage equal to the consumed amount). |
Hardcoded reagents accept an amount (alias a) argument:
Cost:
- health 5 # shorthand
- health{amount=5} # full form
Custom Reagents
Custom reagents are defined in a reagents.yml file inside any pack folder. Each top-level key becomes a reagent id (case-insensitive); you can define as many as you'd like.
With MythicMobs' default LoadExampleConfigs: true, a fresh install already defines Mana: the example pack's reagents.yml ties its max to stat.MAX_MANA. If the example pack is turned off (GenerateExamplePack: false in config-rpg.yml), plugins/MythicMobs/reagents.yml defines it instead, with a fixed max of 1000.
Mana:
Display: 'Mana'
MinValue: 0
MaxValue: stat.MAX_MANA
Stamina:
Display: '&aStamina'
MinValue: 0
MaxValue: 100
Options
| Option | Description | Default |
|---|---|---|
Display |
How the reagent is displayed in messages and GUIs. Accepts legacy color codes / language keys. | |
MinValue |
Lower bound. Either a fixed number or stat.<STAT_KEY> to bind the floor to a player stat. |
0 |
MaxValue |
Upper bound. Either a fixed number or stat.<STAT_KEY> to bind the cap to a player stat. |
100 |
Stat-backed Min/Max
Either MinValue or MaxValue can be tied to a stat using the stat.<STAT_KEY> form. This lets the reagent's range scale with whatever modifies that stat — gear, talents, archetype level, etc.
Define the supporting stat in a stats.yml file inside any pack:
MAX_MANA:
Enabled: true
Display: 'Max Mana'
BaseValue: 1000
Formatting:
Additive: '+<value> Max Mana'
Multiply: '+<value> Max Mana'
Compound: 'x<value> Max Mana'
Then MaxValue: stat.MAX_MANA makes the reagent's cap follow the stat's resolved value.
Showing Reagents
Reagent values are available as placeholders, so you can show them anywhere Mythic or PlaceholderAPI text is resolved: messages, menus, scoreboards, or the action bar.
The example pack shows Mana on the action bar once per second for every player who has a class, from the same timer that regenerates it. Global: true makes this a global spell that runs for every player.
GLOBAL_MANA_REGENERATION:
Spell: true
Global: true
Trigger: TIMER:20
Targeter: '@self'
Skills:
- modifyresource{resource=Mana;stat=MANA_REGENERATION} @self
- actionmessage{m="<aqua>Mana <white><caster.reagent.mana><gray>/<white><caster.reagent.max.mana>"} @self ?archetypelevel{level=>0}
Consuming Reagents
There are two ways to spend a reagent:
As a spell cost
Listed under a spell's Cost: block. The player must have at least the configured amount available; if they don't, the cast fails. On a successful cast, the amount is deducted automatically.
Fireball:
Spell: true
Trigger: ~onUse
Cost:
- mana 50
- health 5
Programmatically via mechanics
Use the modifyResource mechanic (alias modifyReagent) to add or subtract a reagent at any time. Negative amounts deduct, positive amounts grant.
Skills:
- modifyResource{resource=mana;amount=10} @self ~onTimer:20 # passive mana regen
- modifyResource{resource=mana;amount=-25} @target # drain target
Placeholders
Reagent values are exposed as the Mythic placeholders <caster.reagent.<name>> and <caster.reagent.max.<name>>, and as the PlaceholderAPI placeholders %mythic_reagent_<name>% and %mythic_reagent_max_<name>%. See the Placeholders page for details.