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 [Fire Red]: Change Multibox Selection at Laboratory (https://www.pokecommunity.com/showthread.php?t=446428)

num1x March 14th, 2021 10:08 AM

[Fire Red]: Change Multibox Selection at Laboratory
 
Hello everybody,

currently i'm working on an Pokemon FR Hack where I obtain both Fossils at Mt. Moon and also get the old Amber from the man in the museum. Now there's a problem. When I go to the lab on the Cinnamon Island, I can only select 1 ot of two fossils from the Multichoice Box. Although I've got 3 in my bag. I guess I have to create a new Multichoice Box with the option show all three Items in the Box. Can you help me with that ? I'm working with XSE Script, Advanced Map Editor and HexManiacAdvance.

One last note; I'm working on the german version of FR, but i guess that should't make a signifcant difference - i guess some offset values may differ.

Asith March 14th, 2021 10:36 PM

Yes you'd have create a new multichoice box, but you'd also have to rewrite a lot of that script since it only expects 2 choices. The script is at 0x16E4F5 in the English version, but you can just go to the scientist in advanced map to find the script yourself. Try to understand that script and use it as a base for a script that allows the player to choose one of three multichoice values.
A multichoice box is just a glorified yes/no box in that it doesn't matter what the options are - these are only labels for the player. The game just handles the choices as 0x0, 0x1, and 0x2. That means you can repurpose any 3 item multichoice box already in the game that you don't need and put it in your new script.
There's a tool to do that here (which I haven't personally tested), or you could simply hex edit the labels if you could find their offsets. After that, this piece of code should handle the three choices:
multichoice 0x0 0x0 [multichoice ID] 0x0
copyvar 0x8000 LASTRESULT
compare 0x8000 0x0
if 0x1 goto @choice1
compare 0x8000 0x1
if 0x1 goto @choice2
compare 0x8000 0x2
if 0x1 goto @choice3
compare 0x8000 0x7F
if 0x1 goto @cancel
end


You'll have to rebuild the fossil scientist's script around this new 3 choice code.

num1x March 14th, 2021 11:46 PM

First of all, thanks for ya help :)
unfortunatly the tool doesn't work for me (Win10) maybe also becuase of the different offsets.

Anyway, I understand what the XSE Script and how it works. What I dont understand is how to add a new MultiCoice Box ingame. What i did so far:
- Opened up Hex editor
- Changed the 3 found "DOMFOSSIL" to: D1MFOSSIL, D2MFOSSIL and D3MFOSSIL.
- When talk to the man in the Lab the multibox says "D3MFOSSIL". This is stored in "0x417CCCC" so this must be the Variable which is used in the Multbox. The "D3MFOSSIL2" got 2 Anchors: 0x3DF3D0 and 0x3DF408

But now I dont know what do to ...

Asith March 15th, 2021 2:34 AM

Quote:

Originally Posted by num1x (Post 10312792)
First of all, thanks for ya help :)
unfortunatly the tool doesn't work for me (Win10) maybe also becuase of the different offsets.

Anyway, I understand what the XSE Script and how it works. What I dont understand is how to add a new MultiCoice Box ingame. What i did so far:
- Opened up Hex editor
- Changed the 3 found "DOMFOSSIL" to: D1MFOSSIL, D2MFOSSIL and D3MFOSSIL.
- When talk to the man in the Lab the multibox says "D3MFOSSIL". This is stored in "0x417CCCC" so this must be the Variable which is used in the Multbox. The "D3MFOSSIL2" got 2 Anchors: 0x3DF3D0 and 0x3DF408

But now I dont know what do to ...

Gonna attempt to clarify here:
The game has a set number of multichoice boxes predefined in its memory. Adding a brand new one to the table is tricky, so I recommend you repurpose a default one that you don't need. This is a list of all of the choiceboxes and their labels:
Spoiler:

