[Solved (More or Less)] Skill That Deals Recoil Damage

● ARCHIVED · READ-ONLY
Started by DragonRose35 7 posts View original ↗
  1. As per recommendation, I have decided to make separate threads for each skill type.

    *decides to copy & paste*

    I have a skill a character uses called "Leap of Faith" that is a 50% success rate that deals double damage. That is as far as I have gotten, however, because what I want for it is to also deal a certain about of damage to the user as well. It's a reckless sort of attack, like a... Body Slam in DQ. That sort of thing. Recoil damage, I believe is what I'm trying to explain.

    Any help would be greatly appreciated, thank you~

    ~ Dragon
  2. This one is a bit of a tricky one without plugins, so I'll use Yanfly's Damage Core to create it as such

    <damage formula>
    var recoil = 0.5;
    if (Math.random() <= recoil){
    value = (a.atk * 4 - b.def * 2) * 2;
    user.gainHp(-value * 0.2);
    } else {
    value = a.atk * 4 - b.def * 2;
    user.gainHp(-value * 0.2);
    }
    </damage formula>
  3. Are you using any plugins? Because you'll likely need something like Yanfly's Skill Core for something like this.

    http://yanfly.moe/2015/10/13/yep-8-skill-core/

    If you're not familiar with how to use plugins, you may want to take some time to learn about them. For now, add the following to the notebox in the Body Slam skill once the plugin is installed:

    <Post-Damage Eval>
    user.gainHp(Math.floor(-value * 0.25));
    user.startDamagePopup();
    user.clearResult();
    </Post-Damage Eval>

    Roughly speaking, this code applies after the user inflicts damage on the target. value refers to the amount of damage the attack inflicted. Math.floor rounds down to the nearest integer (eliminating the possibly of decimals). The number that determines recoil damage is -value * 0.25; if you want a different equation, that's what you want to change.
  4. I am unfortunately extremely unfamiliar with plugins and how they work and I am unsure that I would even be able to to begin to understand them. But thank you, for this. I will try it and see if this works.

    ~ Dragon
  5. Would this do it?

    a.mhp -= (damage formula); damage formula
  6. Countyoungblood said:
    Would this do it?

    a.mhp -= (damage formula); damage formula

    Your formula will reduce the actor's maximum HP, not the current HP and also does not account for variance.
  7. Junane said:
    Your formula will reduce the actor's maximum HP, not the current HP and also does not account for variance.

    oh,well let me take off the M.

    a.hp -= (damage formula); damage formula

    seems like a lot of extra work just to add variance but hey maybe OP cares about it.

    edit: variance.

    did a bit of research and found a pretty easy answer.

    a.hp -= (Random.new.rand(1..10) * 0.1 * recoil formula); damage formula

    this generates a random number from 1 to 10 then multiplies it by .1 (turns it to a percentage value) then gets multiplied by whatever you want recoil to come from. after that deal damage as you normally would.

    if you want 1 to 100 add a couple of zeros. if you want a different variance range change the the X's in rand(x..x) you dont need a plugin just a formula. this was a good challenge for my first week of learning how to use the damage formula. very fun.