Edit for how Element Rates work in MV

Dungeonmind

Lvl 4000 Humanoid
Veteran
Joined
Sep 2, 2013
Messages
490
Reaction score
292
First Language
English
Primarily Uses
RMMV
Hi there I need to change how element rates work in the database. So if I set 20% resistance to fire then the player would take 20% less damage from fire. If they had two equipment pieces on with 20% Resistance set to fire then they would add together for a total of 40% resistance to fire which would mean taking 40% less damage from a fire element attack/skill. (I know how they work right now and it's not going to work for my game.)

Is there a way I can do this by editing the core game plugins? I am also using Yanfly Battle Engine.

I know in ace it was as easy as changing the formula. If anyone could shed some light on this for me, I would really appreciate it. Thanks for reading my thread. :)
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
It would be the same way as you do it in Ace, via editing the formula used by the game files

Change the elementRate function from Game_BattlerBase from using traitsPi to traitsSum so that it sums the element rates and subtract the sum from 1.0

something like
Code:
Game_BattlerBase.prototype.elementRate = function(elementId) {
return (1.0 - this.traitsSum(Game_,BattlerBase.TRAIT_ELEMENT_RATE,elementId));
};
 
Last edited:

Dungeonmind

Lvl 4000 Humanoid
Veteran
Joined
Sep 2, 2013
Messages
490
Reaction score
292
First Language
English
Primarily Uses
RMMV
@Engr. Adiktuzmiko Thanks for the quick response. Would you mind pointing me in the right direction? If its not too much trouble to ask. I am by no means a coder but a little push in the right direction goes a long way lol
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I actually edited my above post with a hopefully working code. I havent tested it but in theory that should work.

PS: IDK if yanflys engine modifies that same function so IDK if this will blend well with yanfly's plugin
 

Dungeonmind

Lvl 4000 Humanoid
Veteran
Joined
Sep 2, 2013
Messages
490
Reaction score
292
First Language
English
Primarily Uses
RMMV
@Engr. Adiktuzmiko Okay so ya that seems to do the trick. Thank you so much for this. You really helped out the development of my game! :)

The only thing is doing it this way we're not able to set an enemy to be weak to an element as there is no way to set the percent to negative. This way the percents can't go passed 100% without it healing the enemy.

Basically the element rate was intended to be used for both weakness and resistance so changing the evaluation like this causes me not being able to set an enemy to be weak to an element. So in other words I can't make an enemy take 150% damage from an element anymore. I don't suppose there is another way around this??
 
Last edited:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Well, not if you're gonna use the engine's Trait box plus the current code I gave you

We will need to make it check if each individual rate is more than 100% or not, if the individual rate is greater than 100, it should count as weakness (so we need to subtract the amount that is over 100% instead of adding it). That would mean a slightlysbigger rewrite of the function which I cant do at the moment (will be hard to write in my phone)
 
Last edited:

Frogboy

I'm not weak to fire
Veteran
Joined
Apr 19, 2016
Messages
1,704
Reaction score
2,208
First Language
English
Primarily Uses
RMMV
-1 * (100 - percentage) should calculate out to numbers that can be summed together to get you what you want. You'd have to use 100% as your baseline.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,570
Latest member
fgfhdfg
Top