RMMV Damage Formula - ideas and help

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

  1. Professor_Ruffleberg

    Professor_Ruffleberg Villager Member

    Messages:
    15
    Likes Received:
    0
    You use a.agi to call the attackers' agility into the damage formula.

    Very basic formula would be: a.agi*a.atk
     
  2. Hoppy

    Hoppy Veteran Veteran

    Messages:
    326
    Likes Received:
    54
    First Language:
    English
    So a variable was wrong thanks.
     
  3. jonthefox

    jonthefox Veteran Veteran

    Messages:
    1,291
    Likes Received:
    450
    Location:
    NYC
    Is there a way to search this particular thread?  I have a quick question that I'm sure was answered in here, and I'm sure I'll have others...maybe can we have a FAQ in the first post that gives the formulas for all the different commonly asked questions i.e., "how do i make a skill also damage mp/tp", etc.
     
    Marianojoey likes this.
  4. JumbocactuarX27

    JumbocactuarX27 Veteran Veteran

    Messages:
    86
    Likes Received:
    39
    First Language:
    English
     When you're viewing a particular thread, if you look at the top of the page there is a search bar and you will see a small gray box in it with the words "This Topic". Typing in the search box and hitting enter will let you search just this thread.
     
    Marianojoey and jonthefox like this.
  5. jonthefox

    jonthefox Veteran Veteran

    Messages:
    1,291
    Likes Received:
    450
    Location:
    NYC
    Excellent, thank you!
     
  6. Rigor Mortex

    Rigor Mortex Mankind's Mirror Veteran

    Messages:
    58
    Likes Received:
    3
    Location:
    Dark World
    First Language:
    English
    I have five (possibly six) formulas that I wanted to convert to work in MV, but I don't know how or what to change.

    [(d=((a.atk*0.5-0.25*b.def)*v[11])/100;$game_variables[11]=[v[11]-20,50].max;d;), 999].minThe first code (above this line) was tied to a skill that hit all enemies, but did progressively less damage to each enemy after the first, but only down to half normal damage (iirc; I haven't messed with the code for ages). The damage is regardless capped at 999.

    [((rand(3)) + a.mdf), 100].minThe second code (above this line) was tied to a skill that reduced an enemy's MP based on a random number plus the user's "Level" (which replaces Magic Defense). The damage is capped at 100. EDIT: My Ace .min and .max formulas don't seem to work anymore. What do I have to change them to to get the intended results?

    [(([rand(10), 5].max) + (a.mdf * 0.5 + a.agi * 0.051)), 100].minThe third code was tied to a skill that stole MP from an enemy based on a random number from 5 to 10, plus a formula involving the user's "Level" and Agility, with a cap of 100.

    d=[(a.atk/2-b.def/4), 999].min;a.hp+=[d/2,100].min;dThe fourth code was tied to a skill that works like the basic attack, but restores HP to the user equal to half the damage inflicted (healing capped at 100). The damage is capped at 999.

    $game_variables[8]=a.id;The fifth/final code is more of a debug formula, and is used by some skills and several items; what it does is get the target's Actor ID and store it in a variable (variable 8, in this case). This was done to make some things much easier, and not require a ridiculous number of copies of the same event/branches to perform a few things for the many different actors.

    Lastly:

    d=[(a.atk*0.8-b.def*0.4).to_i, 999].min;a.hp+=[d/4,100].min;dThis sixth code is similar to the above, but does more damage and hits all enemies, and is tied to a TP skill. Again, the damage is capped at 999. The problem is I can't remember what "to_i" does in VX Ace, nor why the formula is set up slightly differently from the previous one. 
     
    Last edited by a moderator: Nov 4, 2015
  7. BloodletterQ

    BloodletterQ Chaotic Neutral Assassin Veteran

    Messages:
    1,450
    Likes Received:
    1,047
    Location:
    My head's in the clouds at least...
    First Language:
    English
    Primarily Uses:
    N/A
    I changed the formula up some using the attacker's level (small numbers barely do anything) and I have a 40 STR character dealing less damage with a sword (STR-based) than a 33 DEX character dealing more damage with a bow (DEX-based.) 
     
  8. McDohl

    McDohl Villager Member

    Messages:
    5
    Likes Received:
    1
    First Language:
    Indonesia
    Hello Everyone,

    so I want to make skill that is like in the game Breath of Fire IV, one of the astral dragon attack that makes all HP opposed to 1

    I tried Math.max(b.hp) - 1 , it didn't work, it just kill 1 or 2 character

    also I want to create skill that will deflect this attack with another skill, like in Tales Of Eternia in ps1, aurora wall that will deflect the effect of dark aurora sword

    maybe something like, whenever enemy use HP to 1 skill, Hero will use the deflect skill automatic
     
  9. Rigor Mortex

    Rigor Mortex Mankind's Mirror Veteran

    Messages:
    58
    Likes Received:
    3
    Location:
    Dark World
    First Language:
    English
    Can't help with the second one, but for a Heartless Angel-type effect, just use 

    b.hp - 1This will always do damage equal to the target's current HP - 1 unless they have any form of resistance/weakness to the skill's element, which I don't know how to fix.
     
    Last edited by a moderator: Nov 4, 2015
  10. VHStapes

    VHStapes Game Designer Veteran

    Messages:
    57
    Likes Received:
    7
    Location:
    Vashon, Wa
    First Language:
    English
    For the second part, you could make a skill that applied a state that guarded from the Breath of Fire skill specifically by making it apply a state (you could also make this state passive using plugins).

    So, you have Heartless Angel that reduces all enemies to 1 hp. Then, you could have a state called Guardian Angel that protected from it. Let's say Guardian Angel is state #777 in the database. The formula for Heartless Angel would look like

    x = (b.isStateAffected(777) ? 0 : b.hp - 1); xI think at least, I'm still getting the hang of this as well!
     
  11. McDohl

    McDohl Villager Member

    Messages:
    5
    Likes Received:
    1
    First Language:
    Indonesia
    Thank you for the reply,

    I tried the formula, it still give me random result, first the skill kill all of my character, then next try, it just kill 2 of my character,

    or am I doing it wrong ?.. this is my first time using rpg maker

    basically the skill will not look any resistance element, it just turn all HP opposed to 1 despite lvl opposed is lvl 1 or 99
     
    Last edited by a moderator: Nov 4, 2015
  12. McDohl

    McDohl Villager Member

    Messages:
    5
    Likes Received:
    1
    First Language:
    Indonesia
    Thank you for the reply,

    Okay, so I create skill for example "Shield" to deflect "Sword"

    in database skill section "Shield" is number 21, and "Sword" is number 20

    in "Sword" formula bar I typed x = (b.isStateAffected(21) ? 0 : b.hp - 1); x

    in "Shield" I didn't type anything in formula bar (well, I have an idea that this magic will have healing element when not encounter the "Sword" skill, still thinking about the formula though)

    I set the Hero to have skill "Shield" in classes section "hero job skill"

    I try battle in Troops section, battle test mode

    I make Hero do skill "Shield" in the beginning it show animation but not giving anything (formula bar is still empty)

    when the boss do the "Sword" skill it still give random result, 1 of character death, 2 remain half HP, 1 remain 10 (all HP Character is 450 and in still lvl 1)

    next try, I didn't make Hero do skill "Shield" in the beginning, and the result, 2 of my character death, 1 remain 10, 1 remain half

    so where is my error ?

    and sorry for the language

    Forgot to mention I use battle core yanfly plugin
     
    Last edited by a moderator: Nov 4, 2015
  13. stupid enough to like FF13

    stupid enough to like FF13 Veteran Veteran

    Messages:
    587
    Likes Received:
    316
    First Language:
    English
    Did you set the Variance to 0 for that skill? Once the game calculates the damage formula in the box, it modifies the end result by the Variance percentage. (For example, if the damage formula result is 20 and the Variance is 20, the final damage will be between 16-24 damage.) Without a Variance of 0, it can either do more damage (which obviously kills the character) or less (leaving them with more than 1 HP).
     
    Last edited by a moderator: Nov 4, 2015
    SgtBusCake likes this.
  14. northseeker

    northseeker Warper Member

    Messages:
    3
    Likes Received:
    0
    First Language:
    english
    Is it possible to have an attack that only does damage or does more damage if the target is affected by a state.  For example if a formula for an attack that only does damage if a target is poisoned or one that does double damage if its affected by a state.

    Actually is this it?

    b.isStateAffected(x) ? [high damage formula] : [lower damage formula]

    Also is it possible to have a crit apply a an affect to the enemy or myself
     
    Last edited by a moderator: Nov 4, 2015
  15. McDohl

    McDohl Villager Member

    Messages:
    5
    Likes Received:
    1
    First Language:
    Indonesia
    That's fix the problem, Thank you good sir
     
  16. VHStapes

    VHStapes Game Designer Veteran

    Messages:
    57
    Likes Received:
    7
    Location:
    Vashon, Wa
    First Language:
    English
    The "Shield" has to apply a state, because b.isStateAffected is looking to see if the target ("b") is affected by a state. There is probably a way to do it the way you described, but it would be something like b.isArmorEquipped.

    So, make your "Shield" skill apply "Blocking" state, and put whatever the Blocking state's number is in the b.isStateAffected and it should work.
     
  17. McDohl

    McDohl Villager Member

    Messages:
    5
    Likes Received:
    1
    First Language:
    Indonesia
    it works, thank you good sir,

    I'm kinda confuse about it first, but when I read again, I forgot to add state ( :| ) so yes it works when the Hero use "shield" first
     
    VHStapes likes this.
  18. YouKnowA

    YouKnowA Villager Member

    Messages:
    10
    Likes Received:
    6
    First Language:
    English
    You may want to look into math.min and math.max. Anruth linked w3schools a while back. It's always useful for helping to math at things. And, my insomnia is your gain. An equation for your first question. Just don't forget the common event to reset your 11th variable to 100 (I think Fomar suggested that to you a while back, and... well... they're still right). Also, the first time it's used in a test battle x will be 0 (becoming 50) so every hit will start at 50% damage. A second casting will get the expected behavior.

    x = $gameVariables.value(11); x = Math.max(x, 50); y = (a.atk*0.5-0.25*b.def)*(x/100); $gameVariables.setValue(11, x - 10); Math.min(y, 999);There's probably a smoother way to write the above, but it worked alright for me.

    Is that higher bow-wielder damage output with a bow-favoring skill? Or all attacks and skills?
     
  19. gotnovicks

    gotnovicks Veteran Veteran

    Messages:
    76
    Likes Received:
    9
    First Language:
    Portuguese
    Primarily Uses:
    N/A
    I'm trying to set this formula in a skill but it always returns me 0 (zero):

    a.atk * (1 - (b.def / (b.def + 100))basically, it uses defense to work similarly to physical reduction. :C

    also what those .min and .max means in formulae? and how to use them?
     
    Last edited by a moderator: Nov 4, 2015
  20. BloodletterQ

    BloodletterQ Chaotic Neutral Assassin Veteran

    Messages:
    1,450
    Likes Received:
    1,047
    Location:
    My head's in the clouds at least...
    First Language:
    English
    Primarily Uses:
    N/A
    All attacks and skills. Even if I try to lower bow damage, it's exponential.

    EDIT: I remove the level formula and a lower DEX bow still does more damage than a STR-based sword that would be equal in the amount.

    IE: a 40 DEX Bow is still stronger than a 40 STR Sword.

    var x = 1; var arr = [81]; for (var i = 0, len = arr.length; i < len; i++) {x += a.hasWeapon($dataWeapons[arr]) ? a.level + a.atk + a.mdf - b.def: 0}; x += + a.level + a.atk*2; x - b.def;

    This is my current formula. A bow can do a lot less damage than a sword at first, but at higher levels, a a stronger sword will still deal less damage than a bow.
     
    Last edited by a moderator: Nov 5, 2015

Share This Page