4.0 Customization
UnifiedBot allows for the loading of custom behavior files. Behavior files hold data on the path the bot takes to heal, train, and return. These are easily modifiable and replaces scripting in PokeBot 3.0
Getting Started
First, locate those behavior files. They are typically under
These behavior files can be opened with any text editor, ie Notepad, Notepad++, etc. Open one up and you'll find that they're structured something like this:
[settings]
use_fly=0
use_rod=0
loop_num=4
dir1=hot_right
dir2=hot_down
dir3=hot_left
dir4=hot_up
dir1_tiles=2
dir2_tiles=2
dir3_tiles=2
dir4_tiles=2
[healing]
heal_num=5
h1=hot_up
h1_tiles=4
h2=hot_right
h2_tiles=3
h3=hot_left
h3_tiles=4
h4=hot_up
h4_tiles=25
h5=hot_left
h5_tiles=7
h6=hot_up
h6_tiles=5
[returning]
return_num=3
r1=hot_down
r1_tiles=25
r1_tiles1=0
r2=hot_right
r2_tiles=4
r2_tiles1=0
r3=hot_up
r3_tiles=2
r3_tiles1=15
r4=hot_down
r4_tiles=1
r4_tiles1=15
r5=hot_left
r5_tiles=1
r5_tiles1=15
r6=hot_down
r6_tiles=1
r6_tiles1=15
use_fly=0
use_rod=0
loop_num=4
dir1=hot_right
dir2=hot_down
dir3=hot_left
dir4=hot_up
dir1_tiles=2
dir2_tiles=2
dir3_tiles=2
dir4_tiles=2
[healing]
heal_num=5
h1=hot_up
h1_tiles=4
h2=hot_right
h2_tiles=3
h3=hot_left
h3_tiles=4
h4=hot_up
h4_tiles=25
h5=hot_left
h5_tiles=7
h6=hot_up
h6_tiles=5
[returning]
return_num=3
r1=hot_down
r1_tiles=25
r1_tiles1=0
r2=hot_right
r2_tiles=4
r2_tiles1=0
r3=hot_up
r3_tiles=2
r3_tiles1=15
r4=hot_down
r4_tiles=1
r4_tiles1=15
r5=hot_left
r5_tiles=1
r5_tiles1=15
r6=hot_down
r6_tiles=1
r6_tiles1=15
This might look overwhelming right now. But no worries, we'll go over all the components. Once you get the hang of it, editing behavior files will literally take seconds. As you may have noticed, the behavior file is really a simple INI. INI files hold data in sections, which are bolded in the example above. The behavior file is divided into 3 sections: settings, healing, and returning.
Settings Section
The settings section determines some basic characteristics of the script as well as the walking pattern of the bot when it searches for battles. Let's go over the variables in play here.
The next few variables are a bit more complicated. These variables determine the pattern the player will walk when searching for battles. Ignore this section if your behavior only involves fishing.
dirx and dirx_tiles are read in order. ie dir1_down is read before dir2_down. So dir1=hot_up and dir1_tiles=3 makes the player walk up 3 tiles. Following this up with dir2=hot_down and dir2_tiles=3 makes the player reverse and run down 3 tiles. Easy enough right? Let's take a look at an example.
- use_fly: determines whether or not the player should fly to heal. 1 for yes, 0 for no. If the variable is set to 0, the player will walk to the PokeCenter.
- use_rod: determines if the player will find battles on land or by fishing. 1 by fishing, 0 by land.
The next few variables are a bit more complicated. These variables determine the pattern the player will walk when searching for battles. Ignore this section if your behavior only involves fishing.
- loop_num: determines the number of different directions the player should walk. Should usually be 2 or 4. If it is set to two, only dir1/dir2 will be taken into account. Set to 3, dir1, dir2, and dir3 will all be taken into account. So on and so forth.
- dir1, dir2, etc: this determines the direction of the player, denoted by hot_up, hot_down, hot_left, and hot_right. More on this later.
- dir1_tiles, dir2_tiles, etc: this determines the number of tiles to walk in a certain direction.
- hot_up, hot_down, hot_left, and hot_right: used in conjunction with dirx_down. hot_up means to go up, hot_down means to go down... you get the idea.
dirx and dirx_tiles are read in order. ie dir1_down is read before dir2_down. So dir1=hot_up and dir1_tiles=3 makes the player walk up 3 tiles. Following this up with dir2=hot_down and dir2_tiles=3 makes the player reverse and run down 3 tiles. Easy enough right? Let's take a look at an example.
Healing Section
The healing section is a tad more complicated. As the name suggests, the healing section is responsible for finding a path to the nearest Pokecenter. This can either involve flying or walking, as determined by the aforementioned variable use_fly. Let's go over the variables involved here.
Now, let's go over a simple example of how to write your own healing configuration.
- heal_num: serves a similar purpose to loop_num. This variable holds the total number of hx/ hx_tiles to take into account plus one. For example, if the path to the Pokecenter involves changing directions four times, heal_num should equal five. Not four. If it changes directions 6 times, then heal_num should equal seven. The lowest value it should be is 1!
- h1, h2, etc: serves the same purpose as dirx. Once again, direction is determined by hot_up, hot_down, etc.
- h1_tiles, h2_tiles, etc: same as dirx_tiles.
Now, let's go over a simple example of how to write your own healing configuration.
In this hypothetical scenario, we start near the Pewter City Pokecenter. The Pokecenter entrance can be reached with five steps downwards and six steps towards the right.
That means to walk to the PokeCenter, we need to go through 2 different stages. Take the five steps down, then the 6 steps to the right. We tell the bot this by setting heal_num=3. Remember it's the number of stages+1-- that's why heal_num should be 3, not 2.
Now our first direction is down. So we set h1=hot_down. This tells the bot we should head down. There are five tiles, requiring five steps. So we set h1_tiles=5. Five steps downwards.
That means to walk to the PokeCenter, we need to go through 2 different stages. Take the five steps down, then the 6 steps to the right. We tell the bot this by setting heal_num=3. Remember it's the number of stages+1-- that's why heal_num should be 3, not 2.
Now our first direction is down. So we set h1=hot_down. This tells the bot we should head down. There are five tiles, requiring five steps. So we set h1_tiles=5. Five steps downwards.
Now let's change directions and head towards the right. To do this, set h2=hot_right. Then since it's 6 tiles to the entrance of the Pokecenter, we set h2_tiles=6. The bot will take it from there.
Note: For safety purposes, it would be a good idea to set the h3_tiles to 0, just to make sure there are no missteps
There! Simple enough isn't it? Congratulations, you've just completed a healing configuration!
Oh wait, what about flying? Flying is done practically the same way. If use_fly is set to 1, the bot will automatically open your town map. From there, simply count the number of tiles in each direction necessary to reach the Pokecenter of your choice. The bot will then execute the flight and take it from there.
Note: For safety purposes, it would be a good idea to set the h3_tiles to 0, just to make sure there are no missteps
There! Simple enough isn't it? Congratulations, you've just completed a healing configuration!
Oh wait, what about flying? Flying is done practically the same way. If use_fly is set to 1, the bot will automatically open your town map. From there, simply count the number of tiles in each direction necessary to reach the Pokecenter of your choice. The bot will then execute the flight and take it from there.
Returning
Once again, the returning section is aptly named. After healing, the bot will walk the player back to the training location. Note that the returning section does not allow flying. If the Pokecenter is close enough, walking will suffice in most cases. So setting use_fly=1 will have no effect here. Once again, let's go over the basic variables again:
Writing a configuration for returning is the same as healing with the exception mentioned above. The new variable allows you to randomize where the player ends up. That way, the player won't return to the same spot after healing every single time.
Let's take a look at a quick example.
- return_num: identical to heal_num in function. Once again, it is the number of stages+1.
- r1, r2, etc: identical to hx variables
- r1_tiles, r2_tiles, etc: identical to hx_tiles
- r1_tiles1, r2_tiles1: this is the only new thing. This variable is responsible for randomization. Should always be 0 until the last stage.
Writing a configuration for returning is the same as healing with the exception mentioned above. The new variable allows you to randomize where the player ends up. That way, the player won't return to the same spot after healing every single time.
Let's take a look at a quick example.
So in this hypothetical scenario we've already walked our character back to the training area. Now, we don't want him landing in the same spot every single time he heals, otherwise it would look suspicious. Walking back to this location took 5 stages and we want to randomize where he ends up last.
So with the given, we can conclude that r5=hot_up as the character is facing up. We want to randomize it so that the player ends up landing in one of the three potential bushes ahead of him. To achieve this, simply set r5_tiles1=3. The 3 denotes that the player can walk up to three extra steps.
ALL OTHER rx_tiles1 SHOULD BE SET TO ZERO! This prevents any unfortunate accidents from occurring.
So with the given, we can conclude that r5=hot_up as the character is facing up. We want to randomize it so that the player ends up landing in one of the three potential bushes ahead of him. To achieve this, simply set r5_tiles1=3. The 3 denotes that the player can walk up to three extra steps.
ALL OTHER rx_tiles1 SHOULD BE SET TO ZERO! This prevents any unfortunate accidents from occurring.
Well that's it! You've done it! You now know how to edit and create your own behavior files! That wasn't too bad was it? If you've created a cool behavior file, be sure to share it on the forums!