Damage Formulas 101

Discussion in 'RPG Maker MV Tutorials' started by Skunk, Jul 28, 2017.

  1. Silva

    Silva Scoobityboo Veteran

    Messages:
    304
    Likes Received:
    151
    First Language:
    English
    Primarily Uses:
    RMMV
    The damage formula will pretty much let you affect anything you want and as many of them as you want. It's just evaluating the code you're putting in, so I doubt that's the issue.

    What happens if you paste my example into your damage formula? If that works but your code doesn't it may be useful if you could copy and paste your damage formula with the extra functions included so we can see what's causing the eval to fail.
     
    #41
    Engr. Adiktuzmiko likes this.
  2. Nofx670

    Nofx670 Villager Member

    Messages:
    6
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMMV
    ok I copy and pasted your code which works for adding the state but didn't change the variable Here is the code I wrote for the variable change which seems like it should work.

    $gameVariables.setValue(2, 50); a.atk - b.def

    would it be that I have named variable 2 should I be using the name instead of the number?
     
    #42
  3. Silva

    Silva Scoobityboo Veteran

    Messages:
    304
    Likes Received:
    151
    First Language:
    English
    Primarily Uses:
    RMMV
    The code you've shown should work. This still doesn't deal damage?

    My immediate suspicions are that you may have a plugin installed that is controlling variable 2, which is either preventing it from being changed or resetting the value immediately after it is changed. I would try turning off your plugins and seeing if the formula works after doing this. If it does it's a plugin causing the issue. If doesn't, it's worth checking that you don't have any other events / formulas changing the value of the variable. These could be common events that are being called by other skills/items, events set up on the troop, parallel / autorun events on the map after the battle, or a similar function being run in a different damage formula.

    EDIT: the engine doesn't look for variables by name, it's only by number. As far as I know, it's only the editor that keeps information regarding the variable names. When you're actually in game that information is inaccessible (and this is when your code is running).
     
    Last edited: Oct 22, 2019
    #43
    Aloe Guvner likes this.
  4. Nofx670

    Nofx670 Villager Member

    Messages:
    6
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMMV
    Wahoo it works I had an event that was using variable 2 when it shouldn't have been

    Thanks again for your help
     
    #44

Share This Page