Enemy Encounter System
Written By Adon237
Much Thanks to HK!
Hello, everyone! I am sure some of you have been hunting for a decent
On-Map encounter system, or nearly anything that isn't the random
encounters. I don't blame you! Nowadays, random encounters are quite
annoying, and really harm the exploration aspect of some games,
particularly RPG Maker games, that I have played.
Here for you I have details for an encounter system that can meet the following:
- Is easy to use
- Allows for different types of encounters
- Is easy to expand
- Respawns encounter events
Once again, if you do credit anyone for this in your game (that is if you are cool enough to credit), let it be
Hanzo Kimura for building the guts of this system.
This
is literally backwards compatible with RPG Maker VX, so if you are
still holding on to VX and have happened to stumble upon this tutorial,
you can follow the same steps to get this working!
PART 1:
• Go to the Common Events Tab
• Go to a new common event.
• Name it something similar to ***MONSTER DEFEAT*** There are no triggers.
• In the common event, simply put a SHOW ANIMATION command, which will
serve as the animation that plays on the enemy event when it dies. It
should be targetted on "This Event".
• Then add a Wait 90 Frames.
• Optional: Add an "After Battle Cleanup Event", to turn off any switches or other stuff you had activated in the battle.
You need nothing more here, do not worry.
PART 2:
• In another common event, name it ***RESPAWN FOES***, There are no triggers.
• In a Set Move Route command, do the following:
This Event (Skip)
$> Change Opacity: 0
$> Wait: 1 Frame(s)
$> Change Opacity: 55
$> Wait: 1 Frame(s)
$> Change Opacity: 155
$> Wait: 1 Frame(s)
$> Change Opacity: 255
• Then do a Self Switch command turning
Self Switch A OFF.
Part 3:
• In your next and final common event, name it ***ESCAPED BATTLE***. There are no triggers.
• Next you must choose a variable you will use as your "Gold Lost"
variable. This will be used to calculate how much gold you loose for
escaping. Remember, if you do not want this, it is very easy to just
clear this common event. (Though it is recommended that you keep the
actual event in the same slot, just in case you add something else.)
• In a
Control Variable command, set the "Gold Lost" variable to the party's gold amount.
• In a another Control Variable command, multiply the "Gold Lost" variable by the number of party members in your party.
• In a final control variable command, divide the "Gold Lost" variable by 24.
• In a
Change Gold command, subtract the gold amount by the "Gold Lost" variable.
• In a message command, type in "You lost \v[Gold Lost Var ID] gold for escaping!".
If your "Gold Lost" variable has an ID of 1, you type in \v[1]. If it has an ID of 187, you type in \v[187].
• Next, In a
Set Move Route command, do the following:
This Event (Skip)
$> Change Speed: 5
$> Move away from Player
$> Move away from Player
$> Chage Speed: 3
Comment: Above: Makes the enemy 'bounce' back two tiles away from the player, so you don't immediately re-encounter them
upon escaping. Just add more "Move away from Player" commands if you want the enemy to move back further.
• In another
Set Move Route command, do the following:
Player(Skip, Wait)
$>SE: "Blow1", 100, 100
$> Walking Animation OFF
$> 1 Step Backward
$> Walking Animation ON
Comment: Above:
The SE play is optional, it is just an escape sound effect of any kind.
The player also moves one step back for good measure.
Part 4:
•
Now, the last part, the actual encounter! Now that you have created all
of the CEs that the encounter event will use, you can start creating
your own encounters!
• I provide TWO tutorials on how to create TWO different types of encounters,
Passive and Aggressive encounters.
In Spoiler: The bottom two graphics are the flames I used for Aggressive and Passive encounters respectively.
Tutorial: Passive Encounter
• Passive encounters are calm encounters
that wander the map, not bothering you. Your presence doesn't disturb
them, and they won't get violent unless you try to mess with them (aka
pressing X/Enter on them.).
• First, create an event on a map.
Find a suitable graphic. I myself used a blue flame to represent these.
You can check off whatever options are needed for your graphic, those
aren't crucial to the process.
• Set the priority to
Same as Characters. You don't want them below or above you unless you are really creative and have devised some pretty cool encounter.
Triggers are an important detail that distinguishes some encounters from each other. Since this encounter is passive, set the trigger to
Action Button. This will activate them only when the player tries to interact with them.
• In
Autonomous Movement, set the type to
Random, the speed to
x2 Slower, and Frequency to Lowest.
• Next, in the event's first page, do a
Control Variables command, choose a variable to be your
Encounter Variable. I will refer to that variable as Variable X from this point forward.
• Under
Operation, make sure it is at
Set. Under
Operand, set that to
Random, 1 ~ 100. That will be used to randomly determine which monster troop you will encounter.
• Now, put a
Play SE command. This should be like a surprised noise, but really it can be whatever you want.
• Next, do a
Show Balloon Icon: This event, Exclamation, Wait command.
(If using VX, then put a Wait Command for 35 frames) The player has to
have some way of telling what is happening, so what is better than a
noise and a balloon icon?
• Now, create a
Conditional Branch. Make sure it is set to
Variable,
the specific variable Variable X, make it less than or equal to, and
then choose constant. Set the constant to 50. Then, check the box that
says "Set handling when conditions do not apply" or something like that. You will probably do this like 3 more times, so come back here to refer to it when needed.
• Inside the Conditional Branch, but in a
Battle Processing command.
Choose direct designation, and the monster troop you want to be encountered. Check the "Can Escape" option.
• In the
Battle Processing command's
Win condition, first put a Call Common Event command, and call the
MONSTER DEFEAT common event that you set up earlier.
• After that,
Turn that event's Self Switch A to ON.
• In the
Escape condition, just call the
ESCAPED BATTLE common event you set up.
• In the
ELSE part of the
Conditional Branch,
make another Conditional branch with the same settings we had in the
last one, except the constant which will be set to 70 this time. Repeat
the steps above after the creation of the conditional branch, with a
different monster troop.
• Repeat the above bullet point twice, except you set the constant to 90, and then 100. Once you have 4 conditional branches, you stop.
•
Create a new page in the event. Do not set a graphic. On the page condition, set it to SELF SWITCH A, ON. The options, priority, and autonomous movement are irrelevant to this page. Set the trigger to
Parallel Process.
• On the new page, Create two
Wait commands, setting each to
999 frames.
That seems obnoxious, but it is really appropriate. If you want them to
respawn faster, I suggest removing one of the waits. You don't want
them to automatically respawn, do you?
• Finally, add a
Call Common Event command, the
RESPAWN FOES common event.
At last, you have crafted a On-Map encounters system, and a
passive encounter! Try it out! Remember that you will have to change
the troops that are encountered when needed, but that is it! Then you
copy-paste them in the locations you want on the map. Good job!
Tutorial: Aggressive Encounter
• Not much is different as far as event code goes in these than the Passive encounters.
• Copy paste your Passive encounter event and open it up. (This will save time.)
• Change the graphic to something suitable. (I used a red flame)
• In Autonomous Movement, set the type to Custom. Then click the "Move Route..." button.
• Depending on what you want, you could either have
Move at Random, Move toward player, or just Move toward player. Choose one.
• Set the
Speed to
x2 Faster, and
Frequency to
Higher(4).
• Finally, set the
Trigger to
Event Touch.
•
These encounters will move towards you, and when they touch you an encounter will start.
•
You can use a script like Yanfly's Event Chase Player to make it more
authentic. Just simply put @change_range = 5 or something in the Custom
movement along with how you want them to move when they haven't detected
the player.
Here is a screenie of how passive encounters look like:
Other Potential Encounter Types:
• Stalking encounter (they make a move towards you every time you move)(think lufia)
• Evasive encounter (they run away from player, may have rare encounter)
• Curious encounter (a mix of passive and aggressive. they follow you, but you have to press X to battle)
• Aerial encounter (encounters that fly above the players head, experimental)
If you want a tutorial on how to do any of those, just ask! I have them in my game and am willing to share!