Effects Manager
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.
I know im late for like 4-5 years? Im not great with ruby.. i know its possible with effect manager to make a state that similiar with your thorn mail script. i just dont know how 🙁
for ex :
A cast “Thorn Aura” on himself
B attacked A
B damaged by “Thorn Aura”
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.
If you are looking to have every equip treated individually, use Instance Items. I have no intention to support FP scripts.
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.
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.
Are you loading from a save file? Does this occur in a new project? Could it be a compatibility issue with another script?
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 😛
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
It doesn’t have any of the extra things that the effect manager adds.
It works, but if I set target none it doesn’t.
I want items change the class of actor 2 according to item id (item 1 > class 1; item 2 > class 2), so Effect: Common Event with $game_temp.event_item could be perfect, but it doesn’work.
There was a bug with the common event code: it didn’t keep the item reference. See if it works now.
It works!!! 😀
Arigatou!!! (even if I’m italian, but you’re Hime XD)
But I’m not able to use $game_temp.event_item 🙁
Event_args is ok, but I need the item variable… (is it a variable or something else?)
It is an object. If you need the ID you can say
It returns error: undefined method ‘id’ for nil:Nil:Class
You need to use it in your common event.
I’m using in the common event the script: change_class(2, $game_temp.event_item.id)
It works fine for me. Did you save your project before testing?
I’ve tried it on a new project but there’s the same error
Send that new project.
How? In a email?
Upload your project to mediafire or dropbox or something and then click on the “Contact me” button near the top and send me the link.
I’ve sent the link with the contact me form, hope it works 😉
(Yesterday I was really tired… :P)
Sorry, can you re-send it? It didn’t show up in my inbox after awhile so I went to look at why and found out my configuration settings weren’t right.
Re-sent 😉
Ok now it is working. Grab a new copy of the script.
Grazie mille!!! 😀
Arigatou gozaimashita!!! 😀
Thank you very much!!! 😀
Otherwise it will be great if you explain me how to set the item call a common event via Custom Database… 🙂
And how to set up a common event 🙂 🙂 (if it’s allowed)
I’ve tried but I couldn’t understand it… 🙁
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!
I have tried attack skill command and the common event executes properly. Try it on a new project.
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.
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.
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.
The effect manager ignores the original return value of
erase_state
. Why not usestate?
to check whether a state exists or not?.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.
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?
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?
You need to provide more details since I don't know what you've tried.
the link doesn't work
Updated.
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?
What kind of problems?
Sorry, I should have been more specific. When I change any equipment, I’m getting an error reading something like this:
Line 709 NoMethodError Occured. Undefined method for #
I’ve tried it on a new testing game save, but had no luck.,
I think the issue might be coming from Fomar’s Individual Equipment (http://cobbtocs.co.uk/wp/?p=148), but I can’t pin it down perfectly.
Ack, sorry, I changed the load order around and managed to fix it. It looks like it’s working now. Thanks for your time Hime! Fantastic script!
Good thing it was an easy fix on your end.
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?
i just found out it has to do with victors Materia script
Do you mean, the effects manager is conflicting with victor’s script, or it’s just an issue with victor’s script?
i managed to fix it by changing “effect” to “effect 2” inside victor`s matera script sorry to have botherd u
Oh ya there was an issue like that where the same variable name was used. Someone ran into that several months ago as well.
Thanks for taking the time to respond tho ur great 🙂
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?
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.
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
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