The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script [FR] Trying to understand the starters

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old December 3rd, 2018 (6:42 PM).
BirdstarCat13 BirdstarCat13 is offline
 
Join Date: Nov 2017
Gender: Male
Posts: 476
So, in my hack, one of the ideas I had was to change out the starters to be just one Pokémon, instead of a choice of three (if it were a choice of three, I could just edit the IDs and text, since it's literally that simple) and I want the "pick your starter" script to reflect that change in the story.

Basically, here's the gist of what I want to happen:
-Prof. tells you to pick starter
-Interact with a ball
-If it's the middle one, you're given the game's starter
-If it's the right one, you're told it's empty
-if it's the left one, you're told 'you're not ready for that Pokémon yet' (it's actually empty)
-You get starter
-Rival complains you got the "Epic Pokémon" that was hiding in it
-Prof chastises the rival for being greedy because they already received a Pokémon 'yesterday'
-end of script (walk down and rival battles you like normal)

Of course, this is the default script:
Code:
'---------------
#org 0x169BAB
lock
faceplayer
setvar 0x4001 0x0
setvar 0x4002 0x1
setvar 0x4003 0x4
setvar 0x4004 0x7
compare 0x4055 0x3
if 0x4 goto 0x8169DE4
compare 0x4055 0x2
if 0x1 goto 0x8169BE1
msgbox 0x818EA19 MSG_KEEPOPEN '"Those are Poké Balls.\nThey contai..."
release
end

'---------------
#org 0x169DE4
msgbox 0x818EA45 MSG_KEEPOPEN '"That's Prof. Oak's last Pokémon."
release
end

'---------------
#org 0x169BE1
applymovement 0x4 0x81A75EF
waitmovement 0x0
showpokepic 0x4002 0xA 0x3
textcolor 0x0
compare 0x4001 0x0
if 0x1 goto 0x8169C14
compare 0x4001 0x1
if 0x1 goto 0x8169C33
compare 0x4001 0x2
if 0x1 goto 0x8169C52
end

'---------------
#org 0x169C14
msgbox 0x818E272 MSG_YESNO '"I see! Bulbasaur is your choice.\n..."
compare LASTRESULT 0x1
if 0x1 goto 0x8169C74
compare LASTRESULT 0x0
if 0x1 goto 0x8169C71
end

'---------------
#org 0x169C33
msgbox 0x818E207 MSG_YESNO '"Hm! Squirtle is your choice.\nIt's..."
compare LASTRESULT 0x1
if 0x1 goto 0x8169C74
compare LASTRESULT 0x0
if 0x1 goto 0x8169C71
end

'---------------
#org 0x169C52
msgbox 0x818E194 MSG_YESNO '"Ah! Charmander is your choice.\nYo..."
compare LASTRESULT 0x1
if 0x1 goto 0x8169C74
compare LASTRESULT 0x0
if 0x1 goto 0x8169C71
end

'---------------
#org 0x169C74
hidepokepic
hidesprite LASTTALKED
msgbox 0x818E2E5 MSG_KEEPOPEN '"This Pokémon is really quite\nener..."
call 0x81A6675
setflag 0x828
setflag 0x291
givepokemon 0x4002 0x5 0x0 0x0 0x0 0x0
copyvar 0x4031 0x4001
bufferpokemon 0x0 0x4002
preparemsg 0x818E30D '"[player] received the [buffer1]\nf..."
waitmsg
fanfare 0x13E
waitfanfare
msgbox 0x81A56A7 MSG_YESNO '"Do you want to give a nickname to\..."
compare LASTRESULT 0x1
if 0x1 goto 0x8169CCC
compare LASTRESULT 0x0
if 0x1 goto 0x8169CDC
end

'---------------
#org 0x169C71
hidepokepic
release
end

'---------------
#org 0x1A6675
copyvar 0x8012 0x8013
return

'---------------
#org 0x169CCC
setvar 0x8004 0x0
call 0x81A74EB
goto 0x8169CDC

'---------------
#org 0x169CDC
closeonkeypress
compare 0x4001 0x0
if 0x1 goto 0x8169CFF
compare 0x4001 0x1
if 0x1 goto 0x8169D1F
compare 0x4001 0x2
if 0x1 goto 0x8169D0F
end

'---------------
#org 0x1A74EB
fadescreen 0x1
special 0x9E
waitstate
return

'---------------
#org 0x169CFF
applymovement 0x8 0x8169D62
waitmovement 0x0
goto 0x8169D2F

'---------------
#org 0x169D1F
applymovement 0x8 0x8169D72
waitmovement 0x0
goto 0x8169D2F

'---------------
#org 0x169D0F
applymovement 0x8 0x8169D6B
waitmovement 0x0
goto 0x8169D2F

