Joined
Nov 5, 2015
Messages
3
Reaction score
0
First Language
English
I want to run an event at the end of a random battle but it doesn't seem to be possible. All I want to do is increment a variable for every type of enemy killed. For example, if I won a battle against two slimes, the variable SlimeKills would increase by two.

The end of a battle doesn't seem to count as the end of a turn so checking if they are both knocked out at the end of each turn does not work. Any ideas would be appreciated.
 

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
I want to run an event at the end of a random battle but it doesn't seem to be possible. All I want to do is increment a variable for every type of enemy killed. For example, if I won a battle against two slimes, the variable SlimeKills would increase by two.

The end of a battle doesn't seem to count as the end of a turn so checking if they are both knocked out at the end of each turn does not work. Any ideas would be appreciated.
What i do is set the troop to an immortal state then abort the battle manually using event commands in the battle event.

As an example you can set up a page condition like this:

Condition: Enemy HP (Slime) <= 0% - Span: Moment

Control Variable: SlimeKills += 1

Abort Battle

That should activate the page when the enemy loses all its HP, add +1 to your variable and then end the battle.   
 
Last edited by a moderator:
Joined
Nov 5, 2015
Messages
3
Reaction score
0
First Language
English
What i do is set the troop to an immortal state then abort the battle manually using event commands in the battle event.

As an example you can set up a page condition like this:

Condition: Enemy HP (Slime) <= 0% - Span: Moment

Control Variable: SlimeKills += 1

Abort Battle

That should activate the page when the enemy loses all its HP, add +1 to your variable and then end the battle.   
That does not account for multiple enemies though. In this case the second the first slime dies the battle ends even though the second enemy has not been killed. Even if I added another event page it would only trigger one of them. I also don't beleive the characters would be awarded any gold or EXP if the battle ends with the Abort Battle command.
 

RockEsper

Villager
Member
Joined
Jul 10, 2012
Messages
19
Reaction score
6
First Language
English
I'm interested in this too. I have a system where your equipment can produce items by chance, so a common event that played after every battle would be nice. Seems like it'd take a plugin.
 

RockEsper

Villager
Member
Joined
Jul 10, 2012
Messages
19
Reaction score
6
First Language
English
Oh, well that's pretty helpful.

Is there an easy way to have the battle check for no more enemies? The only way I can think is having it so at the beginning of the battle, it tallies up all the enemies, then you have a battle event run each turn (1+1*X) to check if the number of dead enemies = total enemies.
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,500
Reaction score
726
First Language
indonesian
Oh, well that's pretty helpful.

Is there an easy way to have the battle check for no more enemies? The only way I can think is having it so at the beginning of the battle, it tallies up all the enemies, then you have a battle event run each turn (1+1*X) to check if the number of dead enemies = total enemies.
for check no more enemy...

conditional branch. > script:

$gameTroop.aliveMembers().length == 0;
if true

do something you want there...
 
Last edited by a moderator:

RockEsper

Villager
Member
Joined
Jul 10, 2012
Messages
19
Reaction score
6
First Language
English
Er, what would be the Battle Event page's Conditions?
 
Last edited by a moderator:

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
That does not account for multiple enemies though. In this case the second the first slime dies the battle ends even though the second enemy has not been killed. Even if I added another event page it would only trigger one of them. I also don't beleive the characters would be awarded any gold or EXP if the battle ends with the Abort Battle command.
Sorry my game hasn't progressed past the point of single enemies yet so that's why I gave you a single enemy example.  I was being lazy and was hoping my example would give you enough to work on.

There are easier ways to do this with plugins as subsequent posters have pointed out.  But if you ever wish to do this with just event commands alone here are some additional steps you could take for a troop with two enemies. 

Conditions: Enemy HP (1)  <=  0% - Span:Battle

Control Variable: #0001 += 1

Control Switches #0001 = ON

If Switch #0001 is ON

If Switch #0002 is ON

Control Switches #0003 = ON

End

End

Conditions: Enemy HP (2)  <=  0% - Span:Battle

Control Variable: #0001 += 1

Control Switches #0002 = ON

If Switch #0001 is ON

If Switch #0002 is ON

Control Switches #0003 = ON

End

End

Conditions: Switch#0003 = ON - Span:Moment

Abort Battle

I just tested this and it seems to work.  You will  have to design your own death state though and apply it during the battle.   You will also have to adjust what skills the enemies use after they die so they don't continue to attack the player when they are dead.  And yes: you will also have to create your own battle victory event and apply experience and gold manually as you pointed out.  So I am guessing you will just be using the plugin. :)
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

Took a small break by playing VR. Latest update of these glasses unfortunately caused a little of trouble but it can be fixed with a manual operation.

Until You Fall is freaking awesome.
I am SO HYPED to share this trailer with everyone when its done. I almost want to tear up i had no idea how far i came along with Fallen Feather in these last 3 years.
how it looks from the top
Hike was successful guys! I made it to the top!
Add Film-like Visual Effects During Test-Play, Deploy Games with Electron | RPG Maker News #69

Forum statistics

Threads
112,187
Messages
1,066,469
Members
145,790
Latest member
LiteSilverwind
Top