RMMV Damage Formula - ideas and help

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

  1. luigiman2201

    luigiman2201 Villager Member

    Messages:
    16
    Likes Received:
    2
    First Language:
    English
    Is the Fire 1 skill damage separate from the Fire Element rate = 200 condition?
     
  2. MikeMakes

    MikeMakes Veteran Veteran

    Messages:
    160
    Likes Received:
    41
    First Language:
    English
    I'm not sure how it's suppose to be done.

    I have the following:

    Enemy Bat w/ Trait = Fire * 200%

    Skill Fire1 w/ Element Fire

    I want to keep the default damage formula [100 + a.mat * 2 - b.mdf * 2] and let the system handle the application of weaknesses / resistance modification of damage itself. What I want to add is:

    If Enemy Fire Element Rate >= 200%

    Apply Atk Buff for 1 turn, Apply Def Buff for 1 turn

    What I don't want to do is to make Fire 1 to Add Atk Buff and Def Buff without the element rate check condition.
     
    Last edited by a moderator: Oct 31, 2015
  3. Nuhada

    Nuhada Villager Member

    Messages:
    27
    Likes Received:
    14
    First Language:
    French
    b.elementRate(<insert ID of fire element>)>=2?(b.addDebuff(2,1)&&b.addDebuff(4,1)):0;100+(a.mat*2)-(b.mdf*2)I put so that the debuffs are apply if the fire element rate is equal or superior to 200%, then do the damages :)
     
    Last edited by a moderator: Oct 31, 2015
    MikeMakes likes this.
  4. TNinja

    TNinja Villager Member

    Messages:
    12
    Likes Received:
    0
    First Language:
    Norwegian
    Just gonna take a wild guess and assume that 100% damage means the stat value of the attack, and 200% means double of that. And 50% means half?
     
  5. MikeMakes

    MikeMakes Veteran Veteran

    Messages:
    160
    Likes Received:
    41
    First Language:
    English
    Thanks a lot, Nuhada! I'm really surprised at how powerful this can be.

    I made a correction in the quote - there was an extra "&" which didn't allow the second Debuff to take effect.

    Also, what is the correct syntax that randomizes the debuffs between certain stats only to be applied so it becomes:

    (b.addDebuff([randomized number from 2 to 4],[# of turns])

    where stats #2, #3, or #4 are possible to be debuffed
     
    Last edited by a moderator: Oct 31, 2015
    Nuhada likes this.
  6. Iliketea

    Iliketea Tea lover Veteran

    Messages:
    848
    Likes Received:
    932
    Location:
    Germany
    First Language:
    German
    I am  trying to make a damage formula that would put actor2 into sleep, but would heal everyone else.

    So the damage formula needed to check if the target was nr2 and then take action.

    vr1 : b.id?(2) b.addState(10) : 150.   Didnt work. Just says didnt do any damage to Actor2  and shows a 0.

    vr2: if b.id?(2); b.addState(10) ; else; 150 ; end Same as above.

    the "b.addState(10)" work just fine on enemys but not allies. 

    Can anyone help me :( ?
     
  7. Mirai Ko

    Mirai Ko Veteran Veteran

    Messages:
    44
    Likes Received:
    9
    First Language:
    English
      I'm trying to get a skill to change a variable.

    I've looked around, and have found that "v[7] = 3" in the damage formula will set it to 3, but I can't figure out how

     to do anything else. 

    Say, if I want to increase the variable by 3, "v[7] + 3" or "v[7] += 3" don't seem to work.
     
  8. luigiman2201

    luigiman2201 Villager Member

    Messages:
    16
    Likes Received:
    2
    First Language:
    English
    Use 

    Math.randomInt(3) + 2Math.randomInt(3) will give you either 0, 1, or 2 at random. Adding 2 afterwards will obviously make it vary between 2 and 4.
     
    MikeMakes likes this.
  9. Iliketea

    Iliketea Tea lover Veteran

    Messages:
    848
    Likes Received:
    932
    Location:
    Germany
    First Language:
    German
    For some reason when I trid this it didnt work for me.... Is there anything that I missed? Do I need to make a variabel for it? I made one (nr6) and the wrote var 6 = b._actorId === 2 ? 200 : 100 ; var 6 and it didnt worked :(  
     
  10. Nuhada

    Nuhada Villager Member

    Messages:
    27
    Likes Received:
    14
    First Language:
    French
    it didn't work beacause "var 6" isn't a good variable name, you have to make a name with no space.

    For your formula, try this:

    y=0;(b._actorId===2?b.addState(10):y=<Insert Heal>);yIt is a bit strange, but this is the only way i found to make it works. Also, you will have a "0" pop when the heal targets the actor 2.

    You need to use "$gameVariables[n]" when you refer to a game variable in the formula box :)

    Yep !
     
  11. Iliketea

    Iliketea Tea lover Veteran

    Messages:
    848
    Likes Received:
    932
    Location:
    Germany
    First Language:
    German
    Thank you so much Nuhada! It finally works :D
     
    Nuhada likes this.
  12. YouKnowA

    YouKnowA Villager Member

    Messages:
    10
    Likes Received:
    6
    First Language:
    English
    Doesn't do any damage in what way? Do you mean it does 0's or that the skill when used just does nothing?

    I thought it might be something where a script was helping me out, but I tried 

    var x = 1; var arr = [1]; 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;in the basic thing. The guy with the sword does more damage than the others.
     
  13. MikeMakes

    MikeMakes Veteran Veteran

    Messages:
    160
    Likes Received:
    41
    First Language:
    English
    Thank you, luigiman2201. I've always had trouble for random number whether it to put the +2 inside  with the 3 or outside. But that makes sense if you think about the order of operations.
     
    Last edited by a moderator: Nov 1, 2015
  14. GutshotStr8

    GutshotStr8 Veteran Veteran

    Messages:
    51
    Likes Received:
    21
    First Language:
    English
    Neither "$gameVariables.setValue(14, ($gameVariables[14] + 1))" nor "gameVariables[14] += 1" increment the variable by 1 :-(
     
  15. Noferatsi

    Noferatsi Level 10 Veteran

    Messages:
    59
    Likes Received:
    11
    Location:
    Firelink Shrine, Lordran
    First Language:
    English
    Hey guys! I have a question, and I don't quite know if it's been answered, but how do I set up a skill that damages both the target, AND the user? I have a skill that

    drains the target's MP, but also damages the user's HP. 
     
  16. YouKnowA

    YouKnowA Villager Member

    Messages:
    10
    Likes Received:
    6
    First Language:
    English
    Nuhada covered this a few pages back. You can do something like a.gainHp(-Math.floor((a.atk/10))); at the start of a damage equation if you want it to be based on the user's attack.

    a.gainHp(-Math.floor((a.mhp/10))); is also pretty cool. It does damage based on the attacker's max HP.

    a.gainHp(-Math.floor((a.mhp/10))); a.agi * 9 - b.def * 2worked for me. If you want to do damage to the attacker's HP similar to the defender's lost MP, you could use something like this:

    a.gainHp(-(a.agi * 9 - b.def * 2)); a.agi * 9 - b.def * 2But, replace the equation a.agi * 9 - b.def * 2 w/ the one you want.
     
    Last edited by a moderator: Nov 1, 2015
  17. AirshipCanon

    AirshipCanon Veteran Veteran

    Messages:
    54
    Likes Received:
    10
    First Language:
    English
    Hmmm... morning thought:
    MV naturally doesn't have the capacity for an attack that hits more than one element.

    Is it possible to use the formula box to cheat that?

    Like lets say this: I add Element 10: Multielemental. [using Defaults otherwise; Fire + Water example?]. That's what the skill used.
    b.elementRate(10) = b.elementRate(2) * b.elementRate(5) ; 2*a.mat - b.mdf

    Tried it, didn't work, only yielded no damage [Tried 5 different targets: 1 that was completely neutral (should deal normal magic damage in that case); 1 that was weak to both Fire and Water (should deal 225%); 1 that was weak to 1 and strong to the other (should actually deal 100.5% damage); and one that was Weak to one, completely immune to another (Should Deal zero)....]
     

    "v[7] = v[7] + 3" ?
     
  18. YouKnowA

    YouKnowA Villager Member

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

    That's a pretty cool idea. I made a fire element spell w/ a damage formula of:

    b.elementRate(4)*(100 + a.mat * 2 - b.mdf * 2)Element#4 being thunder. This should make a spell that applies the damage rate of thunder on top of the spell's native fire element. I didn't do extensive testing, but it seems to get the expected damage behaviors (tried weak to both, weak to neither, weak to one and strong to the other).
     
  19. 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
    My archer with much higher dexterity definitely does a lot of damage, but how do I go about to take defense into consideration for each formula? It does 0 damage when include the b.def in the formulae.  Don't forget enemies have to attack too although making separate skills for that will work.

    In other words 

    var x = 1; var arr = [1]; for (var i = 0, len = arr.length; i < len; i++) {x += a.hasWeapon($dataWeapons[arr]) ? (a.mdf - b.def) : 0}; a.atk-b.def += x;Deals a consistent damage of 0.
     
    Last edited by a moderator: Nov 1, 2015
  20. YouKnowA

    YouKnowA Villager Member

    Messages:
    10
    Likes Received:
    6
    First Language:
    English
    I repro'd it. You're right, it does. My guess is that the enemy's def(s) nullify the attacking stats completely.

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

    var x = 1; var arr = [1]; for (var i = 0, len = arr.length; i < len; i++) {x += a.hasWeapon($dataWeapons[arr]) ? a.mdf : 0}; x += 4 * a.atk; x - 2 * b.def;may produce something closer to the desired effect.

    The first one adds the stat so it gets multiplied (making the attack w/ the favored weapon MUCH stronger). The second one uses a more tame method w/ the weaponed damage being 1 += a.mdf += (4 * a.atk), and then that total - the normal target defense. Let me know if that works for you. 
     

Share This Page