Trying to make a skill that damages all enemies and sets user to 1 HP

1709276463202.png

Hey everyone, so screenshot above is my failed attempt to do a hurt the enemy while also hurting self mechanic. The damage formula and enemy targeting is okay, but I think I'm just missing the little piece of code to get the self damage to work right.

Above was based on a similar question in the forums but this isn't doing the trick. I have most of the Yanfly plugins I've tried looking over Script calls, messing around with skill core, targeting core, but I can't seem to find just the right script to do this. Anybody have suggestions?
To have the HP cost actually work, you need to put "cost = user.hp - 1." That should allow it to work.

If you want to add something that prevents the player from using the skill if they only have one HP, changing to "cost = Math.max(user.hp - 1, 1)" will make the minimum cost equal to 1.
Thank you so much! That did the trick.

Also I had forgotten to close the tag but fixed that too.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-make-a-skill-that-damages-all-enemies-and-sets-user-to-1-hp.166339/