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,501
Reaction score
727
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

For a long time I always consider XP soundtracks as the best one.
Just listened to some of MZ tracks from the free version.
It's... Quite mindblowing. xD
Only listened to the battles, towns, and fields.
But I'm sure the rest are equally good. :D
What do you guys want to see for the new Jump into Javascript? A continuation of the rpg_objects, or would you prefer a "lesson 0" where I go back to the absolute basics of Javascript and cover the fundamentals of the language and its construction?
Hey RPG members!!

How do you finish projects? Some new game developers start off strong but end up losing momentum. What keeps you motivated while working on new projects?
Feeling wee sleepy.. ZzzZ
So many threads to move to the right place. My post count is awesome, but 95% of it is due to moving things.

Forum statistics

Threads
112,454
Messages
1,068,395
Members
146,114
Latest member
HeitorFull
Top