Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2012-11-03 18:40:58

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 11/431
Website

Raikou and Entei encounters in Crystal.

Let's say I want to swap Suicune's role with Raikou's in Pokemon Crystal, making Raikou the event Pokemon. In the past, I could find the two offsets refering to the level 40 suicune you battle against in ecruteak city (searching 28 f5 with a hex editor and eventually finding them), but I couldn't find the offsets for lv 40 raikou/entei.

Anyone knows where are they located in the hex map? Otherwise, any other idea?

Thanks in advance!

Offline

#2 2012-11-04 23:19:37

comet
Member
Registered: 2012-04-09
Post 25/679

Re: Raikou and Entei encounters in Crystal.

The relevant code is at 0a:62a0 ($2a2a0). It can be run in a script using special $69:

; load monster data into RoamMon structs
; species
ld a, $f3 ; RAIKOU
ld [$dfcf], a ; RoamMon1Species
ld a, $f4 ; ENTEI
ld [$dfd6], a ; RoamMon2Species

; level
ld a, $28 ; lv40
ld [$dfd0], a ; RoamMon1Level
ld [$dfd7], a ; RoamMon2Level

; raikou starting map
ld a, $02 ; GROUP_ROUTE_42
ld [$dfd1], a ; RoamMon1MapGroup
ld a, $05 ; MAP_ROUTE_42
ld [$dfd2], a ; RoamMon1MapNumber

; entei starting map
ld a, $0a ; GROUP_ROUTE_37
ld [$dfd8], a ; RoamMon2MapGroup
ld a, $04 ; MAP_ROUTE_37
ld [$dfd9], a ; RoamMon2MapNumber

; hp
xor a ; if hp is $00, generate new stats
ld [$dfd3], a ; RoamMon1CurHP
ld [$dfda], a ; RoamMon2CurHP

; we're done
ret

Each struct is 7 bytes long:

$dfcf $dfd6 $dfdd [1] : RoamMonSpecies
$dfd0 $dfd7 $dfde [1] : RoamMonLevel
$dfd1 $dfd8 $dfdf [1] : RoamMonMapGroup
$dfd2 $dfd9 $dfe0 [1] : RoamMonMapNumber
$dfd3 $dfda $dfe1 [1] : RoamMonCurHP
$dfd4 $dfdb $dfe2 [2] : RoamMonDVs

Only 2 structs are used in Crystal but the third leftover from Gold is still there ($dfdd).

Since this is such a point of contention around here I should mention that the equivalent function in Gold (also loads Suicune roamdata) is at 0a:67d7 ($2a7d7). Gold's RoamMon structs are at $dd1a, $dd21 and $dd28.

There is no flag that controls their appearance. If the map group / number are $ff, they are left that way until they're changed manually to be valid (see above). When a roamer is fainted the map values are set to $ff again to 'remove' them. The other values in the struct remain unchanged. Similarly, the Pokedex shows the location of the monster id in RoamMonSpecies. No other changes are required, but the ram locations are all hardcoded independently for each read.

CurHP is 1 byte since at level 40 the only monsters with >255 HP are (barely) Chansey and Blissey. CurHP is read during battle init. A value of $00 generates new dvs and hp.

Last edited by comet (2012-11-04 23:22:31)

Offline

#3 2012-11-05 13:43:06

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 12/431
Website

Re: Raikou and Entei encounters in Crystal.

Nice, thanks for the info! Does this mean I can change the offsets at 0x2a2a1 and 0x2a2a6 and it will work? I guess they refer to Entei and Raikou as they are 0xf3 and 0xf4 respectively

Offline

#4 2012-11-05 21:48:10

comet
Member
Registered: 2012-04-09
Post 27/679

Re: Raikou and Entei encounters in Crystal.

Yes. You can change them to any monster you want and it will work seamlessly, Pokedex location included. You can do the same with the empty RoamMon slot.

Say you wanted to restore Gold's trio without repointing. Here is a condensed version that is 1 byte shorter than Crystal's routine:

SpecialRoamMons:
; load monster data into RoamMon structs

push hl
push bc

ld hl, $dfcf ; RoamMons

ld a, $f3 ; RAIKOU
ld bc, $0205 ; route 42
call .fillmon

ld a, $f4 ; ENTEI
ld bc, $0a04 ; route 37
call .fillmon

ld a, $f5 ; SUICUNE
ld bc, $010c ; route 38
call .fillmon

pop bc
pop hl
ret

.fillmon
; input:
;   a = species
;   b = map group
;   c = map #
ld [hli], a ; species
ld [hl], $28 ; level
inc hl
ld [hl], b ; map group
inc hl
ld [hl], c ; map #
inc hl
xor a
ldi [hl], a ; curhp
ldi [hl], a
ldi [hl], a ; next struct
ret

Last edited by comet (2012-11-05 22:07:02)

Offline

#5 2012-11-05 22:09:48

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 13/431
Website

Re: Raikou and Entei encounters in Crystal.

Many thanks! Tbh, now the thing that probably bothers me the most regarding this is the sound of the Pokemon when you find the 3 legendaries in burned tower. With Crystalmap I can easily change their sprites, but the sound of each mon will remain the same I guess...

Offline

#6 2012-11-05 22:26:53

551/701

Re: Raikou and Entei encounters in Crystal.

Crystal_ wrote:

Many thanks! Tbh, now the thing that probably bothers me the most regarding this is the sound of the Pokemon when you find the 3 legendaries in burned tower. With Crystalmap I can easily change their sprites, but the sound of each mon will remain the same I guess...

Just edit the Burned Tower trigger script.

Board footer

Powered by FluxBB