Axe's Culling Blade

Greetings, developers!


I'm trying to make a skill that deals damage against a Target and, if it's remaining hit poins are lesser than the damage taken, it dies instantly, but i don't know how to check, inside the skill effect itself, how much damage was dealt. Any help? I'm using Yanfly Engine Plugins, so it May be easier to be done.
"it does intantly" what?


Somehow your topic is missing what you want it to do, so we can only give general help ;-)


That said, most probably it could be done by using javascript code inside the damage formula - there is a topic for this pinned in this forum, where examples of conditional damages and other options are given.


For more complex cases you might have to use javascript with Yanfly's "Lunatic code" options, or request a specified plugin if it goes even beyond that - without more details on what should happen in the case we can't point you to a ready solution.
Sorry for the typo, i meant "dies instantly". Already edited the original Post.
yes code in the damage formula is all you need.


Basically compare the current target HP with the planned damage and either add state #1 (death) or deal damage depending on result.


Sorry, I can't give you the required javascript code, but it should be in the topic I mentioned.
Thanks for trying to help, but sadly planned damage != damage dealt, 'cause of damage variation and defense. What i'm trying to do is to check how much HP the Target has after the damage is dealt.
How stringent are your timing requirements?


If it is enough to have the enemy die at the end of the battleturn, you can use damage code in combination with a common event, but that still requires creative coding and eventing.


If it needs to be done during the skill sequence, then you need to use the action sequence plugins from Yanfly, no way to do that without plugins.
I've tried the following code:


<Post-Damage Eval>
var hp = target.hp;
var dmg = target.result().hpDamage;
if (hp > 0)
{
if (hp <= dmg)
{
target.startanimation(143);
target.addstate(1);
}
}
</Post-Damage Eval>


Everything seemed nice, but now i'm getting the problem in the attached image.


What's wrong with my code?

Captura de tela 2016-09-08 01.26.28.png
Update: Through a little research, I sust discovered how to make it work. The following code is available for those interested in replicating the effect:

Code:
<Post-Damage Eval>
var hp = target.hp;
var dmg = target.result().hpDamage;
if (hp > 0)
  {
  if (hp <= dmg)
    {
    target.startAnimation(XXX); \\Replace XXX with the Animation ID or your desire
    target.setHp(0);
    if (target.isDead())
      {
      target.performCollapse();
      }
    }
  }
</Post-Damage Eval>

Original thread: https://forums.rpgmakerweb.com/threads/axes-culling-blade.67918/