[Solved] Sacrifice Skill

I... am so very sorry for all these threads asking for help with skills... hehe...~

Anyway, this one I think is... rather simple, compared to the others. All I would like help with is to figure out how to make a skill where a character can sacrifice his life for a specific character. Otherwise, I would know perfectly well how to do this with the <HP Cost: 100%> detail.

Here is a screenshot to explain a little better:
upload_2018-10-18_0-8-45.png


As you can see, I tried to input my own sort of formula for this, but I have quite obviously failed, or I would not be asking for help.

Any help would be appreciated, thank you~!

~ Dragon
damage type: Restore HP
formula: b.actorId() === 1 ? b.revive(); X; b.addBuff(3, 3); a.die() : 0
remove all effects and those note tags
also change scope to "1 dead ally"

this will revive target + heal X (use b.mhp for a full heal) + give target defence buff for 3 turns + kill the user
if the target is anyone but actor 1 it will do nothing

("share life" option, using a.hp in place of X to give target the HP the caster currently has. Because using this skill when caster is almost dead to full revive someone else doesn't make much sense vitality wise)
It sounds like it should work in theory, but I'm afraid that it doesn't.

I've tried about a dozen variations as well, and nothing has quite... worked...

~ Dragon
Update~!!

So, it doesn't completely work, but I played around with it and the sacrifice element works entirely. However...

It doesn't do what I wanted: which is to only revive and heal one specific party member and not any other party member.

Example: I tested this on Niko. It worked. I tested it on another dead party member, Jax, and it... also worked. Not what I wanted.

Skill Screenshot:
upload_2018-10-18_12-8-23.png


Here is what I have in the notebox:

<Pre-Damage Eval>
if (origin.isActor()){
if (origin.actorId() === 1)
origin.revive();
}
</Pre-Damage Eval>

<Post-Damage Eval>
a.die() = O
</Post-Damage Eval>

~ Dragon
Another Update:

Skill now only applies to Niko, however, it doesn't heal him before it kills Atlas.

Screenshot:
upload_2018-10-18_12-58-1.png


Notebox:

<Pre-Damage Eval>
if (target.isActor()){
if (target.actorId() === 1){
if (target.skills().contains($dataSkills[45])){
target.revive();
target.gainHP(a.hp);
}
}
}
</Pre-Damage Eval>

<Post-Damage Eval>
if (target.isActor()){
if (target.actorId() === 1){
if (target.skills().contains($dataSkills[45])){
a.die() = O
}
}
}
</Post-Damage Eval>

~ Dragon
You can make sure it only works on Miko by using this notetag:

<Custom Select Condition>
if (target.name() === 'Prince Miko') {
condition = true;
} else {
condition = false;
}
</Custom Select Condition>

This only allows Prince Miko to be selected for the skill. Requires Yanfly's Selection Control.

For the actual effect, the skill database has the ability to have the Effects tab remove the Knockout state (which revives the target; be sure to add a formula for the revival heal). If you don't want the amount of HP displayed on the skill, you can also use:

<After Eval>
a.gainHp(-a.hp)
</After Eval>
Unfortunately, Junane, that seems to make my game crash for some reason...
upload_2018-10-19_12-49-1.png


~ Dragon
Can you reproduce this and press F8 so a console loads up then screenshot it?
So I tried replicating what I did, but I couldn't remember, so I did what I thought I had done... but then tested it... and it works, somewhat.

Except that it still doesn't heal Niko for the amount of damage that Atlas has when casting the ability.

Notebox:

<Custom Select Condition>
if (target.name() === 'Niko') {
condition = true;
} else {
condition = false;
}
</Custom Select Condition>

<Pre-Damage Eval>
b.revive()
</Pre-Damage Eval>

<After Eval>
a.gainHp(-a.hp)
</After Eval>

Screenshot Skill:
upload_2018-10-19_14-24-28.png


Battle Shots (Atlas had 166 Health as Per the Test):
upload_2018-10-19_14-25-45.png


~ Dragon
You do not need "b.revive()" if you have "Remove State: Knockout 100%" in the Effects tab of the skill, the latter of which works more reliably.

In your formula, "a.hp" is sufficient enough.
Thank you so much! It works perfect now~!

~ Dragon

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/solved-sacrifice-skill.101199/