Effects Manager

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

This script is aimed at developers that wish to write and add more effects to the game, but find it too tedious to do so. It is also useful for users that are not as proficient with ruby to write their own effects without having to worry about all the technical stuff behind the scenes.

The script turns a potential 200 line script into one method call and one method definition.

You should place this above all custom scripts.

Download

Script: download here

Usage

The general note-tag for all effects is

<eff: effect_name arg1 arg2 arg3 ... >

Where the arguments are specified by each effect plugin.

Effect Triggers

All effects support trigger-specific note-tags, which is of the form

<eff: effect_name-triggerType arg1 arg2 arg3 ... >

For example, if you want an effect to only activate by attack triggers, you would write

<eff: effect_name-attack arg1 arg2 ... >

See the script for more details on which triggers are available. If you don’t specify the trigger, then all methods defined in the effect are activated whenever any trigger is run.

Description

I spent about 15 minutes planning and writing an Effect Manager for RMVX Ace.
Then I spent another 15 minutes thinking about ways to improve it, and ended up adding in custom effect messages for the battle log and allowing you to pass in an arbitrary number of arguments which will be stored in the RPG::UsableItem::Effect object as an array of strings.

Next, I want to apply this plugin-based design to allow you to write a method that will let you determine how to store the arguments, because you may want to type cast them first rather than type casting them everytime you run the effect.

The script is remarkably simple:

  • It replaces just one method. In Game_Battler, I changed the `item_effect_apply` method to point to a different hash which I dynamically generate using the plugin interface.
  • I provide a single method, Effect_Manager.register_effect, that allows you to quickly register your effect. This involves choosing an effect code, a method name, as well as an idstring for your effect
  • You then just implement the method you reference above, and then you’re done!

I quickly wrote up 3 scripts using these effects based on a couple completed scripts that seemed to be having a couple issues, or at least, were just very long and complex.

Effect: Rare Candy – a simple script based on the same item from the pokemon series
Effect: Gold Pouch – gives you money when you use the item. Or skill.
Effect: Steal Drops – add a “steal” effect to your item/skill to steal enemy drops

The amount of effort required to write the scripts was minimal in time, lines of code, number of aliases or overwrites, and overall complexity. Obviously I am impressed by the work I have done despite not doing a whole lot.

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

