RMMV Damage Formula - ideas and help

● ARCHIVED · READ-ONLY
Started by Shaz 1539 posts Page 45 of 77 View original ↗
  1. @Blue Symphony Thanks for taking the time to help me out with this!
  2. Hi, I have some big ideas, but don't know enough JS to implement them properly with Yanfly's plugins. And this may not all belong here, but I'm certain some of it does. (Mods, please forgive me if I've erred, I'm still figuring this place out). I'm going to divide the two main ideas under spoiler tags, for clarity and because it's pretty long.

    The first big idea is this one, and deals with upgrading skills using damage formulas:

    Spoiler
    The gist is, using Yanfly's Skill and Damage cores, to modify the cost and damage formulas of skills based on certain variables. This would allow for a user driven skill upgrade system. For example, if a character has 100 JP, they can upgrade a skill one level and increase the damage output while increasing the cost. To elaborate, consider this simple formula:

    a.atk*5 - b.def*2

    Simple, right? It could be upgraded to do more damage, like in this way:

    a.atk*5.5 - b.def*2

    Which would make it do 10% more damage overall. Meanwhile, the cost of it could increase too. And then you could upgrade more times, say a maximum of 5, until it is doing 50% more damage over the original, which would be:

    a.atk*7.5 - b.def*2

    Anyway, here's the key point, which I'll emphasize for clarity:

    Rather than clogging up the skill list with multiple copies of each skill, varying only that little bit, I want to be able to put it all in one massive (and ugly) notetag, with each one taking effect based on a variable (the skill level) that the user has control over.

    For example, I'm envisioning something like this, except actual code:

    <damage formula>
    if (skill level = 5)
    a.atk*7.5 - b.def*2

    ...

    if (skill level = 2)
    a.atk*5.5 - b.def*2

    if (skill level = 1)
    a.atk*5 - b.def*2
    </damage formula>

    And then do the same thing with the skill costs, maybe increasing by 10% each time or whatever.

    If I'm not mistaking anything, this should be doable as I described. And I can think of some other issues, but I don't want to get TOO off-topic, as I feel I'm already pushing it.

    The second idea, and much more in line with this thread, is a twist on the standard dark knight.

    Spoiler
    A post I saw on here at one point, but cannot find, referred to a game where you could use stat points to boost attack power. This gave me an idea. I was planning on implementing a dark knight character into one of my games, but the standard version is slightly dull. The standard version, if you don't know, sacrifices health to deal extra damage. This is an interesting twist that could lead in some neat directions. For example, instead of sacrificing health, sacrifice 10 of your ATK stat to deal massive damage to an enemy, or even a whole level to clear out the field. The implementation is similar to the first part, using the damage formula plugin to use those stats as costs. I THINK it should be possible, but I'm not sure how, and that's what I'm asking here.

    To build specifically off of my examples, consider these formulas, which are ones I'm considering:
    <damage formula>
    if ATK is greater than 100
    subtract 10 from ATK
    a.atk*10 - b.def*2
    </damage formula>

    Or this one, the level one that clears the field:
    <damage formula>
    if level is greater than 50
    subtract 1 level
    b.hp (or whatever will deal damage equal to all enemies current HP)
    </damage formula>

    The advantage to that second one is that you could give it a unique element, and then make bosses 50% resistant to that element, which, if I'm right, should cut their current HP in half instead of outright killing them, still making it useful against bosses without being broken. But I'd need to test that, and I'm going to bed right after finishing this post.

    So yeah, if you read all that, many thanks, and I hope you can give me some advice!
  3. Hello guys! Is there a way to make a damage cap of 9999 that applies AFTER variance?
  4. Hello all, I have a question about a healing talent that I'm trying to implement:

    I want to have it so that the healer receives a % of health back relative to what he heals. ie. heals for 100 on ally, gets healed for 25 himself.

    I've got formulas that do this:

    Spoiler
    heal=(200+a.mat); a.gainHp(Math.floor(heal*.2)); heal; // this works just fine in the damage formula

    <Post-Damage Eval>
    var heal = Math.floor(value * 0.25);
    a.gainHp(-heal)
    </Post-Damage Eval> // this works just fine in the notes

    The problem I'm having is that I need the caster heal effect to be activated conditionally. ie. when a variable is equal to or higher than 19

    My scripting knowledge sucks massively, so I'm probably just doing this wrong... but if anyone can see the obvious solution that would be ace.

    I'm trying:
    v[5]>=19 ? heal=(200+a.mat); a.gainHp(Math.floor(heal*.2)); heal : (200+a.mat)

    Any help would be much appreciated. Thanks!
  5. Hello, I have been stressing out over this damage formula I'm trying to use. I was wondering if anyone could possibly help me understand what I'm getting wrong.

    Attack VS Defense
    (Math.randomInt(20)+1+a.atk) > (10+b.def) ? Math.randomInt((8), 4)

    The whole idea is to have an attack value play against a defense value to determine to hit. Like attack bonus vs armor class in Dungeons and Dragons

    I've even gone so far as to try and make this one work as well. replacing the values of course but i just keep getting errors or just keeps returning 0 damage.

    Spoiler
    If (b.def <= (Math.randomInt(20) + 1 + (Math.Floor((a.atk – 10)/2) + (Math.Floor(a.lvl / 2)) )) Math.random((X*Y), X) + 1 + (MOD – Math.Floor(a.level/2)); else 0

    It seems like everything I have tried either just doesnt work or im doing everything completely wrong.
  6. HatJump said:
    Hello all, I have a question about a healing talent that I'm trying to implement:

    I want to have it so that the healer receives a % of health back relative to what he heals. ie. heals for 100 on ally, gets healed for 25 himself.

    I've got formulas that do this:

    Spoiler
    heal=(200+a.mat); a.gainHp(Math.floor(heal*.2)); heal; // this works just fine in the damage formula

    <Post-Damage Eval>
    var heal = Math.floor(value * 0.25);
    a.gainHp(-heal)
    </Post-Damage Eval> // this works just fine in the notes

    The problem I'm having is that I need the caster heal effect to be activated conditionally. ie. when a variable is equal to or higher than 19

    My scripting knowledge sucks massively, so I'm probably just doing this wrong... but if anyone can see the obvious solution that would be ace.

    I'm trying:
    v[5]>=19 ? heal=(200+a.mat); a.gainHp(Math.floor(heal*.2)); heal : (200+a.mat)

    Any help would be much appreciated. Thanks!
    I don't know if it'll work, but you could try

    c=(200+a.mat); v[5]>=19 ? d=Math.floor(c*0.25): d=0; a.gainHp(d); c


    The idea here is... first I eliminated the name heal, since it'd be longer and used for the damage too. then I put an else, that I don't know if that kind of check works without one (as far as I knew, it doesn't), and made if so another variable is set to either a quarter the damage or 0, said variable is used to heal, and then the damage is done.

    Vahngalvan said:
    Hello, I have been stressing out over this damage formula I'm trying to use. I was wondering if anyone could possibly help me understand what I'm getting wrong.

    Attack VS Defense
    (Math.randomInt(20)+1+a.atk) > (10+b.def) ? Math.randomInt((8), 4)

    The whole idea is to have an attack value play against a defense value to determine to hit. Like attack bonus vs armor class in Dungeons and Dragons

    I've even gone so far as to try and make this one work as well. replacing the values of course but i just keep getting errors or just keeps returning 0 damage.

    Spoiler
    If (b.def <= (Math.randomInt(20) + 1 + (Math.Floor((a.atk – 10)/2) + (Math.Floor(a.lvl / 2)) )) Math.random((X*Y), X) + 1 + (MOD – Math.Floor(a.level/2)); else 0

    It seems like everything I have tried either just doesnt work or im doing everything completely wrong.
    Could you explain to me that "Math.randomInt((8), 4)" thing? Because as far as I know randomInt only got one argument...
    Anyway, I personally think the problem is a lack of a : part, the else. Even if you make it : 0.
    So it could be

    (Math.randomInt(20)+1+a.atk) > (10+b.def) ? Math.randomInt(8) : 0
  7. Waterguy said:
    c=(200+a.mat); v[5]>=19 ? d=Math.floor(c*0.25): d=0; a.gainHp(d); c

    This works in terms of the formula and the effect, thanks! I also wanted it to not display any healed amount when the talent was disabled, as it currently shows a 0 every time with that formula.

    I changed it as follows and it now only displays a heal amount once the talent is active:

    c=(200+a.mat); v[5]>=11 ? d=Math.floor(c*0.25): d=0; v[5]>=11 ? a.gainHp(d): d=0; c

    It basically just checks the variable again and only runs the user heal if it's high enough.
  8. @HatJump

    You can't remove the zero from the damage formula as messes up the short hand code.

    Try this:
    c=(200+a.mat);if($gameVariables.value(5) > 11){ a.gainHp(Math.floor(c*0.25));} c;

    It should be all one long line.
  9. HatJump said:
    This works in terms of the formula and the effect, thanks! I also wanted it to not display any healed amount when the talent was disabled, as it currently shows a 0 every time with that formula.

    I changed it as follows and it now only displays a heal amount once the talent is active:

    c=(200+a.mat); v[5]>=11 ? d=Math.floor(c*0.25): d=0; v[5]>=11 ? a.gainHp(d): d=0; c

    It basically just checks the variable again and only runs the user heal if it's high enough.

    The Math.randomInt((8), 4) was supposed to be a damage +4. I however did make a different combination work in the form of:

    Spoiler
    if (b.def <= (Math.randomInt((20), a.atk) +1; ){ Math.randomInt((8), a.atk) +1;} else { 0 }
    Although the above formula seems to work there seems to be a lot of zeros happening when the number to beat is just 8 b.def, almost like +a.atk isn't being added and the damage rolls supposedly being 8+ a.atk seem to be doing nothing higher than an 8
  10. it isn't being added. Math.randomInt((x), y) does not add y to the result of Math.randomInt(x).

    Try:
    if (b.def <= (Math.randomInt(20)+a.atk +1) { Math.randomInt(8)+a.atk +1} else { 0 }
  11. Hey y'all. I actually don't have a question, just a little nugget for those that may want it.

    In Mobius Final Fantasy, Magic is used as a percentage multiplier on ability damage, and the base damage comes from the ability being used. So in a side project I'm doing, I managed to replicate this process and add a little spin of my own to it, for a more RPGish feel by using Himework's Weapon Damage plugin. It allows you to assign a damage formula/value to a weapon via notetags, so we can have things like FFVII's Ultima Weapon (Damage scales with higher HP) or FFVI's Valiant Dagger (Damage scales with lower HP)

    a.weaponDamage(b) * (1 + (a.mat / 100))

    a.weaponDamage(b) is how you reference the weapon formula. So because we can't exactly make RPG Maker recognize Magic as a percentage, we have to cheat a little and make it a constant multiplier. So, if your Magic stat was 50, this formula would spit it out as

    a.weaponDamage(b) * 1.5

    And so on. If you want, you can replace a.mat with whatever stat, or with a variable by writing v[x], to make it consider whatever variable you shove in the x spot.

    Here's a link to Hime's plugin:
    http://himeworks.com/2016/02/weapon-damage/
    And a quick script a Redditor made to display magic as a percentage:


    Happy Hunting!
  12. Greetings! i wanted to create a simple damage formula, which checks what enemy id is being targeted. I'm using several plugins from yanfly such as BattleEngineCore, SkillCore, DamageCore, TargetCore, ..., etc.
    Code:
    <damage formula>
    if (b.enemyId() === 1) a.atk - b.def;
    </damage formula>
    But that doesn't really work, because the damage output is always 1. So i may have forgotten something to write down or the code needs to be somewhere else.
    Any ideas how this can be fixed?
  13. try
    Code:
    <damage formula>
    if (b.enemyId() === 1) value = a.atk - b.def;
    </damage formula>
    because I think your problem is the lack of the "value ="
  14. Waterguy said:
    try
    Code:
    <damage formula>
    if (b.enemyId() === 1) value = a.atk - b.def;
    </damage formula>
    because I think your problem is the lack of the "value ="
    Worked, thanks for the reply and sorry for the noob question.
  15. no problem
  16. So i was wondering, we can call a common event from a skill and i actually wanted to refer to the targeted enemy id inside the common event of that skill and make conditional branches and do stuff by probabilities and stuff.

    Is it possible to contain the enemy id into a variable, so it can be further used in a common event?
    Because when i, for example, make different damage formulas for different enemy id's and put them into a single skill, it would be quite long and not easy to read.
  17. Is it possible for the damage formula to ignore a portion of the sp-paramater "damage reduction" ?

    I know that setting a skill to "certain hit" will completely ignore it - but what if I only wanted to only ignore 25% or 50% of it?

    For example, say an enemy has 50% physical damage reduction. Now say I want to make a skill that will ignore half of the enemy's physical damage reduction.

    Note: i want to use the sp-parameter for this, and not elements, because elements play a different role in my game.

    Thanks in advance if anyone can help me.
  18. Is it possible to add skill mp cost to damage formula? I've tried using many Yanfly plugins commands, but I don't understand much script codes so I've probably messed up somewhere... ^^"

    What I'm trying to do is something like this, where 'X' will be the skill mp cost.

    [ ( X + a.atk*4 + a.tp ) * ( 1 + (a.mp+X)/250 ) * ( 1 - b.def/500 ) ]

    I've found out the command 'a.skillMpCost(X)' returns the MP cost of skill, but I just can't make it work in the damage formula. Does anyone knows how to make it work? Thanks in advance! =D
  19. Is it possible for the damage formula to ignore a portion of the sp-paramater "damage reduction" ?

    I know that setting a skill to "certain hit" will completely ignore it - but what if I only wanted to only ignore 25% or 50% of it?

    For example, say an enemy has 50% physical damage reduction. Now say I want to make a skill that will ignore half of the enemy's physical damage reduction.

    Note: i want to use the sp-parameter for this, and not elements, because elements play a different role in my game.

    Thanks in advance if anyone can help me.
    @jonthefox

    If you AREN'T using Yanfly's Armor Scaling, then this gets easy. Just take X - (b.def * 0.6) if you want a 40% reduction, or whatever you want. If you are using that plugin, then best of luck to you.