The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary ROM Hacking (https://www.pokecommunity.com/forumdisplay.php?f=284)
-   -   Script Script where Professor Birch gives you the Pokedex (https://www.pokecommunity.com/showthread.php?t=417237)

Hillsy13 January 15th, 2019 7:00 PM

Script where Professor Birch gives you the Pokedex
 
Hacking Emerald, wanting to make Professor Birch give you the National dex at instead of the regular dex at the start of the game. Only problem is, I haven't been able to find the script where he gives it to you. I have checked the levels scripts for his lab, along with all scripts for person events in his lab. If knows anything that might help me find it I'd really appreciate it!

SkyVortex January 16th, 2019 10:54 AM

Hey man I think I've found where the scripts are. What I did was convert the beginning lines of dialogue to the game's alphabet in hex, and searched it up in HxD. Then I looked for any traces/pointers to the text to figure out what script calls the 'msgbox'. Next I used XSE to kind of trial-and-error it by decompiling the offsets repeatedly, counting backwards by 1 each time so I could locate the beginning of the main scripts. Eventually the scripts appeared with a normal structure, which is shown below. To be safe, I counted even further back when decompiling to make sure that they actually start at the offsets I found, so I'm almost completely sure these are their actual offsets. Only problem is that I don't know how they 'connect' to one another (as in after the first script is over the second starts with no break), only that each part of that dialogue begins with these offsets:

Script that runs immediately after exiting house post-game:
Spoiler:
//---------------
#org 0x1E7FB1
lockall
sound 0x15
applymovement 0x8 0x8272598
waitmovement 0x0
pause 0x50
msgbox 0x81E8DA2 MSG_KEEPOPEN //"PROF. BIRCH: Well, well, [player]\..."
closeonkeypress
clearflag 0x31A
clearflag 0x31B
pause 0x14
clearflag 0x4000
warp 0x1 0x4 0xFF 0x6 0x5
waitstate
releaseall
end


//---------
// Strings
//---------
#org 0x1E8DA2
= PROF. BIRCH: Well, well, [player]\v\h05!\nThat was good work out there!\pI knew there was something special\nabout you when I first saw you,\lbut I never expected this.\pOh, yes. Do you still have the POKéDEX\nI gave you?\pI have something to show you.\nLet's go to my LAB.


//-----------
// Movements
//-----------
#org 0x272598
#raw 0x56 //Exclamation Mark (!)
#raw 0xFE //End of Movements


Once the previous script warps you to the lab:
Spoiler:
//---------------
#org 0x1F9E80
lockall
pause 0x1E
msgbox 0x81FB16D MSG_KEEPOPEN //"PROF. BIRCH: Now[.]\p[player]\v\h0..."
closeonkeypress
applymovement 0x2 0x81F9F46
waitmovement 0x0
pause 0x14
sound 0x24
pause 0xA
sound 0x24
pause 0xA
sound 0x24
pause 0xA
sound 0x24
pause 0x14
applymovement 0x3 0x82725A8
applymovement MOVE_PLAYER 0x82725A4
waitmovement 0x0
checkgender
compare LASTRESULT 0x0
if 0x1 call 0x81F9F32
compare LASTRESULT 0x1
if 0x1 call 0x81F9F3C
sound 0x4
checksound
pause 0x14
applymovement 0x2 0x81F9F58
waitmovement 0x0
applymovement 0x3 0x82725A6
applymovement MOVE_PLAYER 0x82725A6
waitmovement 0x0
msgbox 0x81FB419 MSG_KEEPOPEN //"PROF. BIRCH: Okay, all done!"
fanfare 0x172
preparemsg 0x81FB436 //"[player]'s POKéDEX was upgraded\nt..."
waitmsg
waitfanfare
setflag 0x896
special 0x1F3
msgbox 0x81FB466 MSG_KEEPOPEN //"PROF. BIRCH: But listen.\nYou've b..."
closeonkeypress
setflag 0x31B
setflag 0x31A
setvar 0x40D3 0x2
setvar 0x40F5 0x0
setflag 0x72
releaseall
end

//---------------
#org 0x1F9F32
msgbox 0x81FB30F MSG_KEEPOPEN //"MAY: Eheheh!\pIt's so cool that ev..."
closeonkeypress
return

//---------------
#org 0x1F9F3C
msgbox 0x81FB38E MSG_KEEPOPEN //"BRENDAN: I went out all over HOENN..."
closeonkeypress
return


//---------
// Strings
//---------
#org 0x1FB16D
= PROF. BIRCH: Now[.]\p[player]\v\h05 and [rival], I've had the two\nof you help me study POKéMON.\pThanks to your help, new facts\nare coming to light.\pIt appears that in the HOENN region,\nthere are also POKéMON from other\lregions.\pIt goes to show how rich and varied\nthe natural environments of HOENN\lhappen to be.\pThat's why I think it's necessary for\nme to upgrade your POKéDEX to\lthe NATIONAL Mode.\pHere, let me see your POKéDEX units.

#org 0x1FB419
= PROF. BIRCH: Okay, all done!

#org 0x1FB436
= [player]'s POKéDEX was upgraded\nto the NATIONAL Mode!

#org 0x1FB466
= PROF. BIRCH: But listen.\nYou've become the CHAMPION,\lbut your POKéMON journey isn't over.\pThere is no end to the road\nthat is POKéMON.\pSomewhere, there is a grassy patch\nthat's waiting for you!

#org 0x1FB30F
= MAY: Eheheh!\pIt's so cool that even my POKéDEX\nis getting updated!\pIt's because you went out and caught\nso many POKéMON, [player]\v\h05!

#org 0x1FB38E
= BRENDAN: I went out all over HOENN\nand checked out POKéMON.\pYou can thank me for getting\nthe NATIONAL Mode POKéDEX.\pYep, you're lucky, [player]!


//-----------
// Movements
//-----------
#org 0x1F9F46
#raw 0xA //Step Left (Normal)
#raw 0x25 //Step on the Spot Down (Fastest)
#raw 0x14 //Delay5
#raw 0x14 //Delay5
#raw 0xB //Step Right (Normal)
#raw 0x25 //Step on the Spot Down (Fastest)
#raw 0x14 //Delay5
#raw 0x14 //Delay5
#raw 0xB //Step Right (Normal)
#raw 0x8 //Step Down (Normal)
#raw 0x8 //Step Down (Normal)
#raw 0x8 //Step Down (Normal)
#raw 0x8 //Step Down (Normal)
#raw 0xB //Step Right (Normal)
#raw 0xB //Step Right (Normal)
#raw 0xB //Step Right (Normal)
#raw 0x26 //Step on the Spot Up (Fastest)
#raw 0xFE //End of Movements

#org 0x2725A8
#raw 0x28 //Step on the Spot Right (Fastest)
#raw 0xFE //End of Movements

#org 0x2725A4
#raw 0x27 //Step on the Spot Left (Fastest)
#raw 0xFE //End of Movements

#org 0x1F9F58
#raw 0xA //Step Left (Normal)
#raw 0xA //Step Left (Normal)
#raw 0xA //Step Left (Normal)
#raw 0x9 //Step Up (Normal)
#raw 0x9 //Step Up (Normal)
#raw 0x9 //Step Up (Normal)
#raw 0x9 //Step Up (Normal)
#raw 0xA //Step Left (Normal)
#raw 0x25 //Step on the Spot Down (Fastest)
#raw 0xFE //End of Movements

#org 0x2725A6
#raw 0x26 //Step on the Spot Up (Fastest)
#raw 0xFE //End of Movements

Avara January 16th, 2019 12:10 PM

Use special 0x1F3 to activate the national Dex in Emerald, like this:

Quote:

Originally Posted by Avara
#org @main
lock
faceplayer
special 0x1F3
msgbox @msg1 0x6
release
end

#org @msg1
= Your Pokédex was updated!


Hillsy13 January 16th, 2019 7:45 PM

Quote:

Originally Posted by SkyVortex (Post 9968581)
Hey man I think I've found where the scripts are. What I did was convert the beginning lines of dialogue to the game's alphabet in hex, and searched it up in HxD. Then I looked for any traces/pointers to the text to figure out what script calls the 'msgbox'. Next I used XSE to kind of trial-and-error it by decompiling the offsets repeatedly, counting backwards by 1 each time so I could locate the beginning of the main scripts. Eventually the scripts appeared with a normal structure, which is shown below. To be safe, I counted even further back when decompiling to make sure that they actually start at the offsets I found, so I'm almost completely sure these are their actual offsets. Only problem is that I don't know how they 'connect' to one another (as in after the first script is over the second starts with no break), only that each part of that dialogue begins with these offsets:

Script that runs immediately after exiting house post-game:
Spoiler:
//---------------
#org 0x1E7FB1
lockall
sound 0x15
applymovement 0x8 0x8272598
waitmovement 0x0
pause 0x50
msgbox 0x81E8DA2 MSG_KEEPOPEN //"PROF. BIRCH: Well, well, [player]\..."
closeonkeypress
clearflag 0x31A
clearflag 0x31B
pause 0x14
clearflag 0x4000
warp 0x1 0x4 0xFF 0x6 0x5
waitstate
releaseall
end


//---------
// Strings
//---------
#org 0x1E8DA2
= PROF. BIRCH: Well, well, [player]\v\h05!\nThat was good work out there!\pI knew there was something special\nabout you when I first saw you,\lbut I never expected this.\pOh, yes. Do you still have the POKéDEX\nI gave you?\pI have something to show you.\nLet's go to my LAB.


//-----------
// Movements
//-----------
#org 0x272598
#raw 0x56 //Exclamation Mark (!)
#raw 0xFE //End of Movements


Once the previous script warps you to the lab:
Spoiler:
//---------------
#org 0x1F9E80
lockall
pause 0x1E
msgbox 0x81FB16D MSG_KEEPOPEN //"PROF. BIRCH: Now[.]\p[player]\v\h0..."
closeonkeypress
applymovement 0x2 0x81F9F46
waitmovement 0x0
pause 0x14
sound 0x24
pause 0xA
sound 0x24
pause 0xA
sound 0x24
pause 0xA
sound 0x24
pause 0x14
applymovement 0x3 0x82725A8
applymovement MOVE_PLAYER 0x82725A4
waitmovement 0x0
checkgender
compare LASTRESULT 0x0
if 0x1 call 0x81F9F32
compare LASTRESULT 0x1
if 0x1 call 0x81F9F3C
sound 0x4
checksound
pause 0x14
applymovement 0x2 0x81F9F58
waitmovement 0x0
applymovement 0x3 0x82725A6
applymovement MOVE_PLAYER 0x82725A6
waitmovement 0x0
msgbox 0x81FB419 MSG_KEEPOPEN //"PROF. BIRCH: Okay, all done!"
fanfare 0x172
preparemsg 0x81FB436 //"[player]'s POKéDEX was upgraded\nt..."
waitmsg
waitfanfare
setflag 0x896
special 0x1F3
msgbox 0x81FB466 MSG_KEEPOPEN //"PROF. BIRCH: But listen.\nYou've b..."
closeonkeypress
setflag 0x31B
setflag 0x31A
setvar 0x40D3 0x2
setvar 0x40F5 0x0
setflag 0x72
releaseall
end

//---------------
#org 0x1F9F32
msgbox 0x81FB30F MSG_KEEPOPEN //"MAY: Eheheh!\pIt's so cool that ev..."
closeonkeypress
return

//---------------
#org 0x1F9F3C
msgbox 0x81FB38E MSG_KEEPOPEN //"BRENDAN: I went out all over HOENN..."
closeonkeypress
return


//---------
// Strings
//---------
#org 0x1FB16D
= PROF. BIRCH: Now[.]\p[player]\v\h05 and [rival], I've had the two\nof you help me study POKéMON.\pThanks to your help, new facts\nare coming to light.\pIt appears that in the HOENN region,\nthere are also POKéMON from other\lregions.\pIt goes to show how rich and varied\nthe natural environments of HOENN\lhappen to be.\pThat's why I think it's necessary for\nme to upgrade your POKéDEX to\lthe NATIONAL Mode.\pHere, let me see your POKéDEX units.

#org 0x1FB419
= PROF. BIRCH: Okay, all done!

#org 0x1FB436
= [player]'s POKéDEX was upgraded\nto the NATIONAL Mode!

#org 0x1FB466
= PROF. BIRCH: But listen.\nYou've become the CHAMPION,\lbut your POKéMON journey isn't over.\pThere is no end to the road\nthat is POKéMON.\pSomewhere, there is a grassy patch\nthat's waiting for you!

#org 0x1FB30F
= MAY: Eheheh!\pIt's so cool that even my POKéDEX\nis getting updated!\pIt's because you went out and caught\nso many POKéMON, [player]\v\h05!

#org 0x1FB38E
= BRENDAN: I went out all over HOENN\nand checked out POKéMON.\pYou can thank me for getting\nthe NATIONAL Mode POKéDEX.\pYep, you're lucky, [player]!


//-----------
// Movements
//-----------
#org 0x1F9F46
#raw 0xA //Step Left (Normal)
#raw 0x25 //Step on the Spot Down (Fastest)
#raw 0x14 //Delay5
#raw 0x14 //Delay5
#raw 0xB //Step Right (Normal)
#raw 0x25 //Step on the Spot Down (Fastest)
#raw 0x14 //Delay5
#raw 0x14 //Delay5
#raw 0xB //Step Right (Normal)
#raw 0x8 //Step Down (Normal)
#raw 0x8 //Step Down (Normal)
#raw 0x8 //Step Down (Normal)
#raw 0x8 //Step Down (Normal)
#raw 0xB //Step Right (Normal)
#raw 0xB //Step Right (Normal)
#raw 0xB //Step Right (Normal)
#raw 0x26 //Step on the Spot Up (Fastest)
#raw 0xFE //End of Movements

#org 0x2725A8
#raw 0x28 //Step on the Spot Right (Fastest)
#raw 0xFE //End of Movements

#org 0x2725A4
#raw 0x27 //Step on the Spot Left (Fastest)
#raw 0xFE //End of Movements

#org 0x1F9F58
#raw 0xA //Step Left (Normal)
#raw 0xA //Step Left (Normal)
#raw 0xA //Step Left (Normal)
#raw 0x9 //Step Up (Normal)
#raw 0x9 //Step Up (Normal)
#raw 0x9 //Step Up (Normal)
#raw 0x9 //Step Up (Normal)
#raw 0xA //Step Left (Normal)
#raw 0x25 //Step on the Spot Down (Fastest)
#raw 0xFE //End of Movements

#org 0x2725A6
#raw 0x26 //Step on the Spot Up (Fastest)
#raw 0xFE //End of Movements

Thanks for this! Do you happen to know the offset for the script where the player initially receives the hoenn pokedex as well?

Hillsy13 January 16th, 2019 7:46 PM

Quote:

Originally Posted by Avara (Post 9968601)
Use special 0x1F3 to activate the national Dex in Emerald, like this:

Thanks!

sweetcow3 August 9th, 2019 11:09 AM

I see that I'm half a year late but I found this thread because I was googling this problem myself. I too couldn't find where he gave the dex. I don't know if OP still needs it but I found it at 0x1FA2FB.


All times are GMT -8. The time now is 9:14 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.