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,483
Reaction score
721
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 Profile Posts

I feel still screenshots don't do my game justice. the characters don't move, but the filter over them does...
Wonder if this year, there be more MZ plugin than MV or that MZ is still small compare to whole MV collection
Zaj
Hey morning all! I got another quick question..I just switched to RMMZ from VX Ace..so I am wondering why default scripts(is that how u call it) of VXAce is available, but not in MZ's case? How do I figure out ahh I mean could you show me
Sometimes im the biggest fool alive... Ah well, ce la vie
The worst feeling in the world is going for a walk on a nice summer day, seeing an ice cream truck, and realizing you don't have any money with you :(

Forum statistics

Threads
111,346
Messages
1,060,362
Members
144,672
Latest member
oddRABBIT
Top