RMMV Yanfly Element Core, slight issue?

ZankokuNoYami

Veteran
Veteran
Joined
May 11, 2018
Messages
124
Reaction score
30
First Language
English
Primarily Uses
N/A
So I am using this plugin:

I have it set to ADDITIVE. This is because my game revolves around dual elements. Every character attack and spell has dual elements (really, i define them as one Element and one Attribute... it is set to encourage you to use strategy to always ensure maximum damage).

What this results into is one of several equations:
50% + 50% = 0 damage
50% + 100% = 1/2 damage
100% + 100% = normal damage
50% + 200% = 1.5x damage
100% + 200% = 2x damage
200% + 200% = 4x damage

The ONLY issue is when I reach 200% + 200%... I get 300% instead of 400%, or, 3x instead of 4x damage. And 200/100 + 200/100 in math is 4... when turned into a percentage, is 400. Or a simple multiplication of damage x4. So not sure WHERE the math is going wrong or WHY. Can the plugin not do math beyond 400%? Is that a core restriction somewhere?

All I need is this last thing to work and this plugin will do exactly what I need it to do, haha. Any help would be appreciated!

1603925902875.png
1603925944546.png
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,043
Reaction score
1,472
First Language
EN
Primarily Uses
RMMZ
Remember 100% is normal output:
  • 50% is -50% from that; 2 * -50% is -100%, giving 100% - 100% = 0%.
  • 100% is +0% from normal; 2 * +0% is still 0%, i.e. 100% normal output.
  • 200% becomes +100%; 2 * +100% is +200%, giving 100% + 200% = 300%.
 

ZankokuNoYami

Veteran
Veteran
Joined
May 11, 2018
Messages
124
Reaction score
30
First Language
English
Primarily Uses
N/A
Remember 100% is normal output:
  • 50% is -50% from that; 2 * -50% is -100%, giving 100% - 100% = 0%.
  • 100% is +0% from normal; 2 * +0% is still 0%, i.e. 100% normal output.
  • 200% becomes +100%; 2 * +100% is +200%, giving 100% + 200% = 300%.
Yeah, that is why when I had 100% and 100% (basically, no weakness or strength) I figured it would equal 100%. Exactly as intended.

But why is 200% becoming 100%? I understood the math perfectly up until that and it actually produced the exact numbers based on my formula until I hit 200% + 200%.

And is there anyway to make it actually do that? Because the idea is basically 50% for strong against, 100% for neither, 200% for weakness. So you are doing 1/2 damage per enemy strength, and 2x damage per enemy weakness. Allowing a 4x damage total.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,043
Reaction score
1,472
First Language
EN
Primarily Uses
RMMZ
Try thinking in terms of the bonus damage:
  • 50 is 100 - 50 => -50%
  • 100 is 100 + 0 => +0%
  • 200 is 100 + 100 => +100%
This bonus/malus combines additively:
  • 50% & 200% => -50 + 100 = +50 = 50% more damage;
  • 100% & 50% => 0 - 50 = -50 = 50% less damage;
  • 200% & 200% => 100 + 100 = +200 = 200% more damage.
For 4x normal damage with two weaknesses, you'd need element rates of 250%. That's a bonus of +150% each, yielding +300% for two: 100% + 300% = 400%.

I'm not sure how to achieve what you're seeking...I think you'd need an element combination formula more complicated than simple addition, but maybe someone else has some creative ideas~
 

ZankokuNoYami

Veteran
Veteran
Joined
May 11, 2018
Messages
124
Reaction score
30
First Language
English
Primarily Uses
N/A
I see... that is a lot different than the additive that it felt like it was doing up to that point. Since yeah, all I want is it to add up the damage twice... or simply multiply the damage by 4.

I am no expert, naturally, but I feel it would just need some sort of else or if case. Like 'if element 1 = 2 and element 2 = 2, then damage is = x4' or whatever the proper language would be. Since this is a very specific case in which there would be no further variables. Every character has one element and one attribute. Every enemy has a weakness to one element and attribute and one strength to an element and attribute.

Thanks for the run down! When I hear additive, I am throwing it into a calculator going base damage x (element + element). Where it adds up the bonus damage from the elements (2 and 2) and just multiplies the damage by the result. Super simple easy math, haha.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,043
Reaction score
1,472
First Language
EN
Primarily Uses
RMMZ
Thanks for the run down! When I hear additive, I am throwing it into a calculator going base damage x (element + element). Where it adds up the bonus damage from the elements (2 and 2) and just multiplies the damage by the result. Super simple easy math, haha.
Note that while that does give you the 400% you're after, it's not consistent with the other values, e.g.
  • 50% & 50% => 50 + 50 = 100 = normal damage?
  • 100% & 100% => 100 + 100 = 200 = double damage?
  • 200% & 200% => 200 + 200 = 400 = 4x damage!
Luckily in this case it sounds like you have only very specific cases for element rate, so you can use a piecewise/case-based formula like you mentioned~ :kaophew:

I wrote a quick extension for Element Core that I think should do what you want; it's running the code, but I haven't really tested damage outputs. Either save the code below as a .js file and import as a plugin, or ditto with the attachment (the file name doesn't matter).
  • Make sure the extension loads after YEP_ElementCore.
  • Set Element Core's "Multi-Element Rulings" parameter to 5 (via the Text tab).
  • Save your project to apply plugin changes before testing.
JavaScript:
(function(alias) {
    Game_Action.prototype.calcElementRateRule = function(target, elementId, finalRate, eleRate, rule) {
        finalRate = alias.apply(this, arguments);
        switch (rule) {
            case 5:
                if (finalRate === undefined) finalRate = eleRate;
                else if (eleRate === 2 && finalRate === 2) finalRate = 4;
                else finalRate += eleRate - 1;
                break;
        }
        return finalRate;
    };
})(Game_Action.prototype.calcElementRateRule);
 

Attachments

ZankokuNoYami

Veteran
Veteran
Joined
May 11, 2018
Messages
124
Reaction score
30
First Language
English
Primarily Uses
N/A
I forgot to reply to this, wow.

Yes, that small edit did exactly what I needed. Thank you so much!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

rux
The most words I have ever written in an entire document is in my game's script, jeez i have a lot of characters that ramble on
Yes! I finally did something! This is a picture I drew of what I wish I looked like; I hope that you guys like it!
Finished that egg-sitting mini-game I mentioned here a couple weeks back. Now to fix the weather system so it doesn't rain indoors while you're playing it. >.> A simple fix in itself; leave it to me to take it as an excuse to completely revamp the time/weather/lighting system from scratch.
I'm really tempting to pre order cyberpunk 2077... should I do it or not :/ I really want to play the game but don't want to take a big hit to my saving because of it

Forum statistics

Threads
105,485
Messages
1,014,096
Members
137,138
Latest member
DawnStar
Top