- 18
- Posts
- 7
- Years
- Seen Apr 24, 2023
YOU NEED TO HAVE EITHER JPANS HACKED ENGINE INSTALLED BEFOREHAND INTO YOUR COPY OF FIRE RED
OR THE HACK APPLIERS SPECIAL 0X62
OR ELSE THIS WILL NOT WORK!!!!!
THIS IS NOT STAND ALONE IT NEEDS JPANS HACKED ENGINE!!!!!
OR THE HACK APPLIERS SPECIAL 0X62
OR ELSE THIS WILL NOT WORK!!!!!
THIS IS NOT STAND ALONE IT NEEDS JPANS HACKED ENGINE!!!!!
Tools needed
XSE
AdvanceMap
JPANS Hacked Engine
So, as we all know Gen 3 lacks a major feature some of the later games have, which is wonder trading.
As most know, you trade randomly with someone online to get a pokemon they randomly traded. Well, you need servers and online resources and some major coding knowledge I dont have cause im not a pro.
What I do have thou is offline wonder trading that you can control which pokemon the player is able to receive. This is the result of 3 weeks of nonstop work so without much ado, lets make this simple. This guide also assumes you know the BASICS of scripting, like lock, faceplayer ect. Basic stuff, ya know?
Any command questions as what does what, best resource i've found.
https://sphericalice.com/romhacking/documents/script/
Now, because it uses JPANS hacked engine it may or may not work well with a hack in progress. I don't know. I do know the below code works with either the full hacked base with cleared scripts or his nifty little tool to apply certain parts of the hacked engine. A quick google search will give you the hacked engine, if I need to reupload his engine myself I will do so. Last I checked the link on the thread here was broke.
The filter is seperate from the code it's self because A) it makes it too long and B) because it puts wonder trading on an NPC i had different levels of the filter for the hack I was planning to build but gave up on due to personal limits.
How to
This is simple. Just open XSE, copy paste the clean script from below, add in the filter with whatever kinda modifications you want for the filter (explained below) and paste it into XSE. Make sure you insert the filter into the right spot. Then simply save it, then compile the script. Place the offset XSE gives you into a NPC on advancemap an enjoy randomly traded pokemon.
This is the code, in its purity.
Spoiler:
#Dynamic 0x740000
#org @starting
lock
faceplayer
msgbox @qw MSG_YESNO
compare LASTRESULT 0x1
if 0x0 goto @end
msgbox @by MSG_NORMAL
special 0x9f
waitstate
compare 0x8004 0x6
if 0x4 goto @end
special 0x62
goto @start
#org @end
msgbox @as MSG_NORMAL
release
end
#org @start
random 0x19C
compare LASTRESULT 0x0
if 0x1 goto @start
compare LASTRESULT 0xFC
if 0x1 goto @start
compare LASTRESULT 0xFD
if 0x1 goto @start
compare LASTRESULT 0xFE
if 0x1 goto @start
compare LASTRESULT 0xFF
if 0x1 goto @start
compare LASTRESULT 0x100
if 0x1 goto @start
compare LASTRESULT 0x101
if 0x1 goto @start
compare LASTRESULT 0x102
if 0x1 goto @start
compare LASTRESULT 0x103
if 0x1 goto @start
compare LASTRESULT 0x104
if 0x1 goto @start
compare LASTRESULT 0x105
if 0x1 goto @start
compare LASTRESULT 0x106
if 0x1 goto @start
compare LASTRESULT 0x107
if 0x1 goto @start
compare LASTRESULT 0x108
if 0x1 goto @start
compare LASTRESULT 0x109
if 0x1 goto @start
compare LASTRESULT 0x10A
if 0x1 goto @start
compare LASTRESULT 0x10B
if 0x1 goto @start
compare LASTRESULT 0x10C
if 0x1 goto @start
compare LASTRESULT 0x10D
if 0x1 goto @start
compare LASTRESULT 0x10E
if 0x1 goto @start
compare LASTRESULT 0x10F
if 0x1 goto @start
compare LASTRESULT 0x110
if 0x1 goto @start
compare LASTRESULT 0x111
if 0x1 goto @start
compare LASTRESULT 0x112
if 0x1 goto @start
compare LASTRESULT 0x113
if 0x1 goto @start
compare LASTRESULT 0x114
if 0x1 goto @start
compare LASTRESULT 0x90
if 0x1 goto @start
compare LASTRESULT 0x91
if 0x1 goto @start
compare LASTRESULT 0x92
if 0x1 goto @start
compare LASTRESULT 0x96
if 0x1 goto @start
compare LASTRESULT 0x97
if 0x1 goto @start
compare LASTRESULT 0xF3
if 0x1 goto @start
compare LASTRESULT 0xF4
if 0x1 goto @start
compare LASTRESULT 0xF5
if 0x1 goto @start
compare LASTRESULT 0xF9
if 0x1 goto @start
compare LASTRESULT 0xFA
if 0x1 goto @start
compare LASTRESULT 0xFB
if 0x1 goto @start
compare LASTRESULT 0x191
if 0x1 goto @start
compare LASTRESULT 0x192
if 0x1 goto @start
compare LASTRESULT 0x193
if 0x1 goto @start
compare LASTRESULT 0x194
if 0x1 goto @start
compare LASTRESULT 0x195
if 0x1 goto @start
compare LASTRESULT 0x196
if 0x1 goto @start
compare LASTRESULT 0x197
if 0x1 goto @start
compare LASTRESULT 0x198
if 0x1 goto @start
compare LASTRESULT 0x199
if 0x1 goto @start
compare LASTRESULT 0x19A
if 0x1 goto @start
setvar 0x8004 LASTRESULT
bufferpokemon 0x0 LASTRESULT
goto @trade
#org @trade
showpokepic 0x800D 0x3 0x3
givepokemon 0X800D 0X32 0x0 0x0 0x0 0x0
preparemsg @get-msg
fanfare 0x101
waitmsg
waitfanfare
waitkeypress
hidepokepic
release
end
'---------
' Strings
'---------
#org @ty
= Thank you!
#org @qw
= Do you want to Wonder Trade?\pThe choice is yours...
#org @as
= We hope to see you again.
#org @by
= Pick your Pokemon to give up.
#org @get-msg
= You got a [BUFFER1]\pTake good care of it!
This is the code explained in full....
Spoiler:
#Dynamic 0x740000
#org @starting
lock
faceplayer
msgbox @qw MSG_YESNO yes no to wondertrading
compare LASTRESULT 0x1
if 0x0 goto @end player said no, end script.
msgbox @by MSG_NORMAL
special 0x9f choose your pokemon
waitstate
compare 0x8004 0x6 if cancel/B
if 0x4 goto @end end script if last result
special 0x62 deletes chosen pokemon
goto @start
#org @end
msgbox @as MSG_NORMAL
release
end
#org @start
random 0x19C generates a random number from 0 to 412, can be changed
FILTER HERE
setvar 0x8004 LASTRESULT its necessary idk why
bufferpokemon 0x0 LASTRESULT sets generated pkmn name to buffer1
goto @trade
#org @trade
showpokepic 0x800D 0x3 0x3 shows the pokemon
givepokemon 0X800D 0X32 0x0 0x0 0x0 0x0 gives you the pokemon
preparemsg @get-msg you got that pokemon message
fanfare 0x101
waitmsg some fanfare, closing commands ect ect
waitfanfare
waitkeypress
hidepokepic
release
end
'---------
' Strings
'---------
#org @text
= Searching.\pSearching..\pSearching...
#org @ty
= Thank you!
#org @qw
= Do you want to Wonder Trade?\pThe choice is yours...
#org @as
= We hope to see you again.
#org @by
= Pick your Pokemon to give up.
#org @get-msg
= You got a [BUFFER1]\pTake good care of it!
Looks great, sounds great!
BUT WAIT THERES MORE! If you didn't notice there is a blank spot in the @start string. That's cause that should have been labeled the filter string, but I accidentally made the filter with @start instead of @filter an after I set it like I did I gave up cause I had done too many, was a hassle. The filter section is easy, simply
compare LASTRESULT 0xFFF
if 0x1 goto @start
where FFF is the pokemons hex code. If that pokemons number was generated then, it starts over an generates a new number until it found on not on the list. The list below is first comprised of Glitched pokemon that can appear through the glitch, gold bulbasaur and the blanks after celibi, while the rest of it is the legendary pokemon for gen 3. At the minimum to avoid messing things up, use 0x0 to 0x114 because those are the empty ingame slots.
Spoiler:
compare LASTRESULT 0x0
if 0x1 goto @start
compare LASTRESULT 0xFC
if 0x1 goto @start
compare LASTRESULT 0xFD
if 0x1 goto @start
compare LASTRESULT 0xFE
if 0x1 goto @start
compare LASTRESULT 0xFF
if 0x1 goto @start
compare LASTRESULT 0x100
if 0x1 goto @start
compare LASTRESULT 0x101
if 0x1 goto @start
compare LASTRESULT 0x102
if 0x1 goto @start
compare LASTRESULT 0x103
if 0x1 goto @start
compare LASTRESULT 0x104
if 0x1 goto @start
compare LASTRESULT 0x105
if 0x1 goto @start
compare LASTRESULT 0x106
if 0x1 goto @start
compare LASTRESULT 0x107
if 0x1 goto @start
compare LASTRESULT 0x108
if 0x1 goto @start
compare LASTRESULT 0x109
if 0x1 goto @start
compare LASTRESULT 0x10A
if 0x1 goto @start
compare LASTRESULT 0x10B
if 0x1 goto @start
compare LASTRESULT 0x10C
if 0x1 goto @start
compare LASTRESULT 0x10D
if 0x1 goto @start
compare LASTRESULT 0x10E
if 0x1 goto @start
compare LASTRESULT 0x10F
if 0x1 goto @start
compare LASTRESULT 0x110
if 0x1 goto @start
compare LASTRESULT 0x111
if 0x1 goto @start
compare LASTRESULT 0x112
if 0x1 goto @start
compare LASTRESULT 0x113
if 0x1 goto @start
compare LASTRESULT 0x114
if 0x1 goto @start
compare LASTRESULT 0x90
if 0x1 goto @start
compare LASTRESULT 0x91
if 0x1 goto @start
compare LASTRESULT 0x92
if 0x1 goto @start
compare LASTRESULT 0x96
if 0x1 goto @start
compare LASTRESULT 0x97
if 0x1 goto @start
compare LASTRESULT 0xF3
if 0x1 goto @start
compare LASTRESULT 0xF4
if 0x1 goto @start
compare LASTRESULT 0xF5
if 0x1 goto @start
compare LASTRESULT 0xF9
if 0x1 goto @start
compare LASTRESULT 0xFA
if 0x1 goto @start
compare LASTRESULT 0xFB
if 0x1 goto @start
compare LASTRESULT 0x191
if 0x1 goto @start
compare LASTRESULT 0x192
if 0x1 goto @start
compare LASTRESULT 0x193
if 0x1 goto @start
compare LASTRESULT 0x194
if 0x1 goto @start
compare LASTRESULT 0x195
if 0x1 goto @start
compare LASTRESULT 0x196
if 0x1 goto @start
compare LASTRESULT 0x197
if 0x1 goto @start
compare LASTRESULT 0x198
if 0x1 goto @start
compare LASTRESULT 0x199
if 0x1 goto @start
compare LASTRESULT 0x19A
if 0x1 goto @start
BUGS
emme97 gave the fix for no pokemon selected, many thanks!
Levels are set to 50 in this version here. I dont know if I can randomize them through this method, much less make the levels realistic an no impossible leveled pokemon without an excess of if this then that routines. Just a heads up, you will have to filter the pokemon out depending on the level you set it to.
JPANS Hacked Engine Bug
Kinda rare but still happened to me while trying to code this, cause I use clean roms after every 5 code changes. Every now and then when you add JPANS hacked engine it will corrupt special 0x9f and it will only act like your picking the first pokemon no matter what. Something duun goofed if thats your problem, I hope you have a backup cause I dont know how to fix that. BEWARE
Happy Single Player Wonder Trading guys, I can't wait to see this in someones hack.
Last edited: