So I've been trying to figure this out for a while and I can't seem to get it to work at all.
What I want is to make a skill will inflict Death upon any enemies hit by it that are also currently sleeping.
I tried using Yanfly's Target Core, but I'm not great at the Lunatic stuff so couldn't figure out how to make a skill that only TARGETS Sleeping Enemies.
So I'm now using the damage formula: b.isStateAffected(10) ? b.addState(1): 1;
Which works, sorta. It can inflict any state or do any kind of damage to sleeping enemies, except for Death (State 1) and I don't know why.
Does the "Death" state not actually kill a target? Because inflicting it normally kills targets, but here it doesn't.
In normal condition without a any plugin it worked, maybe because plugins you use.
try disable any plugin and see what happened.
Maybe the enemy have resist against death
Make sure you put in the damage formula HP damage for the type. Right now it sounds like it is KO'ing the enemy, then healing them, which would remove the death state.
If that is not it, you will need to post screenshots of the entire skill, and the enemy it is not working on for us to be of much assistance, as we will only be guessing at that point.
What happens if you do this in your damage formula then?
b.isStateAffected(10) ? 999999: 1;
That should do 999,999 damage to anyone who is asleep, which should effectively be an instant KO.
b,hp isn't really random per say, it would be all the HP the target has. Might try that for now at least. And on a side note, I think as a player I'd get confused if some monsters start suddenly resisting being KO'd when sleeping, it would make me move the skill under the mostly useless category (think about how many skills in Final Fantasy games you don't use, as anyone you care to use them on, resists it!). Maybe what you suggested of making them resistant to KO and sleep would be ideal if just for that reason. Just a thought.
Though, are you in MV or ACE? Your profile says ACE, but you posted this under MV. Reason I ask is I got this to work in ACE with Yanfly's Target Selection script plus this code added to the skill:
<custom target: foes any state 10>
Then just have the skill apply the state KO with 100% chance.
Otherwise, you might need to go to the JavaScript boards and ask someone who knows JavaScript how to do the lunatic code so that it only targets those who are asleep. I don't know enough JavaScript to help there else I'd post it, as I'm still working mostly in ACE.
I disagree with that, but that's off topic so back to your question at hand:
What I would suggest at this point is posting your damage formula on the damage formula thread and see if there is an error in it. I don't see one, but that doesn't mean there isn't one. After all, I work more in ACE so there might be something that changed in MV that I don't see.