Effect Conditions

effectConditions1

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.

Download

Plugin: download here (right-click, save as)

Installation

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.

Usage

In this plugin, you will need to be able to reference effects in note-tags. This is how the number system works:

effectConditions2

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.

Example

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.

effectConditions3

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[2]) ||
  b.isClass($dataClasses[4])
</effect condition>

Here’s how it looks in the editor:

effectConditions4

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)

You may also like...

109 Responses

  1. Asakawa Nobuna says:

    I want to use this plugin in my commercial game.But my English is not very good, I’m sorry.

  2. Shandaxa says:

    So how would you check a variable as a condition? Say for instance I wanted an item that had different effects based on the value of a variable, and I needed to know if it was greater than 0 AND less than 3, how would you do something along those lines?

  3. Leysos says:

    I’m trying to get this plugin to work in tandem with your scope change plugin. Is there any way to change the scope of a condition?

  4. Sundricat says:

    I’m encountering a problem when using Enemy Classes to give enemies a class for use in an effect condition. When the skill is used by an enemy, the produced error is “undefined is not a function” When the same skill is used by an actor, the error doesn’t occur. I already tried putting the two plugins alone and the error still occurred when an enemy used the skill.
    The effect Condition:

    a.isClass($dataClasses[24]) || a.isClass($dataClasses[27]) || a.isClass($dataClasses[28])
    </effect condition>

    • Hime says:

      There is no method “isClass”
      You can access the current class via

      a.currentClass()
      

      Which returns a Class object. If you want to check the ID, you can say

      a.currentClass().id === 24
      

      or something.

  5. Sundricat says:

    How would I make it so enemies using the skill can’t apply an effect until a switch is turned on, but actors can even if the switch is off?

    • Hime says:

      You can check whether the user is an enemy and then condition it on the switch

      a.isActor() || a.isEnemy() && $gameSwitches.value(3)

      Which means the condition is met if the user is an actor, or the user is an enemy and switch 3 is ON.

  6. Quinn says:

    Thanks so much for this, been trying to get a favorite food system working where certain foods heal certain actors more than others, this script finally made that possible. Thanks a ton!

  7. Dilo says:

    How to make it so item not consumable when doesn’t meet the requirements?

    • Hime says:

      How are you using the item? It should be unusable if it doesn’t do anything I think unless you’re in battle.

      • Dilo says:

        I make comsumable = yes, ocassion = menu screen

        I use the item to learn skill, when condition don’t met requirement,
        item still consumable but doesn’t teach any skill

  8. xoDeathy says:

    So let’s say I wanted to make the condition based off of the Actor’s level, would I be able to?:

    a.isLevel(2)
    </effect condition>

  9. kins says:

    hello princess. first a big ty and cheer for all your work on RPG Move. hope you okay I do have a question I am looking for something that have elemental status effect. lets say I wanna create a burn status effect which gradually exhaust the target. naturally I would want that elemental effect to have the target receive 2x damage from fire physical attacks or fire magical attacks on hit only not from thunder or ice or etc attributes. If i set the parameter to magical damage it affects every attributes where i don’t want that really (”.) I’m sorry if there is already something like that somewhere please do help me I am new to the rpg world all I could figure out is that the damage taken will be from any attributes which is bad. thank you so much. have a nice day.

    • kins says:

      thanks sweetie I’ved kinda sort it out -^w^- well I think so ^_^” figured I am just your casual noob asking idiot questions but by doing some research iv’e found some interesting stuff. Gomen ne. Gao! Keep doing the good stuff Cheers <33

  10. Paul says:

    Thank you! I’ve been waiting for this one for a while. 🙂

  11. Seijiro Mafuné says:

    Can this be used to have equipment affect a skill’s damage?

    • Hime says:

      No, since effects are separate from damage.

      However, you could have equipment affect a skill’s effects though, which could have “damage”-like properties like removing a certain % of HP.

Leave a Reply

Your email address will not be published. Required fields are marked *