RMMV - Multiple Target Skill Question

Hi everyone,

I'm having trouble designing Skills that do one thing to one battler plus another thing to a different battler, because I can't figure out who the Skill's Scope should be aimed at, and how to still affect multiple battlers in different ways.

Basically, I want to create these 3 sacrificial/suicidal Skills, which are all very similar:
Skill 1 = The user of this spell sacrifices themself (loses all HP) in order to restore the rest of the party to full HP.
Skill 2= The user of this spell sacrifices themself (loses all HP) in order to restore the rest of the party to full MP.
Skill 3= The user of this spell sacrifices themself (loses all HP) in order to restore the rest of the party to full TP.

Instinctively, I feel like the Skill's Scope should be "The User", and that he should be taking an insane amount of damage / Knockout state so that he's dead for the battle, but I don't know how to then restore the allies to full HP, MP, or TP (because they're not within the Scope).
Conversely, I could change the Scope to be "All Allies" so that everyone gains their desired HP, MP, or TP, but then I don't know how to simultaneously kill off the user of the Skills.

Any ideas on how I could pull this off - two different effects for two different groups within the same Skill? Maybe there's a work-around that could involve States or Common Events or even Plugins?

Thank you!

Sincerely,
DPB
You could make the scope All Allies, set the damage type Recover HP, and try a damage formula like this:
JavaScript:
a.addState(1); 9999
I.e. "add state 1 (KO/death state) to the user, then return a result of 9999" = "user dies; 9999 healing to all targets". 🙂
You could make the scope All Allies, set the damage type Recover HP, and try a damage formula like this:
JavaScript:
a.addState(1); 9999
I.e. "add state 1 (KO/death state) to the user, then return a result of 9999" = "user dies; 9999 healing to all targets". 🙂
or alternatively replace 9999 with b.mhp
so it will heal for each allies unique max hp instead of flat 9999 😀.
Interesting ideas, thank you! And just to check that I understand why this would work:

1. a.addState(1) applies the first State (Knockout/Death) to the user because "a." means we're applying something to the user (regardless of the Scope), and this will happen regardless of what Damage Type is selected?

2. b.mhp with Recover HP (or b.mmp with Recover MP) will heal All Allies because "b." refers to the Scope (which would be set to All Allies)?

3. Does the b.mhp (or b.mmp) idea also heal the user (i.e., is the user included as "an ally" in the Scope of All Allies)? Because I don't want the user to regain any HP or MP... only the other party members.

4. And could this be used to gain 100 TP too, somehow? There's no Damage Type called TP Recover, although there is an effect that can Gain TP (although I feel that the TP gained would be by the user, and not by the other party members).
Interesting ideas, thank you! And just to check that I understand why this would work:

1. a.addState(1) applies the first State (Knockout/Death) to the user because "a." means we're applying something to the user (regardless of the Scope), and this will happen regardless of what Damage Type is selected?
Yes. Sort of. I don't think the damage formula is checked if the Damage Type is set to None, because it doesn't do anything that would need to check the damage formula.
2. b.mhp with Recover HP (or b.mmp with Recover MP) will heal All Allies because "b." refers to the Scope (which would be set to All Allies)?
This is correct.
3. Does the b.mhp (or b.mmp) idea also heal the user (i.e., is the user included as "an ally" in the Scope of All Allies)? Because I don't want the user to regain any HP or MP... only the other party members.
Technically yes, as the user is included in the scope of 'All Allies', but they're already dead at the point that the healing goes out, so they are not affected by it. If you removed the 'add state 1' to the user portion of the formula, or changed it to a different state that doesn't kill the user, they would also be healed.
4. And could this be used to gain 100 TP too, somehow? There's no Damage Type called TP Recover, although there is an effect that can Gain TP (although I feel that the TP gained would be by the user, and not by the other party members).
Yes, but since there isn't a damage type for TP gain, you'd need to add tp to the targets via the damage formula itself using b.gainTp(x).
Okay thanks! Out of curiosity, would the following two setups also be reasonable (and, I suppose, equivalent) for this kind of Skill:

Scope: The User
HP Damage: 999999
(Effect) Common Event: Change HP +9999 (for each of the other party members)

and/or

Scope: The User
Damage Type: None
(Effect) Add State: Knockout
(Effect) Common Event: Change HP +9999 (for each of the other party members)

I'm guessing these would have similarly desirable results to the above equation idea?
Both of those would work with no issues.
The main reason to consolidate this sort of thing into only the damage calculation is to save yourself using a common event. You can do multiple things in the damage formula at the same time, as seen above in @caethyril 's code. Separating the different effects with ;.

a.addState(1); b.gainTp(100); b.mhp
The above code would kill the user, give all allies 100 tp, and fully heal them all, for example.
With a common event you'd need some way of remembering who the user was, unless there's only one actor who is ever able to use the skill. You could do this with some kind of "store actor ID in variable" approach, e.g.
JavaScript:
v[1] = a.actorId(); a.addState(1); b.mhp
I.e. "store the user's actor ID in game variable 1; etc", then use that variable in the event. I think it's easier to just do it all in the formula.

Also, the special param REC ("Recovery Effect") multiplies incoming healing. If someone has less than 100% REC, setting the healing to b.mhp (target's max HP) might not fully heal them. Depends what you want to happen in that situation, just thought I'd mention it~

Yes, but since there isn't a damage type for TP gain, you'd need to add tp to the targets via the damage formula itself using b.gainTp(x).
There are Gain TP and Recover HP skill effects available; nice to have it all in the formula, though. ^-^
Thank you everyone! This has been super useful, and I still have a lot to learn!

Original thread: https://forums.rpgmakerweb.com/threads/rmmv-multiple-target-skill-question.130174/