[00] - Yes
No
[01] - Eevee
Flareon
Jolteon
Vaporeon
Quit looking.
[02] - Normal
Black
Pink
Sepia
[03] - Hall of Fame
Quit
[04] - Eggs
Quit
[05] - Victories
Quit
[06] - Hall of Fame
Eggs
Quit
[07] - Hall of Fame
Victories
Quit
[08] - Eggs
Victories
Quit
[09] - Hall of Fame
Eggs
Victories
Quit
[0A] - Exit
[0B] - Exit
[0C] - Exit
[0D] - Bicycle $1,000,000
No Thanks
[0E] - Abra 180 coins
Clefairy 500 coins
Dratini 2,800 coins
Scyther 5,500 coins
Porygon 9,999 coins
No Thanks
[0F] - SLP
PSN
PAR
BRN
FRZ
EXIT
[10] - Yes
No
Info
[11] - Single battle
Double battle
Multi battle
Info
Exit
[12] - Yes
No
Info
[13] - Make a Challenge
Info
Exit
[14] - Rooftop
B1F
Exit
[15] - Helix Fossil
Exit
[16] - Dome Fossil
Exit
[17] - Old Amber
Exit
[18] - Helix Fossil
Old Amber
Exit
[19] - Dome Fossil
Old Amber
Exit
[1A] - Fresh Water $200
Soda Pop $300
Lemonade $350
Exit
[1B] - 50 coins $1,000
500 coins $10,000
Exit
[1C] - Excellent
Not So Bad
[1D] - Right
Left
[1E] - TM13 4,000 coins
TM23 3,500 coins
TM24 4,000 coins
TM30 4,500 coins
TM35 4,000 coins
No Thanks
[1F] - 5F
4F
3F
2F
1F
Exit
[20] - Fresh Water
Exit
[21] - Soda Pop
Exit
[22] - Fresh Water
Soda Pop
Exit
[23] - Lemonade
Exit
[24] - Fresh Water
Lemonade
Exit
[25] - Soda Pop
Lemonade
Exit
[26] - Fresh Water
Soda Pop
Lemonade
Exit
[27] - Trade Center
Colosseum
Exit
[28] - Game Link Cable
Wireless
Exit
[29] - Smoke Ball 800 coins
Miracle Seed 1,000 coins
Charcoal 1,000 coins
Mystic water 1,000 coins
Yellow flute 1,600 coins
No Thanks
[2A] - B1F
B2F
B4F
Exit
[2B] - Linked game play
Direct Corner
Union Room
Quit
[2C] - Two Island
Three Island
Exit
[2D] - One Island
Three Island
Exit
[2E] - One Island
Two Island
Exit
[2F] - Trade Center
Colosseum
Berry Crush
Exit
[30] - Nada
Nada
Exit
[31] - Pokemon Jump
Dodrio Berry-Picking
Exit
[32] - Trade Center
Colosseum
Exit
[33] - 2 Tinymushrooms
1 Big Mushroom
[34] - Trade Center
Colosseum
Berry Crush
Exit
[35] - Trade Center
Colosseum
Exit
[36] - Sevii Islands
Navel Rock
Exit
[37] - Sevii Islands
Birth Island
Exit
[38] - Sevii Islands
Navel Rock
Birth Island
Exit
[39] - One Island
Two Island
Three Island
Exit
[3A] - Vermilion
Two Island
Three Island
Exit
[3B] - Vermilion
One Island
Three Island
Exit
[3C] - Vermilion
One Island
Two Island
Exit
[3D] - Vermilion
Exit
[3E] - Blank
Blank
Exit
[3F] - Join Group
Become Leader
Exit
[40] - Single
Double
Knockout
Mixed
Exit


The fossil lab scripts use 15, 16, 17, 18, and 19. Repurposing these won't do it for you, since they have a max of 2 options, and you need 3. Pick one with 3 (for example, [26] - Fresh Water, Soda Pop, Lemonade), search for those labels in a hex editor, and rename them to your fossils. (I would be replacing "Fresh Water" with "Dome Fossil", and etc, in my example). Remember that this will change this choice box throughout the game, so it's only viable if you don't actually need the original labels anywhere. Now that you've put the fossil labels in that choicebox, use multichoice 0x0 0x0 0x26 0x0 in any script to get it to appear in-game.

That's the easiest method. If you want to keep all the original choiceboxes as they are, then you'd need to create your own new one and insert it into a new table with additional space, which is a bit trickier and not something I've done, so I can't help you there. Try googling other tutorials for that, if you need

Blah March 15th, 2021 6:03 AM

Just repoint the MC structure and change the max number of choices.
1. Find the table of multiple choice menus
2. Find the MC you're trying to edit (it's the ID you call with the script)
3. Change the max options count to the number you need
4. Repoint the structure

Alternatively, there are plenty of menus with only 4 options you can edit for your purposes. The Lemonade one for example (id 27).

num1x March 16th, 2021 9:01 AM

Alright thanks for ya help. The original Script is pretty complex to understand (because the decision which mulitbox will pop up is based on multiple flags)

