insta-kill state problems.

So I wanted to create a skill that has a low chance of insta-killing the target, however I wanted bosses to not be possible to 1-shot with it, I tried it through a state but it ended up letting the boss insta-kill my character, how do I fix this?
Maybe not give the boss the skill that can insta-kill? Or if you really want it to have that skill, then make a duplicate skill specifically for that boss, that doesn't have the insta-kill chance?
Maybe not give the boss the skill that can insta-kill? Or if you really want it to have that skill, then make a duplicate skill specifically for that boss, that doesn't have the insta-kill chance?

No no, you see, here's what I did,

I created a skill that had "insta-kill" as a state but instead of having a chance to knockout the one struck with the state, it gave the one who was hit with the state the ability to insta-kill instead
@Lyseth
Give your boss enemy a <Boss> notetag, then use the following damage formula:
PHP:
(a.isEnemy() && a.enemy().meta.Boss) ? b.mhp - 1 : b.mhp
This will one-shot the target if the user of the skill is not a boss. If it is a boss, it will leave the target with 1 HP.

EDIT: Oh, I missed that you only want to one-shot by chance...
EDIT2: If you want to add randomness to the skill, you can use:
PHP:
if (0.5 < Math.random()) { (a.isEnemy() && a.enemy().meta.Boss) ? b.mhp - 1 : b.mhp } else { 0 }
This would only do the same as above with a 50% chance, otherwise it would deal 0 damage.
It means you completely messed up your skill. To do an instant kill skill, it has to add the state KO. What you did was you added attack state, KO, which is not the same thing.

Also, to make bosses immune to the skill, give them state rate KO * 0. This will make them immune to the instant kill skill, but still able to be KO'd by normal means.

Side note: Do NOT use state immune KO. That will make them unable to be KO'd by any means.
It means you completely messed up your skill. To do an instant kill skill, it has to add the state KO. What you did was you added attack state, KO, which is not the same thing.

Also, to make bosses immune to the skill, give them state rate KO * 0. This will make them immune to the instant kill skill, but still able to be KO'd by normal means.

Side note: Do NOT use state immune KO. That will make them unable to be KO'd by any means.

The KO *0 thing does that go in damage formula space? I'd still like it to deal damage tho, while it had only 10% chance of ko, here's the description:

Deals damage to the target, has 10% chance of KO
It means you completely messed up your skill. To do an instant kill skill, it has to add the state KO. What you did was you added attack state, KO, which is not the same thing.

Also, to make bosses immune to the skill, give them state rate KO * 0. This will make them immune to the instant kill skill, but still able to be KO'd by normal means.

Side note: Do NOT use state immune KO. That will make them unable to be KO'd by any means.

it didn't work, the boss still gets knocked out, how do I do this properly?
The KO *0 thing does that go in damage formula space?

No. There is a Feature, in the Features Box on the "Enemies" tab, called "State Rate". Choose that one, pick "KO" (or whatever the Death State is called - usually the first state in your database), and set it to 0% for the boss that you don't want to be instantly KO'ed. Make sure you don't pick "State Resist", which would prevent the boss from ever being KO'ed even by normal damage.
No. There is a Feature, in the Features Box on the "Enemies" tab, called "State Rate". Choose that one, pick "KO" (or whatever the Death State is called - usually the first state in your database), and set it to 0% for the boss that you don't want to be instantly KO'ed. Make sure you don't pick "State Resist", which would prevent the boss from ever being KO'ed even by normal damage.

you mean traits? here's what I did

Untitled.png
Yup. That's what your enemy should have. Then, for the skill that has a chance of KO, use your normal damage formula, and in the skill's Feature Box, choose "Add State: KO (X)%".
If you are using Yanfly's Skill Core plugin, i think i have an idea.

- First: Install this plugin: https://forums.rpgmakerweb.com/index.php?threads/nemv-tags.59536/ (You can put it below all YEP plugins. I did and it still worked. This plugin allows you to put a note tag to an object for later use. This can help you mark which enemies are bosses via "<Tags: Boss>" in enemies' note boxes)

- Second: Setup your skill with this note tag. Right at the damage phase, it will check for conditions and perform certain actions if conditions are met. For example, i don't want my Bosses to be instantly killed, but this effect has a 10% chance on normal monsters:
Code:
<Pre-Damage Eval>
if (target.hasTag("Boss")){}
else if (Math.random() < 0.1){ //10% chance for a instant kill
target.setHp(0);
target.startAnimation(x);} //Change X into your animation ID you want to display when target is dead
</Pre-Damage Eval>

If you also want your actors not to be instantly killed by this skill, add tag "<Tags: Actor>" to your actors' note boxes and add another piece of code below to your skill's note box:
Code:
<Pre-Damage Eval>
if (target.hasTag("Boss") || target.hasTag("Actor")){}
else if (Math.random() < 0.1){ //10% chance for a instant kill
target.setHp(0);
target.startAnimation(x);} //Change X into your animation ID you want to display when target is dead
</Pre-Damage Eval>
By this way, both your Actors and Bosses cannot be instantly killed by this skill.

