In RPG Maker, you can assign effects to items or skills. Effects are special behaviors that occur when the item or skill is successfully executed.
For example, you can create a “Poison” skill that has a 50% chance to add a “Poison” state to the target, or you can create a “Skill Book” item that will teach a new skill to a particular actor when that actor is selected.
Now, let’s say you had a skill book that teaches Fire, but only magic users can learn it. Do you want non-magic users to be able to use the book as well? Maybe not.
In this situation, it would be useful to be able to define “conditions” that must be met in order for the skill book to be used.
This plugin allows you to define “effect conditions”, which are conditions that are given to each and every effect on an item or skill. Before an effect can be applied, all conditions must be met.
With these conditions, you can now check whether the actor that you would like to use it on is able to learn Fire!
Effect conditions are formulas, so you can create conditions on anything that you can imagine.
Plugin: download here (right-click, save as)
Download the plugin and place it in the “plugins” folder in your project’s “js” folder. Then open your Plugin Manager (F10), double-click an empty row, and select the HIME_EffectConditions plugin.
Once it is in your list of plugins, turn the plugin on.
In this plugin, you will need to be able to reference effects in note-tags. This is how the number system works:
To create an effect condition, note-tag skills or items with
<effect condition: ID1, ID2, ... > FORMULA </effect condition>
ID1, ID2, and so on are the effects that this condition applies to. So for example if you wanted to apply the condition to the first effect, you would write
<effect condition: 1> FORMULA </effect condition>
and if you wanted to apply the condition to effects 1, 3, and 4, then you would write
<effect condition: 1, 3, 4> FORMULA </effect condition>
FORMULA is the condition that will be added to the specified effects.
The following formula variables are available:
a - the user of the item/skill b - the target of the item/skill i - the item/skill being used v - game variables s - game switches p - game party t - game troop
Effect Execution Sequence
IMPORTANT: effects are applied in order from top to bottom. They are also applied AFTER damage evaluation. So for example, if your condition is on HP, the HP damage will be applied BEFORE your condition is evaluated.
This timing may result in some odd behaviors if you don’t account for it.
Let’s say you had an item called “Fire Skill Book” whichteaches the “Fire” spell.
You would add one effect to the item called “Learn Skill” that will add the fire spell.
Now, if you used the book on anyone, you’ll see that they learn the fire skill.
We would like to add conditions for our “Learn Skill” effect now. Let’s say that only the “Magician” and “Wizard” classes can learn it.
Assuming magican is class 2 and wizard is class 4, our effect condition would start by targeting the first effect in the list, with a formula that checks the class of the target:
<effect condition: 1> b.isClass($dataClasses) || b.isClass($dataClasses) </effect condition>
Here’s how it looks in the editor:
Translating the formula into natural language, it means
is the target class 2 or class 4?
If any of those conditions are true, our effect condition is satisfied, and we can proceed to teach the target the fire spell only to actors that are class 2 or class 4.
If you try to use the item on someone that doesn’t meet the requirements, the item can’t be used (in the menu), or will do nothing (during battle)