User talk:MrMissingNo72

From Glitch City Wiki

This is my talk page, only arbitrary code execution is allowed here.

Artificial trainer classes

NOTE: This is for English Pokémon Yellow only.

Naturally, only 56 trainers can be encountered via the trainer escape glitch (Special stats of 200-255, trainer IDs 0 to 55).

<br>

However, with arbitrary code execution, you can encounter artificial trainer classes with the routine at 3D:5FF2 with these very specific items:

1. ws m (0x63), any

2. 4F (0x59), any

3. Lemonade (0x3E), x61

4. Thunderstone (0x21), x242

5. 10F (0x5F), x1

6. X-Special (0x44), x2

7. Max Potion (0x11), x127

8. TM18 (0xDA), x205

9. Item 0x9D, x0

10. TM01 (0xC9), x33

11. Item 0xBB, x218

12. Lemonade (0x3E), x62

13. Water Stone (0x22), x4

14. Lemonade (0x3E), x(class)

15. Water Stone (0x22), x4

16. Lemonade (0x3E), x255

17. TM34 (0xEA), x88

18. TM08 (0xD0), x4

19. Poké Ball (0x04), x6

20. Soda Pop (0x3D), x33

21. Item 0x7F, x218

22. TM05 (0xCD), x132

23. Lemonade (0x3E), x201

<br>

Before you use ws m and 4F, make sure the bytes (C3, 21, D3) are located at DA7F and the bytes (C3 30 D3) are at DA64 (FA64).

<br>

Code:

For "ws m" (0x63):

- ld a, 3D

- ld hl, 5FF2

- ld bc, 0244

- ld de, DA7F

- call 009D

- ret

<br>

This code calls "FarCopyData" with its source being 3D:5FF2, the bytes to copy being 0x244, and the destination as DA7F.

<br>

For "4F" (0x59):

- ld hl, DABB

- ld a, 3E

- ldi (hl), a

- inc b

- ld a, (class)

- ldi (hl), a

- inc b

- ld a, FF

- ld (D058), a

- inc b

- inc b

- ld b, 3D

- ld hl, DA7F

- call 3E84

- ret

<br>

bytes needed at D31C:

17 63 BE 59 BE 3E 3D 21 F2 5F 01 44 02 11 7F DA CD 9D 00 C9 21 BB DA 3E 3D 22 04 3E xx 22 04 3E FF EA 88 04 06 3D 21 7F DA CD 84 3E C9 FF note: replace "xx" with the desired real trainer class ID in hexadecimal, for example, if you want to fight ゥ, A, replace "xx" with 37 (this value is hexadecimal).