There is no need to Give it a try and tell me if it works.
Yup. That's what your enemy should have. Then, for the skill that has a chance of KO, use your normal damage formula, and in the skill's Feature Box, choose "Add State: KO (X)%".

still gets blown up anyway. here's what the skill has

Untitled.png
if (90 < Math.randomInt(101)) { (a.isEnemy() && a.enemy().meta.Boss) ? 100 + a.atk * 2.4 - b.def * 1.2 : b.mhp } else { 100 + a.atk * 2.4 - b.def * 1.2}

Try this, it's an edit of what @waynee95 did. For your skill paste what's above in the damage formula. Remove the "Add State Knockout", and remove the "State rate knockout" for the boss enemy.

And add this:
<Boss>
notetag to any boss enemies.

Basically if you have a normal enemy, it will deal damage normally 90% of the time and the other 10% of the time one shoot it. If you have a enemy with the <Boss> tag then it will deal damage just as as it would for a regular enemy that is not one-shoted.
if (90 < Math.randomInt(101)) { (a.isEnemy() && a.enemy().meta.Boss) ? 100 + a.atk * 2.4 - b.def * 1.2 : b.mhp } else { 100 + a.atk * 2.4 - b.def * 1.2}

Try this, it's an edit of what @waynee95 did. For your skill paste what's above in the damage formula. Remove the "Add State Knockout", and remove the "State rate knockout" for the boss enemy.

And add this:
<Boss>
notetag to any boss enemies.

what's the insta-kill rate with this formula?

EDIT: thx for showing me this, it refrains from insta-kill on bosses. :3
The insta kill rate is "10%", it is in the part where it says:
"90 < Math.randomInt(101)".

To alter the rate changed the 90.
So let's say you want the rate to be "60%", then change the 90 to a 40.

you can also do the reverse if that's easier so instead of what I orignal posted you can do this:

if (10 > Math.randomInt(100)) { (a.isEnemy() && a.enemy().meta.Boss) ? 100 + a.atk * 2.4 - b.def * 1.2 : b.mhp } else { 100 + a.atk * 2.4 - b.def * 1.2}

where the "10 > Math.randomInt(100)" is the insta kill rate and you need to change
the 10 to the rate you want. So if you want a "25%" chance change the "10" to a "25"
The insta kill rate is "10%", it is in the part where it says:
"90 < Math.randomInt(101)".

To alter the rate changed the 90.
So let's say you want the rate to be "60%", then change the 90 to a 40.

you can also do the reverse if that's easier so instead of what I orignal posted you can do this:

if (10 > Math.randomInt(100)) { (a.isEnemy() && a.enemy().meta.Boss) ? 100 + a.atk * 2.4 - b.def * 1.2 : b.mhp } else { 100 + a.atk * 2.4 - b.def * 1.2}

where the "10 > Math.randomInt(100)" is the insta kill rate and you need to change
the 10 to the rate you want. So if you want a "25%" chance change the "10" to a "25"

oh I see, so type in what you're subtracting from 100%, got it, thx again. 🙂
you're welcome.
Hopefully this works. 🙂
Not sure if you've solved this or not, but if it was me I would create two new states, one for the insta-kill and one for the boss. The one on the boss just makes it impossible to insta-kill, it would just be an empty invisible state that identified it as a boss (so not insta-killable). This should be able to be accomplished by just making the state resist the insta-kill state. The insta-kill state would be the side effect of the insta-kill skill, which does nothing except apply the insta-kill state, which would be resisted by the boss. I didn't test it but I think copying the Knockout state onto the insta-kill state should work for what you have in mind.
What I posted works perfectly in my game. In the future please post both your skill (all windows) and the enemy's data, as just saying it doesn't work is not a good way to get help.

As it is, you still need to post the ENTIRE picture. Don't crop it. There are two other things that can affect whether a skill hits (LUK of the actor and enemy, and which hit type it is), and you have not posted the entire picture so we have no idea if those are affecting you.

For reference, the chance of a state to hit is (convert everything to decimals first)

Chance to apply the state in the skill * enemy state rate * state rate of that state in any states the enemy is affected by * the LUK modifier (and even if you deleted LUK in your game, it is still computed using whatever stat you have there now).

Also you can change any of these via plug-ins. The most common one is to edit the LUK Modifier, as I know Yanfly has an option to edit it.

So....if you have done add state KO 10% and state rate 0% on the enemy, it is 0.10 * 0 = 0, or 0% chance to apply the skill (the rest of the numbers are not relevant, as anything times 0 is 0). There's no way for it to be applied unless you are either really doing something else, have completely altered how states work in your game, or have changed KO to not be state 1.

Original thread: https://forums.rpgmakerweb.com/threads/insta-kill-state-problems.83560/