MV Trouble with a skill. KO into self heal.

Hey,
I've had a nosey about first and can't find out how to do this skill.
Ice user - Puts self into an Ice box for 3 turns (Can't attack or be attacked) then heals for 35% after the three turns,

any advice?
needs a plugin - follow-up states are not possible by default.

with a plugin there are several ways this can be done depending on which pluguins you want to use.
it might be possible with YEP_ActionSequency and lunatic code.

but 1 question though, that the actor cannot attack is self explained,
but why not be attacked?

Like if an enemy attack or is the only actor alive in the party, the enemy
cannot attack, but if they do attack, it breaks or dmg the ice block to gain
lower health?

like 3 turns, so ice block can hold 3 attacks, each time it got attack -10% HP
recover, it iceblock is gone BEFORE the 3 turns, it gets 0% HP recover.

this is simply an idea, but it can happen it would be the only actor alive
so 3 turns will nothing happens.
I like the Idea, I have it similar with my Flamer. Places up a barrier and any damage turns to hp until broken. Maybe the same but if the Cage is smashed you don't heal, otherwise 35%, 50 and 100 based on level of skill unlocked.
or against a fire enemy, the iceblock is gone in 1 attack if fire is used.
but while lunatic code isn't my strong suit, we still need to know what
plugins you have or use like Andar said.

if you dont have YEP plugins (battle core, barrier plugin, actionSeq. etc
we need to create it in an alternate way, but plugins are still required
in order to make this effect.
This wouldn't be hard to do with Yanfly's Buffs & States, no need for Lunatic stuff or programming the entire thing into an Action Sequence.

In the state itself, give it the Restriction: Cannot Move - that will prevent the actor from doing anything on their turn.

In the notetag, do:
Code:
<Custom Remove Effect>
user.gainHp(Math.min(user.mhp-user.hp, user.hp*.35));
</Custom Remove Effect>

The slightly trickier part is them not being able to be attacked. Do you mean that they literally can't be targeted for an attack? Or is it okay if they just take zero damage?

If the latter, put into the state's notetags:
Code:
<Custom React Effect>
value=0;
</Custom React Effect>

If you don't want them to be able to be targeted, that's trickier, and I can only think of using Yanfly's AI Core and programming it into every enemy in the game, to ignore targets with that state. You might be able to write a plugin that ignores them for targeting like it does with the Knockout state, but I don't know of an existing one.

Edited to use a function that should show healing popup numbers in combat.
This is kinda easy to do with YEP's Buffs and States Core, like @ATT_Turan mentioned above. However, should have used <Custom Leave Effect> (activate on turn decay) instead of <Custom Remove Effect> (activate upon removed by all means). <Custom Leave Effect> means if your state is dispelled when the turns are still counted, its effect is also lost.
That's true - by default there isn't anything to remove buffs, so I don't think about that much unless someone includes it as a part of their question 🙂
If you want to prevent the user from even being selected, you could use Yanfly's Selection Control plugin. It has a bunch of notetags for that, such as <Cannot Select: Skills> <Cannot Select: Items> or a blanket <Cannot Select: All>
The only issue is, Select Control is a paid plugin. Not sure if the dev wants to go that route, but that's the easiest way to prevent the user from being selected by both allies and enemies.
If you don't want to go the paid plugin route, then Turan's suggestion of setting all damage against them to zero works, and play an animation to show such an effect. You could also set the SP Parameter 'Target Rate' to 0% in the state's traits effect? To reduce how often enemies target that player, only to deal 0 damage (because that's an exploit I as a player would use 😛 )
That would work, too. The trick is the same as with the A.I. Core, you'd have to put that on every other skill that could possibly target that actor.
The <Cannot Select> tags?
No, those can go in states 🙂 Any battler with a state that has that tag can't be selected.
Ooh! Good call, that's definitely the way to go.
Moderator note: Moving to Plugin Requests
Thank you so much, going to work on it now. I might end up mixing it up with the breaker and fire Idea as well. Good stuff guys!
This is what I went with in the end.
Falls asleep within a block of ice.
While in the Ice the user can't attack for 3 turns, upon awaking recovers 35% hp.
Also all damage taken is recovered to hp.
It's a strong healing skill, but you can't attack for 3 turns. (As you get stronger the recovery rate is 50% and 100%)


<Custom Apply Effect>

user.setStateCounter(stateId, 1000);

</Custom Apply Effect>



<Custom React Effect>

if (value < target.getStateCounter(stateId)) {

target.addStateCounter(stateId, -value);

value = -value;

target.startAnimation(148);

} else {

value -= target.getStateCounter(stateId)

target.gainHp(target.getStateCounter(stateId))

target.startAnimation(148);

target.setStateCounter(stateId, 0);

}

if (target.getStateCounter(stateId) <= 0) {

target.removeState(stateId);

}

</Custom React Effect>





<Custom Remove Effect>

user.gainHp(Math.min(user.mhp-user.hp, user.hp*.35));

</Custom Remove Effect>


Just tested it works fine. I guess the only thing I could add is a another else is remove effect, if removed early.
Just a couple of thoughts.
value = -value;
This is kind of weird. Why do you want to turn the incoming damage into the negative value of itself? I don't know if that will accidentally heal the target (the engine might error-check for that), but I don't see a point to it, either, since you don't reference the value again.

Also, I don't know exactly how JavaScript handles it, but if your damage calculations allow for a high enough defense to produce an attack with 0 damage, that could throw an error.

It seems to me you want to just say value=0;
Just tested it works fine. I guess the only thing I could add is a another else is remove effect, if removed early.
As JamesRyan noted above, the thing to do is to make it a Custom Leave Effect, instead - that way, the heal only happens when the state goes for three turns and expires naturally.
Just a couple of thoughts.

This is kind of weird. Why do you want to turn the incoming damage into the negative value of itself? I don't know if that will accidentally heal the target (the engine might error-check for that), but I don't see a point to it, either, since you don't reference the value again.

Also, I don't know exactly how JavaScript handles it, but if your damage calculations allow for a high enough defense to produce an attack with 0 damage, that could throw an error.

It seems to me you want to just say value=0;

As JamesRyan noted above, the thing to do is to make it a Custom Leave Effect, instead - that way, the heal only happens when the state goes for three turns and expires naturally.

With zero damage, the state stays on the same number and the animation happens, but it still works.
The damage taken is removed from the states barrier which I set a 1000. I'm not 100% on it but I reference -value in the second line of <Custom React Effect>. I thought I was basically telling it to remove damage from the barrier.

I've put the character through her paces and it works, so I'm unsure..

Yeah, I'll add the Custom Leave now, change it up slightly.

Thanks again.
With zero damage, the state stays on the same number and the animation happens, but it still works.
The damage taken is removed from the states barrier which I set a 1000. I'm not 100% on it but I reference -value in the second line of <Custom React Effect>.
The line I quoted, value = -value is the third line. I don't see a reason to do that oddly convoluted thing that can potentially cause errors, rather than just zeroing it out.
I thought I was basically telling it to remove damage from the barrier.
That's the line with target.addStateCounter. Again, the line I quoted happens after that.

The variable "value" refers to the incoming damage. When you say value = -value, you are saying "I hit you for 129 damage, and now change that to -129 damage." I can't imagine why you want to do that. If it's resulting in the actor taking 0 damage, then that's MV's internal error-checking fixing your mistake.

Original thread: https://forums.rpgmakerweb.com/threads/trouble-with-a-skill-ko-into-self-heal.136038/