[Request] 8F setup for editing Levels in the Encounter Table in Pokemon Red
Posted by: Whimsical
Date: 2017-12-06 01:41:27
Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.
You can join Glitch City Research Institute to ask questions or discuss current developments.
You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.
Encounter table addresses are well-known, so using the generic one-value changing allows you to use the quantity of item 3 (Lemonade) as the level of one Pokémon.
In this case, if you want to modify all the addresses that controls the available Pokémon, you could use this code 10 times with a quantity of X Accuracy being 154, 152, 150, 148, 146, 144, 142, 140, 138 and 136 and the same quantity of Lemonade.
Creating a code that changes all Pokémon in one take would be rather hard to make, though. However, I was able to make one that changes all common battles level, thanks to ISSOtm's GBZ80toItems.
Any item xAny
8F
Lemonade x(level)
Carbos x216
X Accuracy x136
Water Stone x44
Poké Ball x34
HP Up x34
Awakening x142
Potion x105
Burn Heal x119
TM01 xAny
It is worth noting that this can be seen as a code 'changing one value each two addresses on a 8-address total to (level) starting at $(hex quantity of Carbos)(hex quantity of X Accuracy)'. Thus, having a quantity of X Accuracy of 144 instead will change the uncommon battles.
Your issue likely lies with "jp z,$DE2B", which executes unrelated data at $DE2B
ld c,XX -- Store XX in B. Where XX is the amount you want to increment the Levels in the encounter table by.
ld h,0xD8
ld l,0x88 -- Store 0xD888 in HL
ld e,0x06 -- Loop Counter
inc d -- Shift next operation to use item count
-- Loop Start
ld a,(hld) -- Load current encounter level into a, and decrease HL
inc h -- Shift next operation ot use item count
inc l -- Set HL back to proper value
dec h -- Shift next operation to use item count
ADD A,c -- Add XX to Level
ldi (hl),a -- Store new level in table, increment to 0xD889
inc e -- Increment loop counter
inc a -- Shift next operation to use item count
inc hl -- Increment HL to 0xD88A
bit 5,e -- Check if loop is over
JP Z,0xD32B -- If not over, jump to start of loop
ret -- Return
Any Item xAny
8F
Awakening xLEVEL
Carbos x216
X Accuracy x136
Repel x6
Potion x58
Protein x44
Iron x129
Water Stone x28
Fresh Water x35
TM03 x107
TM02 x43
TM11 x201