[RMVXAce] Having some issues with a damage formula.

So, I'm trying to make an attack that does damage and heals the user (for less then the damage is output at, so drain HP as a damage type won't work, to my knowledge). But despite all my fiddling I can't seem to get it to actually do damage, it just misses (or does no damage if set on certain hit). I've ensured the enemy I'm testing on doesn't have high def (it has 1, the player has about 20 atk IIRC) The formula is as follows...

change_hp(a.atk - b.def*2); a.atk - b.def

As far as I'm aware, everything is in order. Damage dealing part of the formula is on the end of it, change_hp accepts formulas to my knowledge (and changing it to a flat number doesn't help, either), damage type is physical, it's set on HP damage, all that seems to be in order. Completely lost on why this isn't working. I've included a screenshot of the skill entry in RPG maker vx ace, to ensure I'm not missing something obvious, because it feels an awful lot like I am at this point. Thanks in advance! JabImage.png
Changing the Target's HP? Use this instead.

Ruby:
b.change_hp(a.atk - b.def*2); a.atk - b.def

But there's a problem with it. If the attack is too weak, it will make the target gain HP instead...
@AShriekingCloudOfBats
as said above your problem is that you never gave a target for the change_hp command.

However I don't know if that target should be b (the skill target) or a (the skill user)
it would not make any sense to use both the change hp function and regular damage if both go to the skill target, but on the other hand getting that much damage to the skill user doesn't make sense either.

so p0lease tell us what the skill is supposed to do in your opinion?
The skill is supposed to make the user gain HP based on the damage it deals to the enemy; I'm still getting a lot of basic stuff set up so I'll worry about the precise numbers later but that's the gist.

I'm now realizing that the damage formula in change_hp would just do damage to the user.

With all that said, adding a target - a.change_hp(x) - did nothing and the skill still isn't doing anything in combat. Damage or anything.

Am I right in thinking I'd need to get change_hp to output a negative number to get it to heal the user? or is there a way to flag change_hp as healing specifically?
Either I'm totally missing something or the letter used is wrong.
I would try
a.change_hp(a.atk - b.def*2); a.atk - b.def
This would apply the change hp to the actor using the skill and the damage to the enemy

negative value should not be necessary. this process of change hp is in the battlerbase and is set to add health. self.hp += value
Just plugged that in, no joy, it just misses and doesn't deal damage. I guess I might have to start looking for an alternative, if the formatting seems right.

Thanks for the help, all!
I have a custom drain rate in my previous project. I might as well drop this here.
Commercial free too.
Ruby:
# =============================================================================
# TheoAllen - Drain Rate
# Version : 1.0
# =============================================================================
($imported ||= {})[:Theo_DrainRate] = true
# =============================================================================
# Change Logs:
# -----------------------------------------------------------------------------
# 2014.01.05 - Finished script
# =============================================================================
=begin

  Introduction :
  By default, drain in RMVXAce is the same as the damage dealt. But some design
  wants a drain to be in a certain percentage. This script will do it for you
  
  How to use :
  Put this script below material and above main
  Use this tag in skill / item notebox
  
  <drain rate: n%>
  Where the N is the rate. 
  For example:
  <drain rate: 35%>
  
  Terms of use :
  Credit me, TheoAllen. You are free to edit this script by your own. As long
  as you don't claim it yours.

=end
# =============================================================================
# Tidak ada konfigurasi
# =============================================================================
class RPG::UsableItem
  
  def drain_rate
    if @drain_rate
      return @drain_rate
    end
    note[/<drain[-_\s]+rate\s*:\s*(\d+)\%>/]
    @drain_rate = $1.to_i || 100
    return @drain_rate
  end
  
end

class Game_ActionResult
  # ---------------------------------------------------------------------------
  # Overwrite make damage
  # ---------------------------------------------------------------------------
  def make_damage(value, item)
    @critical = false if value == 0
    @hp_damage = value if item.damage.to_hp?
    @mp_damage = value if item.damage.to_mp?
    @mp_damage = [@battler.mp, @mp_damage].min
    if item.damage.drain?
      @hp_drain = @hp_damage 
      @hp_drain *= (item.drain_rate * 0.01)
      @hp_drain = @hp_drain.to_i
    end
    @mp_drain = @mp_damage if item.damage.drain?
    @hp_drain = [@battler.hp, @hp_drain].min
    @success = true if item.damage.to_hp? || @mp_damage != 0
  end
end

Original thread: https://forums.rpgmakerweb.com/threads/rmvxace-having-some-issues-with-a-damage-formula.159973/