RPG Maker Forums

While poking around with VX Ace's base scripts, I figured a way that I could make effects from features add together instead of being multiplicative—for example, two "120%" features would total 140%, not 144%. I did this by going into Game_BattlerBase and taking this method:


def features_pi(code, id)
features_with_id(code, id).inject(1.0) {|r, ft| r *= ft.value }
end


...and creating this alternate method which I use in place of "features_pi" for the standard parameters:


def features_xsum(code, id)
features_with_id(code, id).inject(1.0) {|r, ft| r += (ft.value - 1) }
end


I tested this with an actor with 100 in ATK and DEF, plus three different equipment items that each have difference ATK and DEF features but no static increases to the parameters. And from my testing, the method I create does seem to properly result in the parameter features having an additive effect...except for some reason, sometimes it's 1 point off from what it should be.


The three test items I'm using are a weapon with "DEF * 90%", clothes with "DEF * 110%", and a shield with "DEF * 125%". With all three together, the actor has 125 DEF (100 - 10% + 10% + 25%). If I remove the weapon, their DEF becomes 135 as it should be. Most combinations of the three items give the proper value, but if I equip the weapon with the shield, the DEF displayed is 114 when it should be 115 (100 - 10% + 25%). Doubling the actor's ATK and DEF still results in the DEF being one point lower (229) than it should be (200 - 10% + 25% = 230) when the weapon and shield equipped.


What could be causing this problem, and how would I correct it?

Latest Threads

Latest Posts

Latest Profile Posts

On my journey of character rework: I had this character, she was meant to be just a princess that joins your party. And at long term she was just uninteresting... So I tweaked her to be a rebel agaisn't the royalty before meeting up with the party.

Quick tip for any other ametuer pixel artists! When trying to create a colour palette, enabling Antialiasing can speed up the process of creating different shades! Just place your lightest colour and your darkest colour next to each other, select both pixels, and stretch it out!
Revolutionizing the JRPG Industry: Knocking on Doors.

Take that, murderhobos.
Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.

Forum statistics

Threads
106,054
Messages
1,018,580
Members
137,843
Latest member
Betwixt000
Top