Without any plugins, you can achieve that using 2 Common Events, 4 variables, and (as inconvenient as it is) put 2 event pages in each Troop battle event section. For example:
Common Event #1 will be called
"My Skill - Turn"
Common Event #2 will be called
"My Skill - Use"
Variables will be numbered 1 to 4.
(You can change the variables in case 1~4 are already taken in your project, I'll let you know where in
underlined text)
In the Troops battle event section, create 2 pages. Both of them should have "Span" set to "Turn", and both of them should have a single event: The Common Event
"My Skill - Turn".
The only difference between the two pages is the "Conditions" part.
One page's condition should only have "Turn End" ticked.
The other page's condition should only have "Turn" ticked, with both numbers set to 0.
The skill itself should obviously be set to hit "All Enemies", and in the "Effects" section (on the center-right), add a Common Event effect (located under the "Other" tab). Choose the
"My Skill - Use" event.
In
"My Skill - Turn", the only event you should have is the Script event. In it, paste the following:
JavaScript:
var x = 0;
var y = $gameTroop._enemies.length;
$gameTroop._enemies.forEach(e => {
if(e.isDeathStateAffected()){y--}
x += e.hp;
});
$gameVariables.setValue(1, y);
$gameVariables.setValue(2, x);
If Variables 1 and 2 are taken in your project, change 1 and 2 to any other Var ID in the last two lines.
In
"My Skill - Use", you should have the following events:
1. A Script event, with the following code:
JavaScript:
var x = 0;
$gameTroop._enemies.forEach(e => {
x += e.hp;
});
$gameVariables.setValue(3, x);
var z = $gameVariables.value(2) - $gameVariables.value(3);
z = Math.round(z / $gameVariables.value(1));
$gameVariables.setValue(4, z);
If Variables 1~4 are taken in your project, change them to any other Var ID in the last four lines wherever it says "$gameVariables".
2. A "Change HP" event, which affects the entire party, and the Operand is set to Variable #4.
3. At this point, you can add your own events, for example: A recovery sound and a message that says something like "The party recovered \V[4] HP!"
4. Another Script event, with the following code:
JavaScript:
var y = $gameTroop._enemies.length;
$gameTroop._enemies.forEach(e => {
if(e.isDeathStateAffected()){y--}
});
$gameVariables.setValue(1, y);
$gameVariables.setValue(2, $gameVariables.value(3));
$gameVariables.setValue(4, 0);
If Variables 1, 2, and 4 are taken in your project, change them to any other Var ID in the last 3 lines.
Screenshots of how everything should look:
Spoiler: Screenshots
The skill itself:
First battle event page:
Second battle event page:
First Common Event:
Second Common Event:
And that's it, it should work now. I haven't tested it TOO extensively, so there might be some bugs. Let me know if you find any issues or if something isn't clear
🙂
Sample project via MediaFire