State that temporarily alters a.mdef to the value of a.agi

Grunwave

Veteran
Veteran
Joined
Feb 4, 2017
Messages
589
Reaction score
159
First Language
English
I want to create a buff that allow my rogue to use his agility instead of his magic defense.

Can I accomplish this with an eval or another base feature? Or do I need a plugin?

Thank you =)
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,634
Reaction score
5,114
First Language
English
Primarily Uses
RMVXA
Moving this to Plugin Requests, as I believe there's no way to do this without either using an existing plugin (like Buffs & States Core) or creating a bit of new code of your own.

This is a cool gameplay idea, @Grunwave. I'll take my shot at writing the code for you. Replace N in the third line with the ID of the State that you want to replace MDF's value with that of AGI. I haven't tested this, so let us know if this doesn't work and maybe someone can spot the mistake.

JavaScript:
Game_BattlerBase.prototype.param_rogue = Game_BattlerBase.prototype.param;
Game_BattlerBase.prototype.param = function(paramId) {
if (this.isStateAffected(N) && paramId === 5) {
    paramId = 6;
}
var calc_value = this.param_rogue.call(this, paramId);
return calc_value;
};
Essentially what this is doing is aliasing the old method, and first checking to see whether the battler has the State and whether the Parameter ID being checked in this specific call to the method is 5 (MDF). If so, it changes the argument paramId to 6 (AGI) immediately. Then, it calls the original method and all of its functionality - usually using the normal paramId being passed into the alias, but if it was changed by the above it will use the new AGI parameter instead to calculate the final value. Lastly, it returns the final value to whatever method was asking for the parameter's value.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Frostorm wrote on Featherbrain's profile.
Hey, so what species are your raptors? Any of these?
... so here's my main characters running around inside "Headspace", a place people use as a safe place away from anxious/panic related thinking.
Stream will be live shortly! I will be doing some music tonight! Feel free to drop by!
Made transition effects for going inside or outside using zoom, pixi filter, and a shutter effect
I have gathered enough feedback from a few selected people. But it is still available if you want to sign up https://forums.rpgmakerweb.com/index.php?threads/looking-for-testers-a-closed-tech-demo.130774/

Forum statistics

Threads
105,992
Messages
1,018,190
Members
137,772
Latest member
Kirakirna
Top