(Sorry for the lack of links and pictures - The forum actually prevents me from pasting links until I've made fifteen posts)
So quite recently, I've been interested by the workings of Feebas's spawning mechanics in R/S/E. I may not have a lot of experience in Pokémon Hacking, but I have some in reversing, and I figured this'd be a way to get me started.
A lot of Googling has taught me the following:
- Speaking to the NPC in Dewford Town will update the tiles if the new "trendy" sentence passed is accepted (Which is itself something luck-based)
- Saving the game and rebooting keeps the "Feebas tiles".
- Using the same trendy sentence of two games does not yield the same tiles.
- On Feebas tiles, you can either get Feebas or Carvanha.
- There are only 6 Feebas tiles.
I noticed that some save data blocks are not yet documented on Bulbapedia, so I figured that the data would be stored in there. Since tiles persist during saves, the game either saves Feebas tiles raw, or uses some vodoo to achieve the same in a compact way.
Starting from here, everything relates to Pokemon Emerald (U).
I've started by taking a look at Route 119. Looking at the Wild Pokémon Encounters, i saw Magikarp, Tentacool, and ... a ton of Carvanhas.
img11.hostingpics.net/pics/783244Feebas1.png
My first intuiton was then "Oh, the game probably rolls a number and changes one of these encounters to a Feebas if the roll is successful."
I imagined that the map would do something Feebas-related on its scripts - so I went ahead and took a look inside:
In the spoiler below is the result of the map scripts - Nothing useful in there from what I can see, so skip ahead for the related-stuff.
(This is script type 03.)
Few things caught me offguard. First and foremost, even thought most of this is self-explanatory, I failed to understand what special2 LASTRESULT 0xB7 and disappear LASTTALKED did. I brained for a bit, and realized this was probably related to the trainers in tall tall grass from which you only see the top of the head. So I skipped ahead.
This is the second script block (type 05). looking at it, all it did was some black magic regarding the player's gender. I assumed it was just setting up the rival sprite for the bridge event (Advance Map displays the sprite as a variant of the crazy talking NPC in Mauville City), and setting up for the Weather Center.
At this point i just went to take a look at the Trendy Sentence NPC's script.
0x81E12AA is the success string, which is called by this chunk of code
Now this beats me. What does CMD_C3 0x2 do ? I get that if data at 0x8004 is equal to 0, the NPC will refuse the new Trendy String. I assume this is calling some magic that rolls to see if the input string will be accepted, and then seeds the "Feebas tiles".
So from there, where should I look ? I'm soon going to pop open the ROM in Ida Pro and see what i can find, but I only have a vague idea where to look (save file loaders, most probably)
I'd definitely love some help on this, for the sake of documenting, reversing, and fun! So thanks for all your inputs :D
So quite recently, I've been interested by the workings of Feebas's spawning mechanics in R/S/E. I may not have a lot of experience in Pokémon Hacking, but I have some in reversing, and I figured this'd be a way to get me started.
A lot of Googling has taught me the following:
- Speaking to the NPC in Dewford Town will update the tiles if the new "trendy" sentence passed is accepted (Which is itself something luck-based)
- Saving the game and rebooting keeps the "Feebas tiles".
- Using the same trendy sentence of two games does not yield the same tiles.
- On Feebas tiles, you can either get Feebas or Carvanha.
- There are only 6 Feebas tiles.
I noticed that some save data blocks are not yet documented on Bulbapedia, so I figured that the data would be stored in there. Since tiles persist during saves, the game either saves Feebas tiles raw, or uses some vodoo to achieve the same in a compact way.
Starting from here, everything relates to Pokemon Emerald (U).
I've started by taking a look at Route 119. Looking at the Wild Pokémon Encounters, i saw Magikarp, Tentacool, and ... a ton of Carvanhas.
img11.hostingpics.net/pics/783244Feebas1.png
My first intuiton was then "Oh, the game probably rolls a number and changes one of these encounters to a Feebas if the roll is successful."
I imagined that the map would do something Feebas-related on its scripts - so I went ahead and took a look inside:
In the spoiler below is the result of the map scripts - Nothing useful in there from what I can see, so skip ahead for the related-stuff.
Spoiler:
Code:
#org 0x81F442F
'-----------------------------------
checkflag 0x8C1
if true call 0x81F4439 ' Flag is set
end
#org 0x81F4439
'-----------------------------------
special2 LASTRESULT 0xB7
compare LASTRESULT 0x7
if != jump 0x827374E ' Not Equal To, return out
disappear LASTTALKED
return
#org 0x827374E
'-----------------------------------
return
(This is script type 03.)
Few things caught me offguard. First and foremost, even thought most of this is self-explanatory, I failed to understand what special2 LASTRESULT 0xB7 and disappear LASTTALKED did. I brained for a bit, and realized this was probably related to the trainers in tall tall grass from which you only see the top of the head. So I skipped ahead.
Code:
#org 0x81F444D
'-----------------------------------
call 0x8271ED7
call 0x8271EFB
compare 0x40B3 0x1
if == call 0x81F4466 ' Equal To
special 0x146
end
#org 0x8271ED7
'-----------------------------------
checkgender
compare LASTRESULT BOY
if == jump 0x8271EEF ' Equal To
compare LASTRESULT 0x1
if == jump 0x8271EF5 ' Equal To
end
#org 0x8271EEF
'-----------------------------------
setvar 0x4010 0x69
return
#org 0x8271EFB
'-----------------------------------
checkgender
compare LASTRESULT BOY
if == jump 0x8271F13 ' Equal To
compare LASTRESULT 0x1
if == jump 0x8271F19 ' Equal To
end
#org 0x8271F13
'-----------------------------------
setvar 0x4013 0x6A
return
#org 0x8271F19
'-----------------------------------
setvar 0x4013 0x65
return
#org 0x81F4466
'-----------------------------------
setflag 0x37D
clearflag 0x37C
setvar 0x40B3 0x2
return
#org 0x8271EF5
'-----------------------------------
setvar 0x4010 0x64
return
This is the second script block (type 05). looking at it, all it did was some black magic regarding the player's gender. I assumed it was just setting up the rival sprite for the bridge event (Advance Map displays the sprite as a variant of the crazy talking NPC in Mauville City), and setting up for the Weather Center.
At this point i just went to take a look at the Trendy Sentence NPC's script.
Code:
#org 0x81E9922
'-----------------------------------
lock
faceplayer
call 0x8271E8B
msgbox 0x81EA136 ' I like what's hip, h...
callstd MSG_YESNO ' Yes/No message
compare LASTRESULT YES
if == jump 0x81E9948 ' Equal To
compare LASTRESULT 0x0
if == jump 0x81E9952 ' Equal To
end
#org 0x8271E8B
'-----------------------------------
CMD_2D
setvar 0x8004 0x0
special 0x81
return
#org 0x81E9948
'-----------------------------------
msgbox 0x81EA491 ' Yeah, absolutely rig...
callstd MSG_NOCLOSE ' Non-closing message
release
' Release commands close any open messages
end
#org 0x81E9952
'-----------------------------------
msgbox 0x81EA242 ' Hunh?\nIt's not the ...
callstd MSG_NOCLOSE ' Non-closing message
setvar 0x8004 0x9
call 0x8271E7C
lock
faceplayer
compare LASTRESULT 0x1
if == jump 0x81E997D ' Equal To
compare LASTRESULT 0x0
if == jump 0x81E9994 ' Equal To
end
#org 0x8271E7C
'-----------------------------------
fadescreen FADEOUT_BLACK
special 0x62
fadescreen FADEIN_BLACK
return
#org 0x81E997D
'-----------------------------------
CMD_C3 0x2
compare 0x8004 0x0
if == jump 0x81E999E ' Equal To
msgbox 0x81EA2AA ' Hunh?\n"\v\h03["]?\p...
callstd MSG_NOCLOSE ' Non-closing message
release
' Release commands close any open messages
end
#org 0x81E999E
'-----------------------------------
msgbox 0x81EA3FE ' Hmm[.]\n"\v\h03,["] ...
callstd MSG_NOCLOSE ' Non-closing message
release
' Release commands close any open messages
end
#org 0x81E9994
'-----------------------------------
msgbox 0x81EA443 ' Well, if you hear of...
callstd MSG_NOCLOSE ' Non-closing message
release
' Release commands close any open messages
end
#org 0x81EA136
= I like what's hip, happening, and trendy.\nI'm always checking it out.\pListen, have you heard about this new\n"\v\h02["]?\pThat's right!\nOf course you know!\pI mean, sheesh,\n"\v\h02["][.]\lIt's the hottest thing in cool!\pWherever you're from,\n"\v\h02["]\lis the biggest happening thing, right?
#org 0x81EA491
= Yeah, absolutely right!\p"\v\h02["] is the\ndefinition of "in["] right now.
#org 0x81EA242
= Hunh?\nIt's not the hip and happening thing?\pWell, hey, you have to tell me,\nwhat's new and what's "in["]?
#org 0x81EA2AA
= Hunh?\n"\v\h03["]?\p[.] [.]\p[.]Uh[.] Yeah! That's right!\nYeah, I knew that! Knew it all along!\pOf course I know about that!\n"\v\h03,["] right?\pYeah, that's it, it's there!\nIsn't "\v\h03["]\lthe coolest, or what?\pIt's the hippest thing in hip.\nYou think I'd not know about it?\p"\v\h02["][.]\nIt's, like, so five minutes ago.\pNow, "\v\h03["] is\nwhat's vital and in tune with the times!
#org 0x81EA3FE
= Hmm[.]\n"\v\h03,["] huh?\pBut personally, I think\n"\v\h02["]\lis what's real in cool.
#org 0x81EA443
= Well, if you hear of any happening new\ntrends, come share them with me, okay?
0x81E12AA is the success string, which is called by this chunk of code
Code:
#org 0x81E997D
'-----------------------------------
CMD_C3 0x2
compare 0x8004 0x0
if == jump 0x81E999E ' Equal To
msgbox 0x81EA2AA ' Hunh?\n"\v\h03["]?\p...
Now this beats me. What does CMD_C3 0x2 do ? I get that if data at 0x8004 is equal to 0, the NPC will refuse the new Trendy String. I assume this is calling some magic that rolls to see if the input string will be accepted, and then seeds the "Feebas tiles".
So from there, where should I look ? I'm soon going to pop open the ROM in Ida Pro and see what i can find, but I only have a vague idea where to look (save file loaders, most probably)
I'd definitely love some help on this, for the sake of documenting, reversing, and fun! So thanks for all your inputs :D