I nearly rewrote the complete code without flags and based on the Items in the bag. I used the multichoice Box [25] and [26] keep in mind to change the Names in HEX.

Additionally the Pokemon you will get from the Lab-Man will hold the fossil which it is made of. So if you want, you can create as much Fossil-Pokemon as you want. Its german, but this should't be a problem, just replace the textstrings. If you have any questionf, feel free to contact me.

Spoiler:
Quote:

#dynamic 0x820000
'---------------
#org @main
lock
faceplayer
setvar LASTRESULT 0x0
compare 0x406A 0x2
if 0x1 goto @1
compare 0x406A 0x1
if 0x1 goto @2
checkitem 0x162 0x1
compare LASTRESULT 0x1
if 0x4 goto @3
checkitem 0x165 0x1
compare LASTRESULT 0x1
if 0x4 goto @4
checkitem 0x166 0x1
compare LASTRESULT 0x1
if 0x4 goto @5
msgbox @15 MSG_KEEPOPEN '"Hallo!\pIch leite hier die Forschu..."
msgbox @46 MSG_KEEPOPEN '"Nein.\pLeider trägst du kein\nFoss..."
release
end

'---------------
#org @1
compare 0x4069 0x1
if 0x1 goto @6
compare 0x4069 0x2
if 0x1 goto @7
compare 0x4069 0x3
if 0x1 goto @8
end

'---------------
#org @2
msgbox @9 MSG_KEEPOPEN '"Es wird einige Zeit dauern!\nKomm ..."
release
end

'---------------
#org @3
checkitem 0x165 0x1
compare LASTRESULT 0x1
if 0x4 goto @10
checkitem 0x166 0x1
compare LASTRESULT 0x1
if 0x4 goto @11
goto @12

'---------------
#org @4
checkitem 0x166 0x1
compare LASTRESULT 0x1
if 0x4 goto @13
goto @14

'---------------
#org @5
preparemsg @15 '"Hallo!\pIch leite hier die Forschu..."
waitmsg
multichoice 0x0 0x0 0x16 0x0
copyvar 0x8000 LASTRESULT
compare 0x8000 0x0
if 0x1 goto @16
compare 0x8000 0x1
if 0x1 goto @17
compare 0x8000 0x7F
if 0x1 goto @17
end

'---------------
#org @6
setvar 0x4001 0x8A
bufferpokemon 0x0 0x8A
msgbox @18 MSG_KEEPOPEN '"Wo warst du? Wir haben\ndein Fossi..."
givepokemon 0x8A 0x5 0x165 0x0 0x0 0x0
compare LASTRESULT 0x2
if 0x1 goto @19
compare LASTRESULT 0x0
if 0x1 goto @20
compare LASTRESULT 0x1
if 0x1 goto @21
end

'---------------
#org @7
setvar 0x4001 0x8C
bufferpokemon 0x0 0x8C
msgbox @18 MSG_KEEPOPEN '"Wo warst du? Wir haben\ndein Fossi..."
givepokemon 0x8C 0x5 0x166 0x0 0x0 0x0
compare LASTRESULT 0x2
if 0x1 goto @19
compare LASTRESULT 0x0
if 0x1 goto @20
compare LASTRESULT 0x1
if 0x1 goto @21
end

'---------------
#org @8
setvar 0x4001 0x8E
bufferpokemon 0x0 0x8E
msgbox @18 MSG_KEEPOPEN '"Wo warst du? Wir haben\ndein Fossi..."
givepokemon 0x8E 0x5 0x162 0x0 0x0 0x0
compare LASTRESULT 0x2
if 0x1 goto @19
compare LASTRESULT 0x0
if 0x1 goto @20
compare LASTRESULT 0x1
if 0x1 goto @21
end

'---------------
#org @10
checkitem 0x166 0x1
compare LASTRESULT 0x1
if 0x4 goto @22
goto @23

'---------------
#org @11
preparemsg @15 '"Hallo!\pIch leite hier die Forschu..."
waitmsg
multichoice 0x0 0x0 0x19 0x0
copyvar 0x8000 LASTRESULT
compare 0x8000 0x0
if 0x1 goto @16
compare 0x8000 0x1
if 0x1 goto @24
compare 0x8000 0x2
if 0x1 goto @17
compare 0x8000 0x7F
if 0x1 goto @17
end

