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 Pumamori,

    Try:

    Code:
    y = b._actorId === 1 ? 200 : 100; y
     
    Last edited by a moderator: Oct 29, 2015
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,710
    Likes Received:
    11,419
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    If you want actor 2, then you would be looking at === 2, not === 1
     
  3. Anruth

    Anruth Villager Member

    Messages:
    17
    Likes Received:
    0
    First Language:
    English
  4. Calicer

    Calicer Composer Member

    Messages:
    7
    Likes Received:
    3
    Location:
    Australia
    First Language:
    English
    Could someone please explain why the default magic damage formula in ace was "a.mat * 2 - b.mdf * 2" when the physical damage had different multipliers for attack and defence, I'm just wondering what would be the best to use in game for magic attacks. 
     
  5. Pumamori

    Pumamori Veteran Veteran

    Messages:
    109
    Likes Received:
    21
    First Language:
    German
    Primarily Uses:
    RMMV
    Thanks, I gave it a shot and it worked like a charm! ^-^ On a sidenote, is there anyway to have a shorthand "elsif" too? External formulas in form of a plugin? Sorry for showering you all with questions D:

    I know, I've just derped around there and tried various things, before copy pasting the formula I used in here. I had it to === 2 before, with the same result.
     
  6. Liak

    Liak Veteran Veteran

    Messages:
    1,789
    Likes Received:
    269
    Location:
    Germany
    First Language:
    German
    In the formula field, can we assign variables just like "[letter] = x" or do we use "var"?

    And a second question: how to refer to a user's or target's class? More specifically, think of a Druid class that restores more HP with special herbs. How would I write it?

    Something along the lines of

    a.class == 10 ? 100 * a.pha : 50 * a.pha

    (Bonus question: you can't simplify it so you only have pharmacology once, can you?)
     
    Last edited by a moderator: Oct 29, 2015
  7. Pumamori

    Pumamori Veteran Veteran

    Messages:
    109
    Likes Received:
    21
    First Language:
    German
    Primarily Uses:
    RMMV
    For your first question, both should work just fine.

    y = xand

    var y = xshould always result in the same, I think the only difference it makes is that "var" defines it in the current scope, but that doesn't matter for the formula.
     
  8. Liak

    Liak Veteran Veteran

    Messages:
    1,789
    Likes Received:
    269
    Location:
    Germany
    First Language:
    German
    But if I define it globally (without "var"), isn't there the possibility that it overlaps with variables from somewhere else?

    Speaking of variables, how do I reference game variables?
     
    Last edited by a moderator: Oct 30, 2015
    JLowther likes this.
  9. Nuhada

    Nuhada Villager Member

    Messages:
    27
    Likes Received:
    14
    First Language:
    French
    Hey, just found something that can come in handy for the people who don't know javascript (wich i don't know myself, i just experimented for, like, 1 hour just to make this):

    If you want to make two actions in a condition in the formula box, you can't put a ";" to separate the actions, but you can use "&&"

    Exemple:

    (b.isStateAffected(29)?(r=100) && (a.addBuff(2,5)):r=50);rSimple code where if the target is affected by the state 29, the damages becomes 100 instead of 50 AND the target is buffed.

    Also

    I don't really know if it works since i didn't test it, but i think the syntax for the class is something among this line

    Code:
    a._classID === 10 ? 100 * a.pha : 50 * a.pha
     
    Last edited by a moderator: Oct 30, 2015
  10. Liak

    Liak Veteran Veteran

    Messages:
    1,789
    Likes Received:
    269
    Location:
    Germany
    First Language:
    German
    Do you need === or is == enough?
     
  11. Pumamori

    Pumamori Veteran Veteran

    Messages:
    109
    Likes Received:
    21
    First Language:
    German
    Primarily Uses:
    RMMV
    In theory, yes, actually, no. I hardly doubt that you'll ever find a scripter that uses a global variable called "y". And for attack formulas overlapping each other, that doesn't matter, because no attack is played simultaneously. :)

    Technically it's enough, as far as my very, VERY limited JS knowledge goes, the "==" is just used for comparing other things as well.
     
  12. MaxLionheart

    MaxLionheart Veteran Veteran

    Messages:
    91
    Likes Received:
    28
    Location:
    Québec
    First Language:
    French
    Hey guys!

    Could anyone help me translate this two formula from Ace please?

    (a.atk - b.def, 1).max + (if a.luk - b.level <= 0; 0; else; a.luk * 1.25 ; end)​

    Thanks!

    (I used to be able to understand formulas in Ace, but now I'm more like "whaaat?")
     
  13. Nuhada

    Nuhada Villager Member

    Messages:
    27
    Likes Received:
    14
    First Language:
    French
    (a.luk-b.level<=0?r=0:r=a.luk*1.25);Math.max(a.atk-b.def,1)+rThis should work :)
     
    MaxLionheart and SgtBusCake like this.
  14. MaxLionheart

    MaxLionheart Veteran Veteran

    Messages:
    91
    Likes Received:
    28
    Location:
    Québec
    First Language:
    French
    Awesome, thanks Nuhada!

    I'm glad I asked, this is less intuitive than in Ace!

    Thanks
     
  15. TNinja

    TNinja Villager Member

    Messages:
    12
    Likes Received:
    0
    First Language:
    Norwegian
    Hm, before I dive too deep. Where do I access the damage formula options? Or is it a plugin?
     
  16. TaraIzumi

    TaraIzumi Villager Member

    Messages:
    25
    Likes Received:
    12
    First Language:
    German
    Heyo everyone! Me again with another maybe-silly question. Not even entirely sure it belongs in this thread... :D

    With VX Ace I used Yanfly's Lunatic States since I enjoy creating and playing classes that deal damage mostly by afflicting the enemy with lots and lots of dots. That script solved one of my biggest problems with VX Ace which was that states could only deal damage on a % basis. I'm talking about states like "Poison" dealing 10% HP damage each turn. while this is okay for random encounters and small minions... it completely destroys the playstyle of certain classes as i have to make bosses immune to poisons and such as i don't want my bosses to die in 2 turns for having 5 damaging states applied to him.

    With Lunatic States I was able to create a custom state damage formula for each one... making their damage depend on my character's stats instead of using percentages.

    As far as I know Yanfly has not released a MV version of this script nor do I know if he even intends to do so...

    My question:

    Am I stupid? Did I maybe miss anything? Is there a secret way to further customize the damage formula for states? I just can't believe that an important feature like this is not available by default... but maybe it actually IS and i'm just too dumb to find it? 

    As I mentioned before... no idea if this is the right thread to ask about this, but you seem to be quite knowledgeable regarding damage formulas and the stuff surrounding it, so... is there anything i can do (without any/much scripting knowledge)?
     
  17. SgtBusCake

    SgtBusCake Villager Member

    Messages:
    15
    Likes Received:
    7
    Location:
    East Coast
    First Language:
    English
    @TNinja, I've been going to the Tools menu, Database, then selecting Skills on the left. For a skill such as 0001 Attack, the default formula will be toward the top right with a.atk * 4 - b.def * 2.

    @Taralzumi, I've not found anything yet in the base editor that allows for say... damage over time effects to be based on the character's stats although I am still exploring the tool gradually and now the plug-ins that came with it.

    e.g. Bambi deals 20 damage with an attack and afflicts bleeding for 20% of the damage dealt every turn for 5 turns (4 damage every turn).
     
  18. TNinja

    TNinja Villager Member

    Messages:
    12
    Likes Received:
    0
    First Language:
    Norwegian
    Oh, wow. I were searching everywhere but the skill section, because, well. being used to previous programs, I had to go to the scripting section to change any formulas. :V

    Well, thanks mate.
     
  19. Mouser

    Mouser Veteran Veteran

    Messages:
    1,246
    Likes Received:
    264
    First Language:
    English
    You need to read up on java operators here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators

    === is for "strict" equality. == is for equality testing.

    Btw, code like what you're writing is very easy to fall into errors due to operator precedence - be sure you understand the chart at the bottom of that page. Parentheses are your friend. Also, if you're going to be that terse, the y at the end of the statement is superfluous, the function will return the result of the last operation - in this case, the value assigned into y.
     
  20. BloodletterQ

    BloodletterQ Chaotic Neutral Assassin Veteran

    Messages:
    1,452
    Likes Received:
    1,051
    Location:
    My head's in the clouds at least...
    First Language:
    English
    Primarily Uses:
    N/A
    If I wanted to use a skill with an attack formula while having a weapon that is based on dexterity, would I have to use a variable that checks the weapon ID to then deal dexterity-based damage instead of attack-based damage?
     

Share This Page