RMMV Damage Formula - ideas and help

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

  1. SgtBusCake

    SgtBusCake Villager Member

    Messages:
    15
    Likes Received:
    7
    Location:
    East Coast
    First Language:
    English
    Hello Spellcraft Quill,

    I'm coming up to a plug-in called WeaponSkill by Sasuke Kannuzuki that seems to be part of the Kadokawa zip file of the pre-order. Once it was enabled in my test game, I went to the Weapons database and put the following text into the Notes field:

    <skill_id:5>I didn't see a dexterity stat, but for experimentation sake, I took a magic wand that has a basic magic attack instead of a physical attack.

    Under the Skill, the fifth skill I have is still labeled as Attack, but it has all the properties one might find with a magic attack such as a formula of:

    Code:
    a.mat * 4 - b.mdf * 2
     
  2. BloodletterQ

    BloodletterQ Chaotic Neutral Assassin Veteran

    Messages:
    1,453
    Likes Received:
    1,051
    Location:
    My head's in the clouds at least...
    First Language:
    English
    Primarily Uses:
    N/A
    I know about that part, but that just changes a normal attack. What I am thinking about is using a skill (Double Slash) normally is based off of attack and hits twice. Using Double Slash with a bow should use another stat instead. (I changed magic defense to a dexterity stat.)
     
  3. zadck

    zadck Villager Member

    Messages:
    21
    Likes Received:
    1
    I've spent the last 5 hours trying to make some of my formulas work, and now decided I should ask for some help, haha. I'm someone who really learns by examples. Could anyone try to translate some of these more complex formulas from Ace to MV? I have some very complex effects in my games.

    d=a.mat * 4.3 - b.mdf * 1.3;for s in [71,72,73];if b.state?(s);d*=1.2;end;end;d

    a.add_state(150);if Input.trigger_count:)C) == 1;a.atk*3-b.def*2;else;(a.atk*3-b.def*2)*1.25;end

    (input.trigger_count:)C) is for an Ace script and obviously doesn't work, but what would this be if it did?)

    And if anyone wants to try to take a crack at either of these overwhelming ones (same thing with the input.trigger_count:)C), it of course doesn't work in MV without the same script ported over, but I'm trying to decipher how I would do these effects if it was). These were done in Yanfly's Lunatic Damage, but now with the formula box as large as it is, they seem to be easily able to fit in the box without a plugin:

    $game_variables[309]=0; if Input.trigger_count:)C) == 1; $game_variables[309]=1; if $game_variables[174]==0; then self.animation_id = 288; else; if $game_variables[174]==1; then self.animation_id = 383; else; if $game_variables[174]==2; then self.animation_id = 287; else; end end end end
    Code:
    $game_variables[205]=0;      if Input.trigger_count(:C) == 1; $game_variables[204]=1        if $game_variables[206]>0;      self.animation_id = 377;$game_variables[205]=1;$game_variables[206]-=1;else;end    else      if $game_variables[204]==1        if $game_variables[206]>0;        self.animation_id = 377;$game_variables[205]=1;$game_variables[206]-=1;else;end      else      end      end
    I know some of these are a little over-the-top, but seeing them translated would help me do all of the other ones like it in my games, haha! Any advice is appreciated!
     
    Last edited by a moderator: Oct 30, 2015
  4. YouKnowA

    YouKnowA Villager Member

    Messages:
    10
    Likes Received:
    6
    First Language:
    English
    Heya SCQ,

    This might point you in the right direction:

    var x = 1; var arr = [25, 26, 27, 28, 29, 30]; for (var i = 0, len = arr.length; i < len; i++) {x += a.hasWeapon($dataWeapons[arr]) ? (a.atk + a.agi + a.mat) : 0}; a.atk += x;This uses a.atk+a.agi+a.mat+a.atk for weapon IDs 25-30, but just a.atk for other weapons. 

    Of course, it's super ugly. If anyone has a cleaner way of doing it, that'd be pretty rad.
     
    Last edited by a moderator: Oct 30, 2015
    SgtBusCake likes this.
  5. TheGamedawg

    TheGamedawg Veteran Veteran

    Messages:
    350
    Likes Received:
    132
    Location:
    United States
    First Language:
    English
    It might be better to look in the script for this one, but how can I make it so the least amount of damage an attack can ever do it 1 as suppose to 0?
     
  6. YouKnowA

    YouKnowA Villager Member

    Messages:
    10
    Likes Received:
    6
    First Language:
    English
    Hi Gdawg,

    Whitesphere has an example of how to do this on page 2 of this thread. The example they provided was Math.max( (4*a.atk - 2*b.def), 5). On the previous page, Anruth dropped a link to w3schools. It can help with some mathy things. 

    (Just reread what I wrote. Totally trying to be helpful, and not curt nor snarky. :D )
     
    TheGamedawg likes this.
  7. SgtBusCake

    SgtBusCake Villager Member

    Messages:
    15
    Likes Received:
    7
    Location:
    East Coast
    First Language:
    English
    @YouKnowA: I think something like this may work for the scenario that SCQ described (at least I think it is from the test cases I've run.) I haven't found a way with the base game to pull the wtypeId of the actor's equipped weapon. Thank you for this

    @SpellcraftQuill: Is your Dexterity stat used for anything other than damage? And do you have a stat that opposes Dexterity like the way that Defense opposes Attack?
     
     
  8. BloodletterQ

    BloodletterQ Chaotic Neutral Assassin Veteran

    Messages:
    1,453
    Likes Received:
    1,051
    Location:
    My head's in the clouds at least...
    First Language:
    English
    Primarily Uses:
    N/A
    Well I hope Yanfly has a battle parameter formula or something similar. I will then have dexterity be the hit rate and go towards critical chance. Defense also guards against dexterity weapons.
     
  9. lolshtar

    lolshtar Master of Magic thatknow nospell Veteran

    Messages:
    694
    Likes Received:
    100
    First Language:
    French
    Primarily Uses:
    RMMV
    Is there a way to make formulas inside a plugin and do a shortcut on the skill formula?
     
    Like in Ace l was writing in a script
     

    def User_MoreMPLessDMG_50(a, B)
    d = ((a.mp/(a.mmp/0.50.to_f))+1)
    d.to_f # Deal Damage
    end
     
    And everytime l wrote "b.User_MoreMPLessDMG_50" in a skill, ((a.mp/(a.mmp/0.50.to_f))+1) was calculated inside
     
    Last edited by a moderator: Oct 30, 2015
  10. luigiman2201

    luigiman2201 Villager Member

    Messages:
    16
    Likes Received:
    2
    First Language:
    English
    I have a quick question.

    I want to make skills that do recoil damage to the user based on the damage done, like Take Down and Double-Edge in Pokémon.

    The problem is that now that the recoil damage is calculated with two decimals.

    Is there a way to round these numbers?

    Here's the formula i use if it helps.

    a.gainHp(-(((2 * a.luk + 10) / 250) * (a.atk / b.def) * 90 + 2) / 4);((2 * a.luk + 10) / 250) * (a.atk / b.def) * 90 + 2
     
  11. Nuhada

    Nuhada Villager Member

    Messages:
    27
    Likes Received:
    14
    First Language:
    French
    Math.round().

    So

    Math.round(a.gainHp(-(((2 * a.luk + 10) / 250) * (a.atk / b.def) * 90 + 2) / 4));((2 * a.luk + 10) / 250) * (a.atk / b.def) * 90 + 2You can also use Math.floor() or Math.ceil().

    For more info about maths, you can red this page: http://www.w3schools.com/js/js_math.asp 

    You can use it all in the formula box :)
     
    Marianojoey and luigiman2201 like this.
  12. luigiman2201

    luigiman2201 Villager Member

    Messages:
    16
    Likes Received:
    2
    First Language:
    English
    Thanks a lot, I was able to figure it out with your help, though it only worked after I put Math.floor behind the first minus sign

    Like this

    a.gainHp(-Math.floor((((2 * a.luk + 10) / 250) * (a.atk / b.def) * 90 + 2) / 4));((2 * a.luk + 10) / 250) * (a.atk / b.def) * 90 + 2Once again, thanks. Now I can make this recoil thing work.
     
    Last edited by a moderator: Oct 30, 2015
  13. Liak

    Liak Veteran Veteran

    Messages:
    1,789
    Likes Received:
    269
    Location:
    Germany
    First Language:
    German
    I still don't know how to refer to game variables. :/
     
    JLowther likes this.
  14. jonthefox

    jonthefox Veteran Veteran

    Messages:
    1,300
    Likes Received:
    455
    Location:
    NYC
    hey, sorry if this question seems really simple but...

    I want a dmg formula that adds a state on the condition of an enemy parameter.  would this be how to do it?  I'm going for "if target's defense is less than 50, add state 10 and do the standard damage formula.  otherwise, just do the standard damage formula"

    b.def < 50 ? b.addState(10); a.atk*4 - b.def*2 : a.atk*4 - b.def*2
     
    Last edited by a moderator: Oct 31, 2015
  15. JumbocactuarX27

    JumbocactuarX27 Veteran Veteran

    Messages:
    86
    Likes Received:
    39
    First Language:
    English
    I'm at work so I don't have RPGMMV in front of me to test this but I do have the engine's .js files on my phone. Looking at rpg_managers.js it looks like you should be able to just call $gameVariables[n] where n is the index of the variable you want.
     
  16. CrimsonKirie

    CrimsonKirie Veteran Veteran

    Messages:
    37
    Likes Received:
    1
    First Language:
    English
    I'm trying to make an attack also add a state to the caster but all I'm getting is zero damage and no state applied.

    What exactly am I doing wrong?
     
  17. Cel

    Cel Veteran Veteran

    Messages:
    88
    Likes Received:
    56
    First Language:
    Swedish
    Use a.addState

    Notice the S instead of s
     
  18. CrimsonKirie

    CrimsonKirie Veteran Veteran

    Messages:
    37
    Likes Received:
    1
    First Language:
    English
    thank you so much Cel
     
  19. MikeMakes

    MikeMakes Veteran Veteran

    Messages:
    160
    Likes Received:
    41
    First Language:
    English
    I came from RMXP, so I'm completely new with the Formula box. Can I do the following:

    If Enemy's Fire Element Rate = 200%, add both atk and def debuffs for 1 turn each, in addition to Fire 1 Skill's damage of [100 + a.mat * 2 - b.mdf * 2]?
     
    Last edited by a moderator: Oct 31, 2015
  20. BloodletterQ

    BloodletterQ Chaotic Neutral Assassin Veteran

    Messages:
    1,453
    Likes Received:
    1,051
    Location:
    My head's in the clouds at least...
    First Language:
    English
    Primarily Uses:
    N/A
    Doesn't do damage.

    In case anybody else is wondering, it's supposed to be with weapons that use another stat for its basic attack which could be done with a plug-in that comes with the software, but also the same weapon could be used in other skills that otherwise are similar to normal attacks (Double Strike for example.)
     
    Last edited by a moderator: Oct 31, 2015

Share This Page