RMMV Damage Formula - ideas and help

● ARCHIVED · READ-ONLY
Started by Shaz 1539 posts Page 4 of 77 View original ↗
  1. Trilient said:
    Wait, you can use Javascript within the damage formula calculator? So if I wanted to place an if statement that doubled the amount of damage dealt if the actors HP was below a certain point, I could do that?
    Yes.

    The formula field goes through an eval(), and any number that it results in at the end is used on for the Damage (or heal or etc) action.

    Incidetanlly, you can also even include statements before the formula itself, and they will be run. But this has side-effects as I described in a post above.
  2. In a conditional formula, is it possible to make a skill have no effect? So something like this:

    b.hp > 100 ? 25 : ???What do I put where the ??? are if I want no effect at all (so not only 0 damage, no effect at all)? "return false"?
  3. What would the damage formula be for a skill that does more damage if the enemy is afflicted with state x?
  4. I think that woud be:

    b.isStateAffected(x) ? [high damage formula] : [lower damage formula]
  5. Liak said:
    In a conditional formula, is it possible to make a skill have no effect? So something like this:

    b.hp > 100 ? 25 : ???What do I put where the ??? are if I want no effect at all (so not only 0 damage, no effect at all)? "return false"?
    The function that evals the Formula for damage defaults to 0 if it can't get a number at all from the formula. So I don't think there's anything you could do in that field to make it fail completely like that.

    Code:
    Game_Action.prototype.evalDamageFormula = function(target) {    try {        var item = this.item();        var a = this.subject();        var b = target;        var v = $gameVariables._data;        var sign = ([3, 4].contains(item.damage.type) ? -1 : 1);        return Math.max(eval(item.damage.formula), 0) * sign;    } catch (e) {        return 0;    }};
  6. Hello, if the command to gain mp if gainMp(x), what is the command to lose mp?

    I tried loseMp(x), but that doesn't work and i don't know where all the commands like this are wrote :/
  7. That works wonderfully, thanks!
  8. JahwsUF said:
    (a.atk / 2) ** 1.8

    translates to

    Math.pow(a.atk/2, 1.8)
    Thx, think i get it now. :)

    A list of different methods and such would be awesome to have. I want to use more advanced if else statements and such to. And maybe use game variables like Victory Count and Escape count.
  9. I've run into a very weird problem with b.addState... Whenever I use this inside a formula to add a state to an enemy the enemy just... stops. It won't act, it won't take damage from the state itself. It just sits there letting me hit it, pretending my state's a stun effect. For clarity's sake, here's the formula I'm using:

    b.isStateAffected(34) ? b.addState(34) : b.isStateAffected(33) ? b.addState(34) : b.isStateAffected(32) ? b.addState(33) : b.isStateAffected(31) ? b.addState(32) : b.addState(31)

    (Basically what I want it to do is "upgrade" a poison state step by step, which it does just fine as every new step makes the target immune to the steps before, effectively removing lesser states. For some reason it also removes the target's will to act...
     

    Anyone got any idea as to why?

    EDIT: So with a super minor edit:

    (b.isStateAffected(34) ? b.addState(34) : b.isStateAffected(33) ? b.addState(34) : b.isStateAffected(32) ? b.addState(33) : b.isStateAffected(31) ? b.addState(32) : b.addState(31)), 1

    The skill no longer freezes the enemy. It seems like having no damage in the damage formula while making it apply states doesn't play well with enemies in general for some reason.
  10. Nuhada said:
    Hello, if the command to gain mp if gainMp(x), what is the command to lose mp?

    I tried loseMp(x), but that doesn't work and i don't know where all the commands like this are wrote :/
    Hi Nuhada,

    I think what you may be looking for is a negative value for x.

    e.g. a.gainMp(-10) will make the actor lose 10 MP if they do not miss.

    If you are looking for dealing MP damage, you may be able to use the Damage, Type: combo box in the top right and change HP Damage to MP Damage.
  11. Cel said:
    I've run into a very weird problem with b.addState... Whenever I use this inside a formula to add a state to an enemy the enemy just... stops. It won't act, it won't take damage from the state itself. It just sits there letting me hit it, pretending my state's a stun effect. For clarity's sake, here's the formula I'm using:

    b.isStateAffected(34) ? b.addState(34) : b.isStateAffected(33) ? b.addState(34) : b.isStateAffected(32) ? b.addState(33) : b.isStateAffected(31) ? b.addState(32) : b.addState(31)

    (Basically what I want it to do is "upgrade" a poison state step by step, which it does just fine as every new step makes the target immune to the steps before, effectively removing lesser states. For some reason it also removes the target's will to act...

    Anyone got any idea as to why?

    EDIT: So with a super minor edit:

    (b.isStateAffected(34) ? b.addState(34) : b.isStateAffected(33) ? b.addState(34) : b.isStateAffected(32) ? b.addState(33) : b.isStateAffected(31) ? b.addState(32) : b.addState(31)), 1

    The skill no longer freezes the enemy. It seems like having no damage in the damage formula while making it apply states doesn't play well with enemies in general for some reason.
    Hello Cel,

    I've not looked into the code behind the scenes on this, but I found that I was able to get away with inflicting 0 damage and still apply the ailments by adjusting the end of the formula. The 0 still appears and if it is not present, the poison will land, but will not actually deal damage at the end of each turn.

    (b.isStateAffected(34) ? b.addState(34) : b.isStateAffected(33) ? b.addState(34) : b.isStateAffected(32) ? b.addState(33) : b.isStateAffected(31) ? b.addState(32) : b.addState(31)); 0At first, I was a bit confused with the poisons stacking when yours were not. Then I figured you may have added a Trait in the State Resist of the lower tier of poison and that seemed to do the trick for me.
  12. Is there a way to increase de critical strike chance by some % ? 

    For example make a skill ta has a 30 % extra chance of doing critical.
  13. SgtBusCake said:
    Hi Nuhada,

    I think what you may be looking for is a negative value for x.

    e.g. a.gainMp(-10) will make the actor lose 10 MP if they do not miss.

    If you are looking for dealing MP damage, you may be able to use the Damage, Type: combo box in the top right and change HP Damage to MP Damage.
    Thank you, i don't know why i didn't think of that x)

    I don't deal only mp damages, thats why i needed this. The spell attack the enemy, drain his mp, and if the mp of the enemy is 0 after the attack, he become stuned.

    r=(20+(a.atk * 4 - b.def * 2));b.gainMp(-(Math.round(r/17)));a.gainMp(Math.round(r/17));if(b.mp==0){b.addState(8)};rIt works fine like this now :)
  14. Milennin said:
    I had this skill that would let you swap around an ally's HP and MP, this was the VXAce formulae:

    c=b.hp;d=b.mp;b.hp=(d*1.33+b.level).to_i;b.mp=(c*0.5-b.level).to_i;0but it's no longer working, giving me a "has no effect" message in battle.

    How do I make this skill work in MV?

    Full explanation of the formulae:

    Target's HP becomes: (Target's current MP * 1.33 + Target's Level), Target's MP becomes: (Target's current HP / 2 - Target's Level). Rounding off both numbers to avoid decimals.
    Still learning at how all of this works and I'm certain there is a better way than what I threw together.

    In the meantime, I think this may simulate the effect of swapping HP and MP with the formula you provided.

    Try:

    c = b.hp; d = b.mp; b.gainHp(-b.hp+1); b.gainMp(-b.mp); b.gainMp(Math.round(c * 0.5 - b.level)); b.gainHp(Math.round(d * 1.33 + b.level)); 0If I'm not mistaken, if a caster continually casts this HP Conversion spell on a target, the target will gradually lose both HP and MP, due to the MP being halved with each iteration.

    There will be an odd "Harold has recovered X MP" message. While it looks like the message could be made blank in the Database, it will display a blank line. Fiddling around in Notepad, it looks like there's a file in your game directory's "js" folder called "rpg_windows.js" and in it, a line that says "Window_BattleLog.prototype.displayMpDamage"  If you add two forward slashes before the "this.push" text, it should make the message go away.

    // this.push('addText', this.makeMpDamageText(target));This will also impact messages from MP recovery items. I suspect there's a much easier way to make all of this happen - I just haven't learned it yet.
  15. Entwist said:
    I'm a new member, so someone else might answer this before I get out of moderation, but from looking at js/rpg_core.js, it looks like you should be able to get a random number between 0 and 4 by using

        Math.randomInt(5)

    Notice you pass in a 5 to get a random number between 0 and 4.
    Thanks for this, I was using the clunkier "(Math.random()*X)".
  16. Is there a way to change the multiplier for Critical Hits? I managed to go in and change that in VX Ace because I want it to be a 2x multiplier rather than 3x. I don't see any plugins that can do it either. 
  17. I have 2 questions:

    1. I was wondering is there a way to add debuffs or buffs in the formula box now

    2. Can I have an if/else statement checking the value of a random integer

    Any help is appreciated, thanks :)
  18. Here's an interesting note. When you apply actual formulas that search for stats to On Field items (e.g. Healing Potions) the system seems to default look at the Leader's stats to reference if there is an "a.stat" used which is pretty interesting. It implies that the item is being administered by the leader, which is kind of a neat character trait and shows a real use for the leader. If you use "b.stat" it will look at the character being effected. A cool little system though, I'll have to manipulate this to make some not so bland healing items (and to use some lesser used stats)
  19. multiplier for critical hits is not in the damage formula.  Please post a new thread with your question (in Javascript/Plugin Support).  Or do a search, as someone else has already asked this question and received an answer.

    a is the user of the item and b is the target of the item.  As there is no user/target when you're not in battle, it must default to the leader.
  20. Liak said:
    I have 3 questions.

    1. How do you get the number of states on someone?

    2. How do you do "if" branches, is there are short version? In Ruby, it was "condition ? yes : no". What's the equivalent?

    3. Is there a way to get the turn number?
    Just quoting this since I don't think that first question got answered and I'm curious about the answer as well.