'---------------
#org 0x169D2F
textcolor 0x0
msgbox 0x818DD34 MSG_KEEPOPEN '"[rival]: I'll take this one, then!"
hidesprite 0x4004
textcolor 0x3
bufferpokemon 0x0 0x4003
preparemsg 0x818DD52 '"[rival] received the [buffer1]\nfr..."
waitmsg
fanfare 0x13E
waitfanfare
setvar 0x4055 0x3
checkflag 0x83E
if 0x1 call 0x8169D5C
release
end

'---------------
#org 0x169D5C
setvar 0x4070 0x1
return


'---------
' Strings
'---------
#org 0x18EA19
= Those are Poké Balls.\nThey contain Pokémon!

#org 0x18EA45
= That's Prof. Oak's last Pokémon.

#org 0x18E272
= I see! Bulbasaur is your choice.\nIt's very easy to raise.\pSo, [player], you want to go with\nthe Grass Pokémon Bulbasaur?

#org 0x18E207
= Hm! Squirtle is your choice.\nIt's one worth raising.\pSo, [player], you've decided on the\nWater Pokémon Squirtle?

#org 0x18E194
= Ah! Charmander is your choice.\nYou should raise it patiently.\pSo, [player], you're claiming the\nFire Pokémon Charmander?

#org 0x18E2E5
= This Pokémon is really quite\nenergetic!

#org 0x18E30D
= [player] received the [buffer1]\nfrom Prof. Oak!

#org 0x1A56A7
= Do you want to give a nickname to\nthis [buffer1]?

#org 0x18DD34
= [rival]: I'll take this one, then!

#org 0x18DD52
= [rival] received the [buffer1]\nfrom Prof. Oak!


'-----------
' Movements
'-----------
#org 0x1A75EF
#raw 0x3 'Face Right
#raw 0xFE 'End of Movements

#org 0x169D62
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x11 'Step Up (Normal)
#raw 0xFE 'End of Movements

#org 0x169D72
#raw 0x10 'Step Down (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x2E 'Face Up (Delayed)
#raw 0xFE 'End of Movements

#org 0x169D6B
#raw 0x10 'Step Down (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x2E 'Face Up (Delayed)
#raw 0xFE 'End of Movements
The only real issue here is that I'm havign trouble figuring out how the script seems to account for all three, even though it's stored on just one of the tiles. What I'm wanting ot know is
-how that works, and
-HOW to go about scripting my idea
I really want to write the script myself but I'm just not sure how to get started (pun not intended) here, because of how the default one works.
__________________
-------------------------
I hate signatures that are just a line of text without any clear division. You weirdos know who you are ;)
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old December 3rd, 2018 (7:25 PM).
Harlee Quinn's Avatar
Harlee Quinn Harlee Quinn is offline
 
Join Date: Aug 2017
Posts: 18
try looking at the map header scripts
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old December 3rd, 2018 (7:35 PM).
BirdstarCat13 BirdstarCat13 is offline
 
Join Date: Nov 2017
Gender: Male
Posts: 476
Quote:
Originally Posted by Harlee Quinn View Post
try looking at the map header scripts
Well...I checked that, and while I see code that appears to reference Squirtle and Bulbasaur ("0x7" and "0x1"), I don't see anything in the script that has relevancy to what's in the person script, or relevancy to the type of script that'd be needed for what I'm trying to do. Maybe I'm missing something?

Here's the script I found on the header of the map I pulled the Starter script from:
Spoiler:

Code:
'---------------
#org 0x168F8E
setflag 0x2CF
compare 0x4055 0x1
if 0x1 call 0x8168FC6
compare 0x4055 0x7
if 0x1 call 0x8168FD5
compare 0x4055 0x8
if 0x1 call 0x8168FC0
checkflag 0x247
if 0x1 call 0x8168FBC
end

'---------------
#org 0x168FC6
movesprite2 0x4 0x6 0xB
spritebehave 0x4 0x7jj
playsong2 0x12E
return

'---------------
#org 0x168FD5
movesprite2 0x4 0x6 0xB
spritebehave 0x4 0x7
return

'---------------
#org 0x168FC0
setvar 0x4055 0x9
return

'---------------
#org 0x168FBC
setflag 0x24F
return
__________________
-------------------------
I hate signatures that are just a line of text without any clear division. You weirdos know who you are ;)
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old December 4th, 2018 (5:47 AM).
DrFuji's Avatar
DrFuji DrFuji is offline
Heiki Hecchara‌‌
 
Join Date: Sep 2009
Location: Aussie
Age: 30
Gender: Male
Nature: Jolly
Posts: 1,693
Each Pokeball in the base game has its own initial script which then hooks into a larger 'core' script. In the example you posted, this is the initial script, which I've labelled:

