1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
This tutorial is for how to add more variety for wild Pokémon. As an example, we'll add an eighth slot for wild Pokémon in tall grass, and a fourth for wild Pokémon in water.
## Contents
1. [Increase the relevant constants](#1-increase-the-relevant-constants)
2. [Add more probability slots](#2-add-more-probability-slots)
3. [Add more wild data](#3-add-more-wild-data)
## 1. Increase the relevant constants
Edit [constants/pokemon_data_constants.asm](../blob/master/constants/pokemon_data_constants.asm):
```diff
-NUM_GRASSMON EQU 7 ; data/wild/*_grass.asm table size
-NUM_WATERMON EQU 3 ; data/wild/*_water.asm table size
+NUM_GRASSMON EQU 8 ; data/wild/*_grass.asm table size
+NUM_WATERMON EQU 4 ; data/wild/*_water.asm table size
```
If you've seen the [data/wild/\*.asm](../tree/master/data/wild/) files before, it should be obvious that `NUM_GRASSMON` is the number of slots for Pokémon in tall grass at a particular time of day, and `NUM_WATERMON` is for Pokémon in water at any time.
## 2. Add more probability slots
Edit [data/wild/probabilities.asm](../blob/master/data/wild/probabilities.asm):
```diff
GrassMonProbTable:
mon_prob 30, 0 ; 30% chance
mon_prob 60, 1 ; 30% chance
mon_prob 80, 2 ; 20% chance
mon_prob 90, 3 ; 10% chance
- mon_prob 95, 4 ; 5% chance
- mon_prob 99, 5 ; 4% chance
- mon_prob 100, 6 ; 1% chance
+ mon_prob 94, 4 ; 4% chance
+ mon_prob 97, 5 ; 3% chance
+ mon_prob 99, 6 ; 2% chance
+ mon_prob 100, 7 ; 1% chance
WaterMonProbTable:
mon_prob 60, 0 ; 60% chance
- mon_prob 90, 1 ; 30% chance
- mon_prob 100, 2 ; 10% chance
+ mon_prob 80, 1 ; 20% chance
+ mon_prob 95, 2 ; 15% chance
+ mon_prob 100, 3 ; 5% chance
```
These are just the cumulative probabilities for each possible slot.
## 3. Add more wild data
This will be tedious. If you edit `NUM_GRASSMON`, you need to update the wild data for *every* map in [data/wild/johto_grass.asm](../blob/master/data/wild/johto_grass.asm) and [data/wild/kanto_grass.asm](../blob/master/data/wild/kanto_grass.asm); the same goes for `NUM_WATERMON` with [data/wild/johto_water.asm](../blob/master/data/wild/johto_water.asm) and [data/wild/kanto_water.asm](../blob/master/data/wild/kanto_water.asm). Make sure that all the quantities are correct.
For example, we increased `NUM_GRASSMON` from 7 to 8, so here's how Route 29's wild data could change in [data/wild/johto_grass.asm](../blob/master/data/wild/johto_grass.asm):
```diff
map_id ROUTE_29
db 10 percent, 10 percent, 10 percent ; encounter rates: morn/day/nite
; morn
db 2, PIDGEY
db 2, SENTRET
db 3, PIDGEY
db 3, SENTRET
db 2, RATTATA
db 3, HOPPIP
db 3, HOPPIP
+ db 3, MARILL
; day
db 2, PIDGEY
db 2, SENTRET
db 3, PIDGEY
db 3, SENTRET
db 2, RATTATA
db 3, HOPPIP
db 3, HOPPIP
+ db 3, MARILL
; nite
db 2, HOOTHOOT
db 2, RATTATA
db 3, HOOTHOOT
db 3, RATTATA
db 2, RATTATA
db 3, HOOTHOOT
db 3, HOOTHOOT
+ db 3, POLIWAG
```
And we increased `NUM_WATERMON` from 3 to 4, so here's how Cherrygrove City's wild data could change in [data/wild/johto_water.asm](../blob/master/data/wild/johto_water.asm):
```diff
map_id CHERRYGROVE_CITY
db 6 percent ; encounter rate
db 20, TENTACOOL
db 15, TENTACOOL
+ db 20, CORSOLA
db 20, TENTACRUEL
```
Don't miss any tables, or you could encounter glitch Pokémon, prevent encounters completely, or cause other weird bugs.
Anyway, that's it! As long as `NUM_GRASSMON` and `NUM_WATERMON` match the lengths of `GrassMonProbTable`, `WaterMonProbTable`, and the many individual maps' wild data tables, then you can have as many slots as you want.

(If your copy of pokecrystal is from before June 24, 2018, you'll also need to make [these changes](https://github.com/pret/pokecrystal/pull/530/files#diff-d62d77ad5b721f6248886dfbdd5174aa) to [engine/overworld/wildmons.asm](../blob/master/engine/overworld/wildmons.asm), replacing some hard-coded numbers with constant expressions.)
If you want to make more specific changes to the logic of how wild Pokémon are encountered, then study the code in [engine/overworld/wildmons.asm](../blob/master/engine/overworld/wildmons.asm) and look for where its algorithms would neeed editing.
|