53 Responses

  1. Jared says:

    I used Script Effects Manager and Script FP Inventory Plus but it incompatible. All Effects used Note in Weapon and Armor not working. I used Script Effect: Auto State, Effect: Reflect Damage…
    Sorry for my bad english.

    • Hime says:

      If you are looking to have every equip treated individually, use Instance Items. I have no intention to support FP scripts.

      • Jared says:

        Thanks for the reply. In my projects have ranged class. Classes that using Ammo Type as Weapons Type (to be able to enjoy additional Para / Ex / Sp from ammunition). So Script Instance Items not suitable. Because ammunition is always detached. I used to add Script Asagi’s Gun License. Sorry for my bad english.

  2. Martín Morales says:

    When triying my project, at moment of equip a weapon, boom! sudden crash and this is the text on the error window:

    Script ‘Effect Manager’ line 709: NoMethodError occurred.

    undefined method ‘effects’ for #

    Also, the script editor sends me directly to the line 709 of Effect Manager (I don’t know if that data is important).

    Any ideas? My Ruby skills are… almost zero u_u. Practically zero, in fact. So, I cannot think about a solution because there’s nothing as a base.
    Beforehand, thank you.

    • Hime says:

      Are you loading from a save file? Does this occur in a new project? Could it be a compatibility issue with another script?

  3. The Predator says:

    Hi Hime!

    I’m trying to use this script with Effect: Common Event, but it doens’t work 🙁

    Script ‘Effect Manager’ line 686: ArgumentError occurred.

    wrong number of arguments (2 for 1)

    I’m using che notetag < eff: common_evt 5 > (without spaces near < >)

    I’ve tried it on a new project, but there’s the same error.

    PS: In the intro of the script you’ve written ccommon_evt 😛

    • Hime says:

      I’ve updated the common event script, but if you just need to be able to call common events, consider using Formula Effects and then just use

      <formula effect>
      $game_temp.reserve_common_event(3)
      </formula effect>
      

      It doesn’t have any of the extra things that the effect manager adds.

  4. Mattchaby says:

    Hello!

    Sorry, I'm not great at Ruby, I'm trying to create an effect calling a common event when a specific skill is used. This should be pretty simple but I can't put my finger on it.
    The full story is that I'm also using your Attack Skill Command script but when a skill is used on attack the common event is not called (using the default RPGMVXA system). If you have a solution for me I would be greatful 🙂
    Love your work!

  5. MoloMowChow says:

    Sup, I tried using your script to have access to the Mana Shield effect specifically. But it seems your script was causing some of my custom scripted skill formulas from working properly.

    Specifically, ones that involve .erase_state(n). Normally, they would return something only if the specified "n" state is there and then removed. But using your effect managers script, it seems .erase_state(n) would return true every time, regardless of whether or not the "n" state is there or not.

    Just thought you might be interested in this, or maybe you already know why.

    • Hime says:

      I wouldn't rely on erase_state's return value. Looking at the method, all it does is delete the state and any information related to it.

      • MoloMowChow says:

        I probably didn't explain what I meant clearly. Let me try and explain more about what happened:

        I have a skill script formula that is defined as such

        class Game_Battler < Game_BattlerBase

        def fire_mana(a)
        if a.erase_state(117)
        return a.add_state(119)
        else
        return a.add_state(116)
        end
        end

        end

        Basically, "if a.erase_state(117)" will check if state 117 is currently on actor "a" and if it is, it will erase state 117 from "a" actor and return "a.add_state(119)" to the skill formula box, which adds state 119 to the actor.
        If the "a" actor is not affected by state 117, then there is nothing to erase and this scripted formula will simply .add_state(116) to the "a" actor.

        When I plugged in your Effect Manager script, my skill would always return "a.add_state(119)" even if state 117 wasn't on the actor to erase.

        • Hime says:

          The effect manager ignores the original return value of erase_state. Why not use state? to check whether a state exists or not?

          • MoloMowChow says:

            .erase_state() was just more convenient for me at the time. I wrote a few skills which used .erase_state() in that manner before I had decided to use your effect manager. Shouldn't be too much trouble to switch it all to .state?() though.

            Thanks for your time and clarification.

  6. Joseph says:

    It is Possible to call a Common Event On Critical. For Example if I crit hit with a fire Spell it calls Common event say 120?

  7. Adam H says:

    I'm sorry, but I'm new to RPG Maker. Your script has absolutely no installation instructions. I have placed the EffectManager after Materials but before Main in the Script Editor. But when I try to use your Active Cost script (inserted below Effect Manager), it does not work. What, exactly, am I doing wrong?

  8. cubeking1 says:

    the link doesn't work

  9. I’m actually having a similar problem with changing equipment when using this script, but i’m using Yanfly’s equip engine along side Fomar’s individual equipment, no victor stuff being used (victor’s stuff can already do a lot of what this effects manager can do anyway, it’s just more complicated).

    Anyone else run in to this problem or have a solution?

  10. John says:

    Great scripts u have but i ran into a little problem,
    I didnt have any problems before but now when i try to chance a equiptment or clearing all equiptment i get a error
    “undefined method ‘each’ for nil:NilClass.”
    Is their a way to fix it?

  11. Alex says:

    Hi I want to recreate the runic ability from ff6, and I need a state which when applied absorbs magical attacks and converts it to restore a small percentage of mp. Is this the right script to use and if so how would I accomplish this?

    • Tsukihime says:

      You would create an effect that would access the user’s current action to determine the type of damage (eg: whether it’s magical or not) and then access the @result object to get the damage dealt, and then do the math to reduce the damage and add your MP accordingly.

  12. Virgil says:

    I cannot get my ‘escape’ skill to function properly, I have the tags on my item and dungeon to use it in, and when activated, nothing happens

    • xtsukihime says:

      I have updated the script recently due to a report on the RMVXA forums. There was an incompatibility issue due to me updating the effect manager but not updating the plugin. It should be fine now

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax