I'm trying to implement a system where your team needs to score points to win the battle. The skills will add points to a variable, and whichever team gets to the required point total first wins. Is there a way to implement this alternate victory condition into the game?
Score Points to Win Instead of Finishing Off Enemies
RPG Maker MV SupportI think you'll need conditional branches that run a check for the variable each turn of the battle. You would do this in the troop tab.
Yanfly has a plugin that lets you create a 'base' troop tab event, and then refer to that for each battle so you don't have to redo your event in every single troop tab. You should probably look into that plugin.
Yanfly has a plugin that lets you create a 'base' troop tab event, and then refer to that for each battle so you don't have to redo your event in every single troop tab. You should probably look into that plugin.
I guessed as much. But what event/script makes the player/enemy win the game? I don't see any event that does it.
Event command 'abort battle' will end the battle. If you want some sort of victory scene to happen then you will have to event something. SRD has a plugin to run a common event when a battle ends, but I'm not sure if it works the same when you abort battle as it does when the battle ends normally. Worth checking out though.
I use that plugin, but it runs common events after the fact, meaning it already knows if the battle was won or lost. What I'm trying to say is, there's a difference between ending a battle and winning a battle, so how does it know that you won the battle, as opposed to just ending it?
This matters because besides changing the win condition, I don't want to end battles by knocking out the enemy either, so if it just so happens that the player knocks out everyone from the enemy troop, it shouldn't end the battle with a win.
EDIT:
Trawling around the forums, I found out that a win is triggered by applying the Knockout state to all the opponents. If anyone can help me confirm this following code:
$gameTroop.members().forEach(function(enemy) {
enemy.addState(1);
});
and help out with what the equivalent of this code is for my party members?
Well you might use two different variables for scoring points, one variable for player points, one variable for enemy points. Then add an if/else statement based on the higher variable.
For actors, I believe it would be
Or if that doesn't work, you could just add the death state to each actor individually.
BTW script call for abort battle is: BattleManager.abort();
For actors, I believe it would be
Code:
$gameParty.members().forEach(function(m) {
m.addState(1);
});
Or if that doesn't work, you could just add the death state to each actor individually.
Code:
$gameActors.actor(actorID).addState(n);
BTW script call for abort battle is: BattleManager.abort();
Original thread: https://forums.rpgmakerweb.com/threads/score-points-to-win-instead-of-finishing-off-enemies.122638/