I found a solution:
Code:
$npc->DoSpecialAttackDamage($h_ent, 400, $h_dmg, $h_dmg, -1);
Have the npc do a special attack, which has as an argument a target (make it $h_ent). I put the skill at 400 so as not to fail, and max and min damage the same as $h_dmg. It works perfectly.
Thank you NatedogEZ for all the help trying to solve this!