I did this in my project by making a check after the damage is done (after the execute_damage call), if the target is killed ( hp <= 0), it runs the code specified by a notetag in the skill (and other game objects).. So basically I modified the item_apply method to do it
something like
Code:
execute_damage(user)
#Add the check after the execute_damage
kill_effect(user,item) if self.hp <= 0
with the kill_effect method basically checking the actor, classes, equipment and states for the presence of a notetag that I've set to determine what things to do upon killing a target
But ofc its a bit hazardous since I directly modified the script, but in my case its fine because all battle related stuff in my game was made by me anyway.. You can also opt to just alias item_apply and check if the target dies after calling the aliased method.
Also take note that this of course is for a general purpose "on kill" effect which can generate any effect that you might want
Alternatively, you can always just check the current HP of the target in your formula and if its less than the damage, do the effects that you want. It would ofc happen before the actual damage though
Code:
x=damage_formula;if x >= b.hp; then; a.tp += value;end;return x
But depending on your added systems, it might not be foolproof to check beforehand (like if you have an auto revive system or killing blow blocking abilities etx)