Change how Elemental Damage works

Uzi_Man

Veteran
Veteran
Joined
Jun 29, 2016
Messages
41
Reaction score
0
First Language
Spanish
Primarily Uses
I'll try to explain myself. What I want to do is change how elemental weaknesses / resistances affect the resulting damage from all attacks so that instead of multiplying the result of the dmg formula by the elemental modifiers, it actually doubles ATK / MAT for that attack or changes the damage formula so that it practically does the same.


For example, say that Fireball has a damage formula of "a.mat - b.mdf", and there's an enemy with 500% weakness to Fire (*500% Element Rate). By default, if the attacker had 100 MAT and the enemy had 100 MDF, the resulting damage (without counting elemental weaknesses) would be zero. Then you multiply that final value by 5 (500% weakness to Fire), and it still gives zero, because that's what the final result was, and even if the same enemy had 1.000.000% weakness to Fire, it will always result in null damage, which doesn't feel very intuitive, because instead of MDF being a part of the enemy itself, it seems as if the enemy's MDF was some sort of "external shield", unaffected by elemental damage, which protects the enemy who IS affected by the elemental weakness and the damage who managed to penetrate this shield. And a single point less in MDF would make a huge difference because the result would be 1 instead of 0, and so it would be affected by the huge elemental modifiers, which again, isn't a very intuitive system.


So, what I want to do is that elemental weaknesses affect ATK / the damage formula directly. So, if the enemy has 200% weakness to fire (*200% Elemental Rate) and the Fireball had an attack formula of "a.mat - b.mdf" (against enemies with neither weaknesses nor resistances, or *100% elemental modifer), then the Fireball would count as "(a.mat * 2) - b.mdf" when attacking that enemy. And if he had 50% weakness to Fire (*50% Elemental Rate, which is actually resistance instead of weakness), then it would be "(a.mat * 0.5) - b.mdf", and so on. Or instead of that, it simply multiplies the attacker's ATK / MAT when attacking enemies by the elemental modifier of the enemy depending on the skill used (if the skill used was a Water attack, and the elemental modifier is *153%, then ATK / MAT would be multiplied by 1.53 right before executing the Water Attack). That way, MDF would actually feel as a part of the enemy, making attacks feel more intuitive.


I'm 99% certain this is going to require a script, but I haven't found anything related to this, so I'd appreciate any help on the subject.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,668
First Language
German
Primarily Uses
RMMV
I've moved this thread to Script Request. Please be sure to post your threads in the correct forum next time. Thank you.



Yes, it will require a script - and you haven't found anything because this would require a big rewrite on the core battle mechanics.


Given the fact that most scripters moved on to MV in addition to the complexity this would need, your chances of getting such a script are extremely low.


A better solution (in my opinion)  would be to ask for a new value to change ATK/MAT based on that and leave the elemental calculations unchanged - that is still a lot of work, but less work than a complete rewrite of the elemental damage system.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
I think you can do this in the damage formula, as the command element_rate(x) returns the element rate of someone for element x (x as defined in the system tab). Try this and see what happens for the damage formula (assuming element 1 is Fire, if not, change 1 to whatever element Fire is):


(a.mat * b.element_rate(1)) - a.mdf


Edit: Tested it with the default slime which is weak to Ice and used b.element_rate(4) and it did double damage. So no script required after all. Just add in * b.element_rate(x) in the appropriate spot in your damage formula, with x the right element and it will work.
 
Last edited by a moderator:

deilin

Ranger/Elementalist
Veteran
Joined
Mar 13, 2012
Messages
1,188
Reaction score
172
First Language
English
You just have to add another element in damage calculation. if a.mat < b.mdf then the attack adds life to the enemy because -damage add health to enemy.


[(a.mat * b.element_rate(x)).to_i - b.mdf, 0].max


I've seen it also where damage is capped by a variable. Say Variable[Y] is 100.


[[(a.mat * b.element_rate(x)).to_i - b.mdf, 0].max, /v[Y]].min
 
Last edited by a moderator:

Uzi_Man

Veteran
Veteran
Joined
Jun 29, 2016
Messages
41
Reaction score
0
First Language
Spanish
Primarily Uses
Thanks, I'll try those methods 
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
I think you can do this in the damage formula, as the command element_rate(x) returns the element rate of someone for element x (x as defined in the system tab). Try this and see what happens for the damage formula (assuming element 1 is Fire, if not, change 1 to whatever element Fire is):


(a.mat * b.element_rate(1)) - a.mdf


Edit: Tested it with the default slime which is weak to Ice and used b.element_rate(4) and it did double damage. So no script required after all. Just add in * b.element_rate(x) in the appropriate spot in your damage formula, with x the right element and it will work.


That should be:


(a.mat * b.element_rate(1)) - b.mdf


You used the attacker's MDF, which I believe is not what you wanted to use.


Still, this will not work.


You multiplied the base damage by the resistance of the enemy.


But in the damage calculation, there will be another resistance calculation which will further multiply the damage done, effectively leading to an excess amount of bonus damage for any weakness.


If you want an exact example, the damage went from 2 (no weakness on the enemy at all) to 24 or 12 (based on the different skill settings I used) using the default database setup.


In all cases, I used the above mentioned formula (just changed the element ID to 4 - Ice), set the variance of the skill to 0, and disabled critical hits.