Spoiler:
#org 0x169BAB
lock
faceplayer
setvar 0x4001 0x0 // This is used by the rest of the game to determine which Pokemon was chosen. 0 = Bulbasaur, 1 = Charmander, 2 = Squirtle. It's main job is to determine the composition of your rival team in battle.
setvar 0x4002 0x1 // The number of the Pokemon in the ball you're interacting with. Used for bufferpokemon and givepokemon etc.
setvar 0x4003 0x4 // The number of the Pokemon in the ball that your rival will take if you choose the current ball. Used in one instance of bufferpokemon.
setvar 0x4004 0x7 // The OW number of the ball that your rival will take if you choose this Pokemon. Used in a hidesprite command
compare 0x4055 0x3 // The script that plays if you've already chosen your starter. You will only encounter this if you interact with Oak's last Pokeball
if 0x4 goto 0x8169DE4
compare 0x4055 0x2 // If 0x4055 is equal to 0x2, the script will continue to the 'core' script shared by all balls
if 0x1 goto 0x8169BE1
msgbox 0x818EA19 MSG_KEEPOPEN '"Those are Poké Balls.\nThey contai..."
release
end


If you follow the script with this knowledge in mind you should be able to follow along pretty easily. Just for more information, here's when 0x4055's value changes and what it means according to DavidJCobb:

Spoiler:
Is set to 0x0 when the player hasn't encounted PROF. OAK yet.
Is set to 0x1 when OAK is escorting the player to his lab.
Is set to 0x2 when the player needs to choose a starter.
Is set to 0x3 when the player and their Rival have both chosen starters.
Is set to 0x4 after the player's first battle with their Rival.
Is set to 0x5 when the player needs to deliver OAK's PARCEL.
Is set to 0x9 when the player enters PROF. OAK while it is set to 0x8.
If >= 0x1 and no other events pending, then DAISY comments on a recent Rival battle.
Set to 0x7 after OAK's chat with the player in PALLET TOWN after beating the E4.


If you open the scripts of all three balls you will notice that this initial section is the only thing that differs between them. It sets the a number of variables which are then used to determine what's happening. While the script splits up in order to do a few actions such as applymovement commands, it always returns to the core script shared by all three possibilities. This was done to save space and (possibly) ensure a sense of conformity between the balls as any change to one made during testing would affect the other two in the same way.

As for the way you would go about making your starter script, it would function extremely differently to what is in the base game. I'd highly suggest ignoring the original scripts and creating custom scripts for each Pokeball. From your description, only one would need to have a large amount of work put into it and it doesn't have to be shared between all three balls. Here's what you need to do:
  • Have the ball that contains the only starter be a large script that includes setting 0x4055 to 0x3. This will be your main script that will includes things such as applymovements and your rival complaining/ Oak chastising them. Anything else (e.g setting variable 0x4001) is superfluous this Pokeball is the only option that the player can take.
  • One ball has an 'empty' message
  • The remaining ball has a 'not ready' message

You could make the Pokeballs display different messages depending how far the player is into the story, as is done in the base game. For example, if you interact with the Pokeballs before you meet with Oak, you will recieve the message "Those are POKé BALLS.\nThey contain POKéMON!", but after you and your rival have chosen your Pokemon, you get "That's PROF. OAK's last POKéMON." when you interact with the remaining Pokeball. Its not major, but its something you could think about including.

Quote:
Originally Posted by BirdstarCat13 View Post
Well...I checked that, and while I see code that appears to reference Squirtle and Bulbasaur ("0x7" and "0x1"), I don't see anything in the script that has relevancy to what's in the person script, or relevancy to the type of script that'd be needed for what I'm trying to do. Maybe I'm missing something?

Here's the script I found on the header of the map I pulled the Starter script from:
Spoiler:

Code:
'---------------
#org 0x168F8E
setflag 0x2CF
compare 0x4055 0x1
if 0x1 call 0x8168FC6
compare 0x4055 0x7
if 0x1 call 0x8168FD5
compare 0x4055 0x8
if 0x1 call 0x8168FC0
checkflag 0x247
if 0x1 call 0x8168FBC
end

'---------------
#org 0x168FC6
movesprite2 0x4 0x6 0xB
spritebehave 0x4 0x7jj
playsong2 0x12E
return

'---------------
#org 0x168FD5
movesprite2 0x4 0x6 0xB
spritebehave 0x4 0x7
return

'---------------
#org 0x168FC0
setvar 0x4055 0x9
return

'---------------
#org 0x168FBC
setflag 0x24F
return
That level script just places the OWs depending on how far into the game you are and doesn't have anything to do with the starter script - See the 0x4055 values listed above. There are two other levels scripts that activate when 0x4055 = 0x1 (When Oak leads you into the lab) so you may want to have a look at those as well and change anything you need to (like dialogue).
__________________
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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