'---------------
#org @12
preparemsg @15 '"Hallo!\pIch leite hier die Forschu..."
waitmsg
multichoice 0x0 0x0 0x17 0x0
copyvar 0x8000 LASTRESULT
compare 0x8000 0x0
if 0x1 goto @24
compare 0x8000 0x1
if 0x1 goto @17
compare 0x8000 0x7F
if 0x1 goto @17
end

'---------------
#org @13
preparemsg @15 '"Hallo!\pIch leite hier die Forschu..."
waitmsg
multichoice 0x0 0x0 0x25 0x0
copyvar 0x8000 LASTRESULT
compare 0x8000 0x0
if 0x1 goto @25
compare 0x8000 0x1
if 0x1 goto @16
compare 0x8000 0x2
if 0x1 goto @17
compare 0x8000 0x7F
if 0x1 goto @17
end

'---------------
#org @14
preparemsg @15 '"Hallo!\pIch leite hier die Forschu..."
waitmsg
multichoice 0x0 0x0 0x15 0x0
copyvar 0x8000 LASTRESULT
compare 0x8000 0x0
if 0x1 goto @25
compare 0x8000 0x1
if 0x1 goto @17
compare 0x8000 0x7F
if 0x1 goto @17
end

'---------------
#org @16
bufferpokemon 0x0 0x8C
bufferitem 0x1 0x166
msgbox @26 MSG_YESNO '"Oh!\nDas ist ein [buffer2]!\pEs is..."
compare LASTRESULT 0x0
if 0x1 goto @27
msgbox @28 MSG_KEEPOPEN '"Gib es schnell her, damit ich\nfor..."
textcolor 0x0
removeitem 0x166 0x1
msgbox @9 MSG_KEEPOPEN '"Es wird einige Zeit dauern!\nKomm ..."
setvar 0x406A 0x1
setvar 0x4069 0x2
release
end

'---------------
#org @17
msgbox @29 MSG_KEEPOPEN '"Nein?\nZu schade!"
release
end

'---------------
#org @19
textcolor 0x3
msgbox @30 MSG_KEEPOPEN '"Es ist kein Platz mehr für POKéMON..."
release
end

'---------------
#org @20
textcolor 0x3
fanfare 0x101
preparemsg @31 '"[player] erhält\n[buffer1]!"
waitmsg
waitfanfare
setvar 0x406A 0x0
msgbox @32 MSG_YESNO '"Möchtest du [buffer1] einen\nSpitz..."
compare LASTRESULT 0x0
if 0x1 goto @33
call @34
call @35
goto @33

'---------------
#org @21
textcolor 0x3
fanfare 0x101
preparemsg @31 '"[player] erhält\n[buffer1]!"
waitmsg
waitfanfare
setvar 0x406A 0x0
msgbox @32 MSG_YESNO '"Möchtest du [buffer1] einen\nSpitz..."
compare LASTRESULT 0x0
if 0x1 goto @36
call @37
goto @36

'---------------
#org @22
preparemsg @15 '"Hallo!\pIch leite hier die Forschu..."
waitmsg
multichoice 0x0 0x0 0x26 0x0
copyvar 0x8000 LASTRESULT
compare 0x8000 0x0
if 0x1 goto @24
compare 0x8000 0x1
if 0x1 goto @25
compare 0x8000 0x2
if 0x1 goto @16
compare 0x8000 0x3
if 0x1 goto @17
compare 0x8000 0x7F
if 0x1 goto @17
end

'---------------
#org @23
preparemsg @15 '"Hallo!\pIch leite hier die Forschu..."
waitmsg
multichoice 0x0 0x0 0x18 0x0
copyvar 0x8000 LASTRESULT
compare 0x8000 0x0
if 0x1 goto @25
compare 0x8000 0x1
if 0x1 goto @24
compare 0x8000 0x2
if 0x1 goto @17
compare 0x8000 0x7F
if 0x1 goto @17
end

'---------------
#org @24
bufferpokemon 0x0 0x8E
bufferitem 0x1 0x162
msgbox @26 MSG_YESNO '"Oh!\nDas ist ein [buffer2]!\pEs is..."
compare LASTRESULT 0x0
if 0x1 goto @27
msgbox @28 MSG_KEEPOPEN '"Gib es schnell her, damit ich\nfor..."
textcolor 0x0
removeitem 0x162 0x1
msgbox @9 MSG_KEEPOPEN '"Es wird einige Zeit dauern!\nKomm ..."
setvar 0x406A 0x1
setvar 0x4069 0x3
release
end

