How would i make a spell that when used a certain amount of times in a fight, win you the fight.

I want to set up a sacrificial spell that deals damage to the entire party but if you use it 5x in a single fight it would end that fight as a win for you but have no idea how to go about doing it.
You could attach a common event to the skill, and in the common event add 1 to a variable, then check if the variable is = 5, win the fight (by setting the HP of all enemies to 0).

You would have to set the variable to 0 at the start of each battle.
You could attach a common event to the skill, and in the common event add 1 to a variable, then check if the variable is = 5, win the fight (by setting the HP of all enemies to 0).

You would have to set the variable to 0 at the start of each battle.
I havent really dabbled into common events yet do you know of a tutorial with them related to calling skills
You create a common event that does what you want and name it.
You create your skill and double-click in the Effects box. Look through the tabs to find the common event option (probably the last tab). Select your common event.

A common event is (almost) just like a map event. It's just a list of commands and a trigger condition. When you attach a common event to an item or a skill, you leave the trigger as None.

If the common event is being triggered by a skill or item, and you are using the skill or item in battle, then you can use the battle commands in your common event (those on tab 3 of the event commands). If you can use the skill/item in OR out of battle, then your common event would need to confirm if you're in battle before being able to use those commands.
You create a common event that does what you want and name it.
You create your skill and double-click in the Effects box. Look through the tabs to find the common event option (probably the last tab). Select your common event.

A common event is (almost) just like a map event. It's just a list of commands and a trigger condition. When you attach a common event to an item or a skill, you leave the trigger as None.

If the common event is being triggered by a skill or item, and you are using the skill or item in battle, then you can use the battle commands in your common event (those on tab 3 of the event commands). If you can use the skill/item in OR out of battle, then your common event would need to confirm if you're in battle before being able to use those commands.


I watched a few tutorials and tried my best but is till dont understand what im trying to accomplish.
upload_2018-12-24_15-14-1.png
upload_2018-12-24_15-14-9.png
You only need one variable. In your common event, just have the first line. That's it. Then in your troops tab, have the condition that Grief (your variable) = 5. You can then set the events within that to bring the HP of every enemy in that troop down to 0. You would also need to reset the variable back to 0 (do that before you change the HP or the enemies will just die and the variable won't change).



Code:
Control Variables [0001: Grief] += 1
Conditional Branch: Variable [0001: Grief] = 5
  Change Enemy HP [1] = 0
  Change Enemy HP [2] = 0
  Change Enemy HP [3] = 0
  ... etc
End

Be careful using that variable. If you have any plugins that use variables, they might use those by default, so if you also use them, you're going to cause very unexpected issues.

Original thread: https://forums.rpgmakerweb.com/threads/how-would-i-make-a-spell-that-when-used-a-certain-amount-of-times-in-a-fight-win-you-the-fight.103638/