The attack does 2 damage if I remove the element weakness from that poor Slime. The element of the skill doesn't matter here, be it Normal or Ice, they both do the same damage.


The attack does 12 damage if I add back the 200% Ice damage rate feature for the Slimy, and IF I keep the element of the skill on Normal Attack.


The attack does 24 damage if I add back the 200% Ice damage rate feature, and IF I set the skill's element to Ice as well.


As you can see, none of them does double damage, they do much more.


For this formula to work, you would need to remove the default elemental damage calculations, or else they will keep multiplying the already multiplied damage values even further.


But even if you do this, the damage you would expect from your formula will NOT be based on actual resistance/vulnerability values. 


Based on the attacker's ATK/MAT, the damage difference will be HUGE for every little resistance/vulnerability the target got.


Just do the math, you will see why. You multiply the attack part only, which renders the defense part quite useless on higher levels (assuming your stats will rise considerably on higher levels).


Quite honestly, the default way makes much more sense.


If someone's inner defense against magic is very high, it is natural that it will be hard to damage them with magic using low magic attack power, regardless of their resistances/vulnerabilities. 


If I were you, I would just set the minimum damage to 1 in the formula, so no matter how poorly the attacker damaged the target, the base damage will never be 0, so their resistances/vulnerabilities will show up for sure.


The final damage can still be 0 based on elemental resistances or magic/physical resistances because those come after the damage formula calculations (this would indicate that the enemy got some resistances for sure), but if the enemy got some weakness, it will show up in the damage done too (clearly indicating that the enemy got a weakness).
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
@Sixth: Yeah, I did forget about the fact it would multiply it again. Though the OP can balance that by clever math with the numbers. For instance, using 200% when you want it to be 400% damage (2 * 2). As long as the number is never displayed to the player they won't know it is being applied 2x.


Though I do agree with you, it would be easier to rework the formulas so that the default method works better. But that's another topic altogether.
 

deilin

Ranger/Elementalist
Veteran
Joined
Mar 13, 2012
Messages
1,188
Reaction score
172
First Language
English
you can always take out the second time it multiplies in the script, if you're up for it.


in all my games, I change the calculate damage in script to function completely different anyhow.
 
Last edited by a moderator:

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
Insert this script into your scripts editor to "disable" the default elemental damage calculation then do the elemental calculations inside your damage formula to suit your needs

Code:
class Game_Battler
  #This way the game's default element calculation will just multiply the
  #damage by 1.00
  def item_element_rate(user, item)
    return 1.00
  end
end
 
Last edited by a moderator:

Uzi_Man

Veteran
Veteran
Joined
Jun 29, 2016
Messages
41
Reaction score
0
First Language
Spanish
Primarily Uses
@Sixth Well, I was thinking of magic defense not as an universal value, but rather as something that is affected by the creature's elemental strengths and weaknesses. So if someone with 100 MAT throws a fireball at an enemy with 100 MDF, and the enemy wasn't neither weak nor resistant to Fire, then the damage would be nullified (a.mat - b.mdf), but if the enemy was attacked with a spell of the same power -say, an energy bolt-, but the enemy is weak to Lightning (*200% Element Rate Lightning), then the attacker's spell would pierce through the enemy's magic defenses, which can't stop Lightning attacks very effectively due to the enemy's weakness to this element, which also affects the effectiveness of his general magic defense against spells of this elemental affinity. This would result in being able to damage the enemy with an energy bolt (a.mat * 2 - b.mdf), while failing to do so with a fireball (a.mat - b.mdf), even if both spells have the same magic power.


But what you say also makes sense, as in magic defense being universal, unaffected by elemental damage and surrounding the creature's body and protecting it, while the creature itself can be weak or resistant to certain elements. So if its magic defense is penetrated, the damage that passed through gets amplified or reduced by the creature's elemental resistances and weaknesses. But if the creature's universal magic defense is higher than the spell's power, then regardless of how weak the creature is to the element of that spell, its damage will always get nullified thanks to the magic defense, which acts as a sort of external energy shield, just like in the default system. I guess it depends on the setting.


On-topic, I'm going with the default system in the end. It could work if the stats are balanced enough, even if it doesn't fit the idea I originally wanted (using low-level elemental weapons against high level bosses that are weak to certain elements won't be effective because those weapons have low ATK and won't pierce the bosses's -universal- defense, so regardless of how weak they are to those elements, the weapons will never damage them. I wanted the contrary of that, with those weapons being able to pierce through their defenses easily due to the bosses's elemental weaknesses that also affect the effectiveness of their magic defenses against certain elemental attacks)


Anyway, thanks for all the fast answers, I really appreciate it. I'll try to find a way to make the default system work


Edit: Didn't see the post above, I'll try that script
 
Last edited by a moderator:

Uzi_Man

Veteran
Veteran
Joined
Jun 29, 2016
Messages
41
Reaction score
0
First Language
Spanish
Primarily Uses
Insert this script into your scripts editor to "disable" the default elemental damage calculation then do the elemental calculations inside your damage formula to suit your needs



class Game_Battler
#This way the game's default element calculation will just multiply the
#damage by 1.00
def item_element_rate(user, item)
return 1.00
end
end


It WORKS! Thanks a lot, you saved a key strategy on my game
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,975
Members
137,563
Latest member
cexojow
Top