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. :)
Edit for how Element Rates work in MV
● ARCHIVED · READ-ONLY
-
-
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)); }; -
@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
-
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 -
@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?? -
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) -
-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.
-
I made this long time ago: https://www.dropbox.com/s/ii70q9tmpd0qm0h/YR_X_ElementalRateCode.js?dl=0