RMMV Damage Formula - ideas and help

● ARCHIVED · READ-ONLY
Started by Shaz 1539 posts Page 32 of 77 View original ↗
  1. Quick question.


    I know that to check a state is a.isStateAffected(x) ?


    How do I check if the user does not have the state? I think i have to add a ! but I don't know where
  2. emelian65 said:
    Quick question.


    I know that to check a state is a.isStateAffected(x) ?


    How do I check if the user does not have the state? I think i have to add a ! but I don't know where



    !a.isStateAffected(x)


    Or


    !(a.isStateAffected(x)


    I feel like it's the first one, but you can give both a try. :)
  3. Having trouble with a formula, i accidentally posted a thread for it because im dumb and didn't ready sticky's.


    var n = Math.floor((Math.random() * 7) + 1); if (n == 7) {a.luk * 6}; else {a.atk * 3}


    Im trying to make it so the attack rolls a random number between 1-7.


    If the number rolled is a 7, it does a.luk * 6.


    If it rolls anything other than a 7, it rolls a.atk * 3.


    What is wrong with my formula? >.<
  4. CivilYoshi said:
    Having trouble with a formula, i accidentally posted a thread for it because im dumb and didn't ready sticky's.


    var n = Math.floor((Math.random() * 7) + 1); if (n == 7) {a.luk * 6}; else {a.atk * 3}


    Im trying to make it so the attack rolls a random number between 1-7.


    If the number rolled is a 7, it does a.luk * 6.


    If it rolls anything other than a 7, it rolls a.atk * 3.


    What is wrong with my formula? >.<



    Maybe try:


    var n = (Math.randomInt(6) + 1); if (n == 7) {a.luk * 6}; else {a.atk * 3}
  5. Riff said:
    Maybe try:


    var n = (Math.randomInt(6) + 1); if (n == 7) {a.luk * 6}; else {a.atk * 3}



    Still doing 0 damage no matter what.


    Im not quite sure if it has something to do with my application of var but i've tried a bunch of formulas and nothing seems to work.
  6. Riff said:
    !a.isStateAffected(x)


    Or


    !(a.isStateAffected(x)


    I feel like it's the first one, but you can give both a try. :)





     



    Is not working, but I feel that probably is my fault.


    I'm using Yanlfy auto passive states and I wanted to do a condition for a state but the normal formula doesn't seem to be working.


    I want to create a Flying state, which the foe will always have unless they are affected by Grounded


    Normally I wouldn't care if both states are simultaneously on the enemy but flying is not only visual it adds a 40% chance of evade any Physical attack, Grounded reduce said evasion by 50%, but if both of them are at the same time then the evasion penalty is only of 10%


    <Custom Passive Condition>
    if !(user.isStateAffected(6) {
    condition = true
    } else {
    condition = false
    }
    </Custom Passive Condition>


    I tried using this both it returns me a Syntax Error 'Unexpected Token !'


    So any idea of how to do make it work?
  7. CivilYoshi said:
    Still doing 0 damage no matter what.


    Im not quite sure if it has something to do with my application of var but i've tried a bunch of formulas and nothing seems to work.





    Try this:


    var n === (Math.randomInt(7) + 1); if (n === 7) {a.luk * 6;} else {a.atk * 3;}
  8. looking at it, my guess is the problem is to do with "; else {a.atk * 3}" being you have an else but no if, I'd try without the semicolon in the middle but it might just be easier to do this


    var m = 1; var n = (Math.randomInt(6) + 1); if (n == 7) {m = a.luk * 6}; if (n != 7) {m = a.atk * 3}; m


    I know that it looks weird but the damage formula only cares about the value at the end, so any errors will cause it to return zero, so if neither if statement is used then the damage is 1, else if you get 0 again you've got a logic error
  9. emelian65 said:
    Is not working, but I feel that probably is my fault.


    I'm using Yanlfy auto passive states and I wanted to do a condition for a state but the normal formula doesn't seem to be working.


    I want to create a Flying state, which the foe will always have unless they are affected by Grounded


    Normally I wouldn't care if both states are simultaneously on the enemy but flying is not only visual it adds a 40% chance of evade any Physical attack, Grounded reduce said evasion by 50%, but if both of them are at the same time then the evasion penalty is only of 10%



    <Custom Passive Condition>
    if !(user.isStateAffected(6) {
    condition = true
    } else {
    condition = false
    }
    </Custom Passive Condition>


    I tried using this both it returns me a Syntax Error 'Unexpected Token !'


    So any idea of how to do make it work?



    if (!user.isStateAffected(6)


    the '!' means 'not' so it goes in the bracket not outside
  10. emelian65 said:
    Is not working, but I feel that probably is my fault.


    I'm using Yanlfy auto passive states and I wanted to do a condition for a state but the normal formula doesn't seem to be working.


    I want to create a Flying state, which the foe will always have unless they are affected by Grounded


    Normally I wouldn't care if both states are simultaneously on the enemy but flying is not only visual it adds a 40% chance of evade any Physical attack, Grounded reduce said evasion by 50%, but if both of them are at the same time then the evasion penalty is only of 10%



    <Custom Passive Condition>
    if !(user.isStateAffected(6) {
    condition = true
    } else {
    condition = false
    }
    </Custom Passive Condition>


    I tried using this both it returns me a Syntax Error 'Unexpected Token !'


    So any idea of how to do make it work?



    You missed one closed bracket.


    @CivilYoshi i'll take a look later and get back to you if no one's answered yet. Going to work. :)
  11. GammaVD said:
    if (!user.isStateAffected(6)


    the '!' means 'not' so it goes in the bracket not outside





     



    This one, know it works thank you

    Riff said:
    You missed one closed bracket.


    @CivilYoshi i'll take a look later and get back to you if no one's answered yet. Going to work. :)





     



    It works now thanks
  12. Is there a way to add the weapon's attack to a formula? Like, weapon damage + regular formula?


    I saw a few threads that helped VXA users, but I couldn't find any that were answered for MV. From VXA, a.weapons[0].atk would work (I'm pretty sure).


    Thanks in advance.
  13. So I have been toying around with a few ideas for my stat/damage systems, and I think I finally made one that I like, but I would like some outside opinions on it as well.


    The stats are as such:


    Vitality- 100% of this number is HP, also gives 10% of its value as damage reduction.


    Might- This serves as the melee attack value, also gives anywhere from 1-25% of its value in damage reduction.


    Agility- This serves as the ranged attack value, also reduces damage received by a percentage based on 1/6 of its value (eg. 30 agility gives 5% reduction of damage)


    Intelligence- 100% of this number is MP, also gives 10% of its value as magic damage reduction.


    Sorcery- This serves as the magical attack value, also gives anywhere from 1-25% of its value in magic damage reduction.


    Wisdom- This serves as the magical healing value, also reduces damage received by a percentage based on 1/6 of its value (see agility).


    The reasoning:


    By taking out a hard defensive stat and spreading the defenses around all stats, I think it will allow players to pursue whatever path they want without having to ignore offensive stats to gain defense or defensive stats to gain power. Vitality and Intelligence raise at +10 points per level, giving an extra 1 damage reduction to their respective damage type, Might and Sorcery raise at +1 per level, not giving too much more defense but their attack types will be the most powerful. Agility and Wisdom also grow at +1 a level, giving a ~.16% reduction per level in overall damage taken. In addition, the players will be given 3 points per level to allocate to whatever stats they want, effectively adding another level to whatever stat they place it in, with a max of one point spent on one stat per level (akin to how Morrowind and Oblivion leveled their stats). Points would of course increase Vitality and Intelligence 10 points instead of just one.


    Players start with scores of 100 in both Vitality and Intelligence, and with 30 points in each other stat. Equipment that directly increases stats will be rare, favoring Vitality and Intelligence over the others. The basic damage formula is as follows (may not be in perfect game terms):


    a.Atk * ((100 - (b.agl / 6)) * .01) - (b.HP * .1) - ((Math.randomint (24) +1) - (b.Atk * .01)


    And substituting a.agl for ranged attack and so on for other attack types.


    Any suggestions, comments or ridicules anyone?
  14. I'm trying to come up with a damage formula for a harm undead spell that only hurts enemies with the Undead element applied, and does 0 damage otherwise.   I created an Undead element type, and applied the "Element Rate: Undead * 100%" to my monster.  Is there a way to test if an actor has a trait applied?  If so, it should be as simple as:


    if ( b.isTypeAffected(Undead) != True ) {0;} else { 100 + a.atk - b.def *2; }


    I'm not a coder so I doubt the syntax is correct on that, or if there even is a "b.isTypeAffected" command in RMMV, but that's what the forums are for!  Thanks in advance!!
  15. Got it working!  For posterity, here be the code: 


    if ( !b.isStateAffected(29) ) 0; else (Math.floor(Math.random() * (800 - 200 + 1)) + 200) + a.mat - b.mdf * 2


    Just for reference, 29 is my Undead state I created, and I wanted this spell to do a random amount of damage between 200 and 800, that's what all the Math is about.
  16. I'm trying to create a feint-like attack that has a 50% chance to hit. If it succeeds, it deals only a small amount of damage. If the attack misses, it inflicts state 14 on the enemy (it inflicts a penalty to evasion and critical evasion).


     Oh, and is there a way to force a target to go last? I was going to reduce the target's AGI to 1% with state 14 but I'm not certain if the turn order is determined before the attack.
  17. Manofdusk said:
    IOh, and is there a way to force a target to go last? I was going to reduce the target's AGI to 1% with state 14 but I'm not certain if the turn order is determined before the attack.

    I do not know about in the basic engine, but I know if you are using the Yanfly ATB battle system plugin you can put a command in the skills notebox that will deplete their ATB gauge, thus making them have to start charging it all over again, paired with a slow effect you could knock the enemy back a few 'turns'.


    Also there is the CTB, I do not know much about it but the it apparently focuses heavily on turn manipulation.
  18. How do I use more than 1 character stats in a formula.


    I want to make an attack that takes into account all the party members ATK and MAT.


    Also is there a way that after selecting the attack, the other party members become unable to attack,?, like combination attacks, but without plug-ins?
  19. Is it possible to output the result of the damage formula to the console?  I tried using:


    console.log( a.atk * 4 - b.def * 2 )


    as my damage formula and it throws errors whenever the skill is used.  I trying figure out where I screwed a formula up in my game and would like to see if the damage formula is being evaluated correctly.  MV really needs a full debug mode that outputs more information to the console.
  20. emelian65 said:
    How do I use more than 1 character stats in a formula.


    I want to make an attack that takes into account all the party members ATK and MAT.


    Also is there a way that after selecting the attack, the other party members become unable to attack,?, like combination attacks, but without plug-ins?

    I realise you specified "without plugin's" but I think This is probably what you are looking for http://yanfly.moe/2016/02/06/yep-67-party-limit-gauge/ and also I would highly recommend http://yanfly.moe/2015/10/11/yep-4-action-sequence-pack-1/ - http://yanfly.moe/2015/10/12/yep-5-action-sequence-pack-2/ - http://yanfly.moe/2015/10/12/yep-6-action-sequence-pack-3/
     


    But if they don't strike you as an option then this is how I would personally do what you  are asking (providing I understand correctly).


    ~ Create a "Common Event" 


    ~ Setup variables for each characters atk and/or mat (as you see fit).


    ~ Make Note of the variable numbers (let's say you have 3 actors in your party with a variable for atk and mat so variables 1-6)


    ~ Set a "Call common event" within the skill (this is where Yanfly's action sequence REALLLLLLY comes in handy).


    ~ Set formula to something like "a.atk +(v[1]+v[2]+v[3]+v[4]+v[5]+v[6])" Which will basically take users attack and add all the variable values to it.


    Naturally once the variables are set up it will be easy for you to do a formula based on other actors atk/mat. (as long as the common event is called first to ensure all the values are up to date).


    Now as for your "unable to attack" again you could use a plugin Yanfly's ATB and just set ATB to 0 for each character after the skill is used (probably can be defined in the action sequence.) failing that I'd just set up a state that makes the character "unable to move" for 1 turn. and add that state under the common event within the skill set to a 100% chance.


    Hope this helps.