Customized Battle Encounter Frequency
#1
Hello there,

INTRODUCTION

i'm gona show you how to create a battle frequency system much more customized than the default one in RMXP, only with events.
This is how i am proceding for my project Dargaa Chronicles.

FEATURES

For frequency battle system games

*Very usefull for world maps
*Allows you to change the Battle Back depending on the hero position
*Allows you to add many different troops, depending on where you are
*Allows you to make different probabilities of troops showing up on a same map/ spot
*You can totaly masterize general parameters of frequency


HOW TO PROCEED

ok so for this example i ve made a small and very simple map with four areas :
grass area, muntain area, sand area and no battle area.

[Image: 659626map_encounter.png]

1)
So start by making a switch called Random Battle. You re gona turn this switch off when you want to hold the battle frequency.

Make a second switch, and call it WALK.


2)
Make an event called Step Detector, with condition switch Random Battle is ON.
Put it on Parallel Process.
In the Event Commands, set the first variable, call it Steps Before, and make it equal to the number of steps.

[Image: 930271V_Step_b4.png]




Insert a wait of 10 frames, so that the game is gona check two times per second if the player is moving or not. Of course you can change this 10 frames as per your requirements.

After this wait, set another variable check, and call this new variable Steps After.

Finally put a Conditional Branch, if variable Steps Before is not equal to the variable Steps After, then switch WALK is ON. Do not set handling when condition do not apply.
Make a new page in this Step Detector event, condition switch WALK is ON, action button and no command to disable it when WALK is ON.

[Image: 712805WALK.png]


So the WALK switch is gona be activated only if the player moves. Now let's use it
to pop up battles.


3)
Make another Event and call it Battle Area. Make sure it is on Parallel Process, and its condition is the switch WALK ON.
Start by making another variable, call it Frequency and set it as a random number, between zero and ten.


[Image: 296646frequency.png]


With this configuration, the player will have one chance on eleven to have a battle each step. You can change the 0~10 range so that your frequency changes.
0~5 would be a higher frequency, while 0~30 would be a low frequency.


now set a conditional branch, if V Frequency is less than 1


[Image: 126614frequency2.png]




Now let's consider the map area's X & Y and start with the Desert Area.
So the X corresponding to this are are between 3 and 9,
and the Y are between 3 and 7.


[Image: 535733axes.png]



Then add two more variables to check
*V player's X
*V player's Y

put another conditional branch in the Frequency condional Branch after the Player X and Player Y variable check :
Condition = the variable Player X is greater than 2
do not let handling when condition do not apply.

so it is covering this area :

[Image: 91438x2.png]

Make another Conditional Branch :
the variable player X is less than 10
do not let handling when condition do not apply.

now you're covering this :

[Image: 596510x10.png]

Put another Conditional Branch :
The variable Player Y is greater than 2
do not let handling when condition do not apply.

now your area is looking like that :

[Image: 830570y2.png]


And add another Conditional Branch where
Variable Player Y is less than 8
do not let handling when condition do not apply.

so that you got your final area selected :


[Image: 510755y8.png]



Now the commands in your event should look like this :



[Image: 629909Player_axis.png]



At this point we know that the player is walking, that the random frequency will pop up a battle and that the player is in the Desert Area.



Now you can add another command, change Map Settings, Battleback Graphic, Desert graphic.


Finally, before the battle starts, we have to set up wich troops the heroes are gona fight.
Set another variable with a random result between 1 ~100, and call it Enemies.
Here again, you can chage the 1 ~100 range, i just find it usefull because it helps
using percentage of troops appearance.

Now we'll be able to start the battle.
add a Conditional Branch, where the variable Enemies is less than 6
and here, let it handle when condition doesn't match.


When V Enemies is less than 6, i put a Battle Processing, the number 11,
Cockatrice x2, and set it possible to run away.

This means that the player will have 5% of chances to fight Cockatrice x2,
In case of Win or Run, put the switch WALK OFF.

and the window now looks like that :


[Image: 417842Cockatrice.png]



In the Else condition, set another Conditional Branch where V Enemies is less than 40.
Let it handle when condition doesn't match.
Put another Battle Processing. I choose the number 2, Ghost x3, player can run.
So the heroes have 35% of chance to meet 3 Ghost (40 less the 5% of the Cockatrice).
Like before, when battle is won or player escape, turn switch WALK OFF.


Finally in the Else branch, put another Conditional Branch where V Enemies is less than 101, add Battle Processing again. Here you can disable the Handle when conditions do not match.
I choose the number 1 troops, Ghost x 2, so the player has 60% of chances to fight ghost x2 (100 less 35 ghost x3 less 5 cockatrice).


Here again, set it so that player can run away, and after victory or flee, switch WALK is OFF, so that the frequency and step detector reset.

After the last Conditional Branch and outside the branch, put as last instruction switch WALK = OFF, so that no battle pop up when the frequency is greater than zero.


Your Event Commands now look like that :

[Image: 64073event.png]



And we're done with the Desert area !

You just have to do it for the Grassland Area and the Mountain Zone.
Add as many other events like that as you want areas of battle.
Use the appropriate X and Y coordinates conditions, change the Battleback Graphics accordingly, the monsters and so.

Whatever you do, do not forget to set the events on Parrallel Process. Usually, when it is not work, it s because the event has been left with the default value, Action Button ^.^

And of course when you try it, make sure the Random Battle switch has been turned ON before (with debugg mode or another even on autorun, nvm) as all the battle event start only when this switch is ON.

Then you're done, and your map can have many different battles on various areas ^___^V
Reply }
#2
Nice Tutorial. There is also a Script which does exactly the same thing, it's easier and less work^^
It's called Regions System by Gubid ^^
Reply }




Users browsing this thread: 1 Guest(s)