Tutorial: DBS - Defeated Enemy Counter
Difficulty: Intermediate
RPG Maker: 2003
Author: Thejackyl

Have you ever wanted to have a new secret or challenge or whatever after you defeat certain number of enemies?
If so, this tutorial is for you.

Simple, Limited way

The simpler way would be to implement a "touch encounter" system. Where you touch an enemy, and start a battle. In the victory handler you input the code:
<>Variable [Counter] + # of enemies

However, if you want enemies that run away extremely often (i.e. Cores from Lufia 2, Loopers from Skies of Arcadia) then you can't because the variable will still increase.

Harder, but more open way

What you'll need
1. Switches. One per Enemy
2. 2 Variable
    - [Counter] The monster Counter
    - [MsDead] # of monsters in group, that are dead
3. Battle Events, One per enemy, plus one
4. Common Event, PP that resets certain switches and variables.
5. Special Monster
6. Switch Skills for "runners"


Let's start with, what I think is the easiest things first
Switch Skills
Run1 - Activates Switch MonsterRun1
Run2 - Activates Switch MonsterRun1
etc...
You'll need to use separate skills for seperate runners, or else, all of them will run at the same time.

Special Monster
For this code, you'll need an enemy without a name or graphic, that can not be defeated.
Here is an example:

HP: 99999 Mp:0
Atk: 9999 Def: 9999
Int: 9999 Spd: 1(lower speed prevents ATB slowdown)

Monster Group Tab
First, make the first monster group you want. When that is done, add the invisible, invulnerable enemy.

Battle Events - Enemies
Trigger: If Switch [Monster1] HP =[0]
<>If switch [Monster1] is OFF
    <>Variable [Counter] +1
    <>Variable [MsDead] +1
    <>Switch [Monster1] ON
    <>End
<>End

Now make one for the rest of the enemies. You do NOT need to make one for the invisible enemy. (Changing Switches for their respective monster)

Battle Events - Other Event
Trigger: If Variable [MsDead] = (# of beatable enemies)
<>change monster condition [(Invisible Enemy)] [Dead]
<>End

This method requires a new switch skill and monster for each monster that can run away(i.e. Monster1 can use Skill Run1, Monster2 - Run2 etc.)

Battle Events - For running enemies
Trigger: Switch [MonsterRun1] is ON
<>Force Flee [Monster1]
<>Variable [MsDead] +1
<>Switch [MonsterRun1] OFF
<>End

Common Event
This Common Event should be a Parallel Process because PP's do not activate during battles.
<>Variable [MsDead] Set 0
<>Switch [Monster1 - Monster7] OFF
<>End

Once you get all of that done, you should have a working slain enemy counter, even if monsters run away


Click to Return to the Tutorials Page