RMMV Damage Formula - ideas and help

Discussion in 'RPG Maker MV' started by Shaz, Oct 25, 2015.

  1. Cherry-sama

    Cherry-sama Veteran Veteran

    Messages:
    102
    Likes Received:
    33
    First Language:
    English
    Hey, so I've been working on balancing damage formulas in my game, and so far I've been doing alright. However, I've recently encountered a problem with the formulas on the healing spells.

    Right now I have the first level heal spell (single target) as "((a.mat / 2) + (b.mhp * 0.5)) / 2"... However, this kind of isn't doing what I was hoping it would... See, ideally, I'd like to have it so that when the player is level 1, the spell heals 50% of HP or higher. But when the player is at level 20, then they only get healed around 25%. That way, the lower level healing spells are super useful when it's all you know, but later the spell is not as useful, so they have to use higher level healing spells. However, I kinda don't want it to be a flat rate, like the default "damage" formula is, because I don't want Heal 1 to become completely useless by level 50.

    I'm not really sure how to implement that, since "((a.mat / 2) + (b.mhp * 0.5)) / a.level" is too dramatic of a curve. Any suggestions?
     
  2. Backwardskey

    Backwardskey Phones Veteran

    Messages:
    39
    Likes Received:
    11
    First Language:
    English
    Primarily Uses:
    RMMV
    m.def? shouldn't that be b.mdf?
     
  3. Backwardskey

    Backwardskey Phones Veteran

    Messages:
    39
    Likes Received:
    11
    First Language:
    English
    Primarily Uses:
    RMMV
    use a flat number to determine the power of the spell, and limit the influence of the caster's Magic stat.

    Code:
    power = 20
    healing = power * (2 + a.mat * (a.lvl + a.mat))/256
     
  4. Thothdan

    Thothdan Veteran Veteran

    Messages:
    46
    Likes Received:
    41
    EDIT2: *SOLVED*
     
    Last edited: Aug 28, 2017
  5. Cherry-sama

    Cherry-sama Veteran Veteran

    Messages:
    102
    Likes Received:
    33
    First Language:
    English
    Wow, thanks! That's a really good idea! Um...should I divide by 256? The number seems a bit high...
     
  6. worshipme

    worshipme Veteran Veteran

    Messages:
    33
    Likes Received:
    4
    First Language:
    Filipino
    Primarily Uses:
    RMMV
    @Backwardskey
    Ohh.. Did not noticed that typo! Thanksss
    Do you have any idea sir?
     
  7. thepsyche

    thepsyche Veteran Veteran

    Messages:
    251
    Likes Received:
    64
    Location:
    NZ
    First Language:
    English
    Okay so, my math has never won any awards, and I'm only just starting with damage formulas. I've come up with... *something*... but I'm unsure if what I claim it is, is in fact correct. I'm betting it's not, because of what the engine decides to work out first.

    Here's my formula:

    a.atk * 4 - b.def * 2 + (a.atk * 4 / 100 * 35)

    Now, what I INTEND for that to do, is give a boost of 35% to the total damage of the player's normal attack. The player's current atk is 10 (the enemy's defense is 12) in my tests, so that tells me the number it should get from the equation in brackets is 14... which would mean a total attack power of 54. Yet, 62 is the number I'm getting at the moment. I'm starting to realize the formula bar isn't a calculator. Where am I going wrong?

    EDIT: The answer is, I'm not! I just didn't take into account the damage of the player's WEAPON! Duh.
     
    Last edited: Sep 17, 2017
  8. Nhale

    Nhale Villager Member

    Messages:
    5
    Likes Received:
    4
    Hey everyone :)
    Quick question! How do i check in the formula if the target is equiped with a specific type of armor or weapon?
    eg. if target is equiped with a sword ( weapon type 1 in the database) buff attack, if equiped with a heavy armor (armor type 3) buff defense
     
  9. KVG

    KVG Villager Member

    Messages:
    16
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    a.hasWeapon($dataWeapons[1]) ? effect if true : effect if false;

    I don't know what the code is for armor. For buffing, you probably want to add a state in the damage formula (b.addState(15),a.addState(40)) and use the state to manipulate your buffs/debuffs

    new question

    similar to above, I want to have a conditional statement based on weapon equipped... but multiple weapons.

    How can i shorten:

    a.hasWeapon($dataWeapons[1]) || a.hasWeapon($dataWeapons[4]) || a.hasWeapon($dataWeapons[9]) || a.hasWeapon($dataWeapons[17]) || a.hasWeapon($dataWeapons[20]) || a.hasWeapon($dataWeapons[5]) || a.hasWeapon($dataWeapons[21]) || a.hasWeapon($dataWeapons[3]) || ? d=2 : d=1;
     
    Nhale likes this.
  10. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    913
    Likes Received:
    655
    First Language:
    English
    Primarily Uses:
    RMMV
    You can use Array.some() to shorten that.

    Code:
    [1,4,9,17,20,5,21,3].some(function(e){return a.hasWeapon($dataWeapons[e])}) ? effect if true : effect if false
     
    Joy Diamond likes this.
  11. KVG

    KVG Villager Member

    Messages:
    16
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    Worked like a charm, thanks

    New question: I want a cure spell that can be used on dead and alive allies, but if they're dead, it will revive them before curing them. Here is what I have... I can target dead allies and alive allies equally, but when cast on a dead ally it just casts on the next actor instead, leaving the dead ally dead and unhealed.

    a.level>5 ? d=5 : d=a.level; c=1+Math.randomInt(8)+(d) ; b.isDeathStateAffected ? b.revive() : 0; c
     
    Last edited: Oct 16, 2017
  12. Kraden96

    Kraden96 Friendly Fox Veteran

    Messages:
    31
    Likes Received:
    10
    First Language:
    English
    Primarily Uses:
    RMMV
    How would one go about showing the calculated damage of a skill in the skill's description?
     
  13. Animebryan

    Animebryan Feels like I'm slowly dying! Veteran

    Messages:
    340
    Likes Received:
    159
    Location:
    Marysville, CA
    First Language:
    English
    Primarily Uses:
    RMMV
    Is there a way to make critical hits ignore defense using the damage formula?
     
  14. Rasikko

    Rasikko Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMMV
    Edit: If anyone comes to thread, it's obviously dead and you want get help from anyone if you post here.
     
    Last edited: Nov 16, 2017
  15. freebooter

    freebooter Veteran Veteran

    Messages:
    104
    Likes Received:
    5
    First Language:
    German
    Primarily Uses:
    RMMV
    Hi guys,
    @KVG and @Ossra already showed how to check the weapon-type of the attacker. What I want to ask is how to get the ID of the target-enemy? The idea behind is, that I would like to make the damage depending on the weapon and the enemy against which it is used. For example: A pierce weapon deals less damage against a skeleton.
    How could a damage-formula that deals damage depending on weapon-type and enemy-type look like?
    Thanks for your help!
     
  16. freebooter

    freebooter Veteran Veteran

    Messages:
    104
    Likes Received:
    5
    First Language:
    German
    Primarily Uses:
    RMMV
    Guys, nobody an idea about how to check which kind of enemy the actor is targeting?
     
  17. Pharonix

    Pharonix Shadow Walker Veteran

    Messages:
    635
    Likes Received:
    274
    Location:
    Alpha Centauri Cluster
    First Language:
    English
    Primarily Uses:
    RMMV
    Having trouble with a 'Sacrifice" skill with yanfly skill core.

    I need cost to be equal to the character's current hp-1. and do that much damage.

    not sure if i should use custom cost, or custom eval.

    when using custom cost eval. can i do
    cost = user.hp-1
    then call cost in the damage formula?
     
  18. Hungry Moogle

    Hungry Moogle A Rat in the Wall Veteran

    Messages:
    34
    Likes Received:
    5
    Location:
    Hiding under your bed, drooling & very hungry
    First Language:
    English
    Primarily Uses:
    RMMV
    I was curious about creating a skill that would sacrifice half of the user's HP in order to heal the rest of the party equal to the amount given up.
    How would one go about setting up such a skill?
     
  19. Blue Symphony

    Blue Symphony Wandering soul Veteran

    Messages:
    60
    Likes Received:
    21
    Location:
    The void
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    @Pharonix
    Maybe you figured it out by now; but this is my approach to that skill, in case anyone needs something similar.
    Set up for a "Reduce your HP to 1 and convert the amount of HP sacrificed into damage" skill.
    Damage formula
    Code:
    x = a.hp-1; a.setHp(1); x;
    

    @Hungry Moogle
    This one is kinda tricky. You'll need Yanfly's Skill Core, and Yanfly's Target Core plugins.
    Set up for a "Halve your HP to heal all allies equal to the amount of HP sacrificed" skill.
    Damage formula
    Code:
    a.hp
    

    Notebox
    Code:
    <Target: All Allies But User>
    <Custom HP Cost>
    cost = Math.ceil(a.hp / 2)
    </Custom HP Cost>
    
     
    Hungry Moogle likes this.
  20. Hungry Moogle

    Hungry Moogle A Rat in the Wall Veteran

    Messages:
    34
    Likes Received:
    5
    Location:
    Hiding under your bed, drooling & very hungry
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks a lot! This actually works just as I wanted it to, including my addition of removal of Debuff status effects from allies. I just have two additional questions:

    1.) Is it possible to remove the HP cost from the menu? I feel that its presence isn't necessary, especially since the skill description mentions that it halves the user's HP, also the HP cost obscures the MP cost for the ability which is a problem.

    2.) I modified the formula for use with another somewhat similar skill that is intended to convert 1/4 of the user's HP into MP, and I've managed to get the skill working except for one small issue. The issue is that using the skill restores the user's MP for less than the amount of HP used, when the skill is supposed to restore the user's MP by the same amount of HP used. I'm guessing that the reason why this is happening, is that the amount of MP restored is based the user's HP after the HP cost is taken into account. I can't say for certain, and I'm not sure how to go about fixing it, so I included the formula for anyone whose willing to offer some advice into how I can fix it.

    Damage formula
    Code:
    a.hp * 0.25
    Notebox
    Code:
    <Custom HP Cost>
    
    cost = Math.ceil(a.hp * 0.25)
    
    </Custom HP Cost>
     

Share This Page