Yanfly Damage Core Elemental Help

● ARCHIVED · READ-ONLY
Started by VillainFan42 14 posts View original ↗
  1. I'm trying to use Yanfly's Damage Core to make a custom damage formula for my rpg, utilizing 2 custom stats: Intellect, and a hidden stat called dlv. Intellect is meant to determine the effectiveness of items and (more to the point) the degree to which elemental weaknesses deal extra damage, and how much damage is mitigated through elemental resistances. dlv, meanwhile, is used for calculating defense and magical defense damage reduction. It's used to stand in for moves based on a character's level, since enemies don't get actual levels, and for a party member it's set equal to their level.

    Most of the damage formula is unchanged, but I just want to replace the element rate step. Here's what I got for the formula so far, but it doesn't seem to be working:

    if (this.calcElementRate(target) >= 1)
    {
    baseDamage += ((this.calcElementRate(target)-1)*(a.int * a.dlv));
    }
    if (this.calcElementRate(target) < 1)
    {
    baseDamage -= ((this.calcElementRate(target)+1)*(b.int * b.dlv));
    }
    value = baseDamage;

    However, this isn't working. Here's what's going on with my tests.

    I'm testing this by setting the main mage of this game, Charon, against an enemy, with the spells temporarily set to have 0 variance. The enemy has an element rate of 200% for Fire and 0% for Ice.
    Both Charon and the enemy have had their dlv and int both set to 7.
    Because it has no special resistance or weakness top Thunder, I use the Volt spell as the control (these 3 spells have the same damage formula, by the way, and other than the element the only difference is their variance). It does 96 damage.
    When I cast Pyre, the fire spell, it deals 159 damage. The damage algorithm I want is:
    BaseDamage + (ElementRate - 1)(a.int * a.dlv)
    so the damage SHOULD be:
    96 + 1(49) = 145
    I have no idea where it got 159.

    Now let's try casting Frost. This spell dealt 47 damage. Since this is an elemental resistance, the damage algorithm I want is:
    BaseDamage - (ElementRate + 1)(b.int * b.dlv)
    the damage should be:
    96 - 1(49) = 47
    So logically, we can infer that this part of the damage formula is working properly for some reason.

    But the worst part is that during the enemy's turn, it uses a normal physical attack that does NOTHING.

    Just to make sure I didn't make a mistake with the stats, I disabled the damage formula and tried again. Note that because the only part of the Damage Core I changed pertained to the element rate portion, normal physical damage would be unchanged. And the physical damage it dealt per attack was indeed in the ballpark of 28, as it should be.

    So, to sum up:
    -The elemental resistance formula is working like a charm.
    -The elemental weakness formula almost works, but pulls some random number out of thin air.
    -When the enemy attacks me, I always take 0 damage.

    Working on a hunch, I decided to give the enemy spells to see what happened. After giving him Pyre and making sure his and Charon's stats were identical (in everything used to calculate magic damage- Magic Atk, Magic Def, and dlv- it dealt 78 damage to Charon, even though the two spells should have been identical in damage.

    It would appear that when the game calculates the enemy's int and dlv, it works fine. But when it calculates the player's stats, that's when everything seems to go wonky.

    If there's an expert at javascript who knows what's going on, could you tell me please? I don't want to start seriously working on the game until I get the main mechanics completely ironed out.
  2. Not entirely sure I can help, but one idea I do have is regarding the enemy. Are you using the "Enemy Classes" plugin by Himeworks?
    http://himeworks.com/2015/11/enemy-classes-mv/

    Without something like this plugin, I'm not entirely sure how the enemies would have the dlv hidden stat you're talking about. By manipulation this plugin, you can have enemies mirror stats that you would give to actors, such as the dlv stat. I did something similar with creating a stat that acted as a checkpoint for passive skills to give to enemies, so I know it works well like that for sure.

    Also, you said enemies don't have levels. Yanfly made a plugin to fix that, if you want to.
    http://yanfly.moe/2016/01/29/yep-64-enemy-levels/

    I've used this combo of plugins together and it solved a lot of headaches with enemy levels and classes. Lastly, how are you giving the dlv stat to players? Is it based on their level? Hope this helps at all.
  3. The dlv stat isn't the problem. The stat is already there with ICF-Soft's plugin, along with Intellect. The problem I'm having is I can't get the Damage Core to access those custom stats.
  4. I'm not exactly sure where you are pluging that code in, but try replacing b with target and a with this (as in this.dlv) and see if that helps at all.
  5. Maliki79 said:
    I'm not exactly sure where you are pluging that code in, but try replacing b with target and a with this (as in this.dlv) and see if that helps at all.
    Didn't work.
  6. Bumping this.
  7. Bumping this again.

    If the Yanfly Damage Core won't work the way I want it to, can someone point me in the direction of another plugin that will let me change the damage formula like that?
  8. Bumping this again.
  9. Bumpity bump.
  10. Hopeless bump...
  11. Have you tried using console.log() to figure out where the discrepancies are?
  12. Maliki79 said:
    Have you tried using console.log() to figure out where the discrepancies are?
    I tried that. However, it normally doesn't show where it takes the values from. And when I fiddle around with the javascript, it redirects me to an error in a completely unrelated Yanfly script.
  13. Ok. Well I tried. I'ma have to stop following this thread then. Good luck.
  14. Maliki79 said:
    Ok. Well I tried. I'ma have to stop following this thread then. Good luck.
    Thanks for trying.