'---------------
#org @25
bufferpokemon 0x0 0x8A
bufferitem 0x1 0x165
msgbox @26 MSG_YESNO '"Oh!\nDas ist ein [buffer2]!\pEs is..."
compare LASTRESULT 0x0
if 0x1 goto @27
msgbox @28 MSG_KEEPOPEN '"Gib es schnell her, damit ich\nfor..."
textcolor 0x0
removeitem 0x165 0x1
msgbox @9 MSG_KEEPOPEN '"Es wird einige Zeit dauern!\nKomm ..."
setvar 0x406A 0x1
setvar 0x4069 0x1
release
end

'---------------
#org @27
msgbox 0x819CC8A MSG_KEEPOPEN '"Du bist jederzeit willkommen!"
release
end

'---------------
#org @33
release
end

'---------------
#org @34
countpokemon
subvar LASTRESULT 0x1
copyvar 0x8004 LASTRESULT
return

'---------------
#org @35
fadescreen 0x1
special 0x9E
waitstate
return

'---------------
#org @36
call 0x81ABA6E
goto @33

'---------------
#org @37
fadescreen 0x1
special 0x166
waitstate
lock
faceplayer
return

'---------------
#org 0x1ABA6E
bufferboxname 0x0 0x4037
bufferpokemon 0x1 0x4001
checkflag 0x834
if 0x0 call @38
checkflag 0x834
if 0x1 call @39
return

'---------------
#org @38
special2 LASTRESULT 0x165
compare LASTRESULT 0x1
if 0x1 goto @40
msgbox @41 MSG_KEEPOPEN '"[buffer2] wurde auf JEMANDES PC\nü..."
return

'---------------
#org @39
special2 LASTRESULT 0x165
compare LASTRESULT 0x1
if 0x1 goto @44
msgbox @42 MSG_KEEPOPEN '"[buffer2] wurde auf BILLs PC\nüber..."
return

'---------------
#org @40
special2 LASTRESULT 0x18A
bufferboxname 0x2 LASTRESULT
msgbox @43 MSG_KEEPOPEN '"BOX ["][buffer3]" in\nJEMANDES PC ..."
return

'---------------
#org @44
special2 LASTRESULT 0x18A
bufferboxname 0x2 LASTRESULT
msgbox @45 MSG_KEEPOPEN '"BOX ["][buffer3]" in\nBILLs PC ist..."
return


'---------
' Strings
'---------
#org @15
= Hallo!\pIch leite hier die Forschungen!\pWir erforschen Fossilien von\nURZEIT-POKéMON!\pHast du ein Fossil für mich?

#org @46
= Nein.\pLeider trägst du kein\nFossil bei dir.

#org @9
= Es wird einige Zeit dauern!\nKomm einfach später wieder vorbei!

#org @18
= Wo warst du? Wir haben\ndein Fossil wieder belebt!\pEin [buffer1], ganz wie ich es\nvermutet habe!

#org @26
= Oh!\nDas ist ein [buffer2]!\pEs ist ein Fossil von [buffer1],\neinem schon lange ausgestorbenen\lPOKéMON!\pDank modernster Technik können wir\nPOKéMON aus Fossilien\lwieder beleben!

#org @28
= Gib es schnell her, damit ich\nfortfahren kann!\p\c\h06Á[player] übergibt das\n[buffer2]!

#org @29
= Nein?\nZu schade!

#org @30
= Es ist kein Platz mehr für POKéMON\nvorhanden!\pDie POKéMON BOXEN sind voll und\nes kann kein POKéMON mehr\labgelegt werden!

#org @31
= [player] erhält\n[buffer1]!

#org @32
= Möchtest du [buffer1] einen\nSpitznamen geben?

#org 0x19CC8A
= Du bist jederzeit willkommen!

#org @41
= [buffer2] wurde auf JEMANDES PC\nübertragen.\pEs wurde in BOX\n["][buffer1]" abgelegt.

#org @42
= [buffer2] wurde auf BILLs PC\nübertragen.\pEs wurde in BOX\n["][buffer1]" abgelegt.

#org @43
= BOX ["][buffer3]" in\nJEMANDES PC ist voll.\p[buffer2] wurde in BOX\n["][buffer1]" übertragen.

#org @45
= BOX ["][buffer3]" in\nBILLs PC ist voll.\p[buffer2] wurde in BOX\n["][buffer1]" übertragen.


All times are GMT -8. The time now is 9:19 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.