• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Lunos' Wonder Trade

Lunos

Random Uruguayan User
3,112
Posts
15
Years
Hi.
In the past few days, I've been working on a Wonder Trade script after seeing the one that the user Harlee Quinn came up with.
Since it has some pretty nasty flaws and it can't be used in serious projects, I've decided to share it.
So without further ado, let's do this.

For this tutorial we'll need:
-A Pokémon Fire Red (USA) v1.0 ROM or a Pokémon Emerald (USA) ROM.
-A GBA Emulator
-Whichever text and hex editors you prefer to use.
-HackMew's Assembler which you can find right here
-HackMew's "Take Pokémon" ASM Routine which you can find right here
-Advance Map and XSE, obviously.

Instructions:
1) Compile the "Take Pokémon" Routine made by HackMew which I linked up there.
Use the Fire Red or the Emerald version depending on which ROM you're modifying.
Here's a video showing the process.

Here's the compiled routines for those who are lazy:
Fire Red:
Spoiler:

Emerald:
Spoiler:

Then paste the compiled routine in an offset with at least 50 bytes of free space.
You can search one using Free Space Finder or your Hex Editor itself (lots of FF Bytes = Free Space).
Since I like to play things safe, I also suggest you to use an offset that ends in 0, 4, 8 o C. I've put it the Routine for Fire Red in 71A250 and the one for Emerald in E3CF80.

2) Go to Advance Map, choose a map and add a NPC on it with the following script, again, depending on which ROM you're modifying
Fire Red:
Spoiler:

Emerald:
Spoiler:
Note: FFFFFF+1 = Offset where you've put HackMew's Routine, +1.
As I said before I dropped it in 71A250, which means that I'll have to use "callasm 0x871A251".
In the case of Emerald I've put it in E3CF80, that means that I'll have to use "callasm 0x8E3CF81".


3) Test.

Credits
-Harlee Quinn, because her/his script inspired me to make this.
-Bela, because he told me how to check if the Player decides to cancel the special 0x9F by using the B Button.
-HackMew for all the contributions that she has made to the Pokémon ROM Hacking Community.
-Dani_SR_17 from Wahack for his suggestion to optimize the filter in #org @snippet4.
-BluRose for helping me to understand an incredibly stupid mistake that I was having while implementing said filter.
-Anonymous tester from Pokémon Shiny Gold Sigma for noticing that Eggs were tradable.
-LuHo for creating Advance Map.

Here's a quick video showcasing the result in Fire Red.


Here's a quick video showcasing the result in Emerald.


And that's it.​
 
Last edited:

Lunos

Random Uruguayan User
3,112
Posts
15
Years
I have edited the scripts at the main post a little bit.
The user "?Subzero?" from Wahack, found out that if you move the bufferpokemon from the Var 0x800D to another var like 0x8000 and its consequent commands, you can safely remove the countpokemon in the Line #15 and its attached commands so you can use the script even with a full team and everything will still work correctly. That means you're saving around 10 lines worth of space in your ROM which is always nice.
 
Last edited:
112
Posts
8
Years
  • Age 27
  • Seen Mar 15, 2024
This is pretty Nice.

I'm thinking of something like a gachapon machine where you pay money(or Game corner coins) and receive a random Pokemon, preferably from a pre selected group instead of chosing from all of them, and maybe for some nuzlocke hacks having the trade occur only once and cannot be repeated(a gamble).
 
38
Posts
11
Years
This is a cool feature, wonder why no one else thanks nor comment.
I was looking at the routine and your script and I'm trying to find a way to include pokémon behind Deoxys (gen IV to VII). Have you find a way to include those random pokémon with an expanded pokedex rom?
 

Lunos

Random Uruguayan User
3,112
Posts
15
Years
I will try convert this for Ruby Usage.

The only reason why I didn't post a version for Ruby, is simply because as a base it's way behind Fire Red and Emerald, to the point where you and a small bunch of people in Wahack are the only ones that for some reason are still using it in 2017.

Anyways, it shouldn't be hard at all.
You just have to compile Hackmew's Routine following the instructions to make it work on R/S which are explained in the routine's thread, replace the special 0x9F/0xA2 with whichever special Ruby uses to select a Pokémon and that's pretty much it, really.

This is a cool feature, wonder why no one else thanks nor comment.
I was looking at the routine and your script and I'm trying to find a way to include pokémon behind Deoxys (gen IV to VII). Have you find a way to include those random pokémon with an expanded pokedex rom?

Line #26 is what you're looking for. Replace 0x19C (412, which is the amount of Pokémon that the GBA Games have) with whatever amount of Pokémon your ROM has.
 
Last edited:
21
Posts
10
Years
  • Age 32
  • Seen Nov 5, 2021
Well with the ruby decompile we may well have a resurgence in ruby as a base. Still doesn't make sense to convert a routine for it though.
 
18
Posts
6
Years
  • Age 30
  • Seen Apr 24, 2023
Since I didn't understand how to change what pokemon came out of your wonder trade system I made it do just that. Fire Red only, as far as I know.

Details about which filters block which pokemon
Spoiler:


Version of Lunos's WT code made for filter
Only snippet 4 was changed, emphasized to show what space the filters needed to be copied/pasted into. I also don't know if its Emerald compatible or not, this is for FireRed.
Spoiler:


The Wonder Trade Pokemon Filters
Spoiler:
 
Last edited:
7
Posts
7
Years
  • Age 30
  • Seen May 28, 2019
I did a test in an emerald rom, I modified the original script and, I adapted it
according to the infos that you passed.

The result was a success.
The script below was what I used to take the test. I made available only the
first form of each pokémon and, I left available pokémons that do not evolve.

Only the legendary pokémons were blocked from being obtained at Wonder Trade.

The script below has only 1 generation pokémons, but can be changed to
easily insert new modifications.

#freespace 0xFF
#dynamic 0x800000

#org @snippet4tart
faceplayer
lockall
msgbox @#String1 0x5
compare 0x800D 0x1
if 0x1 goto @snippet4nippet1
msgbox @#String2 0x6
releaseall
end

#org @snippet4nippet1
msgbox @#String3 0x6
special 0xA2
waitstate
compare 0x8004 0x6
if 0x4 goto @snippet4nippet3
goto @snippet4

#org @snippet4nippet3
msgbox @#String2 0x6
releaseall
end

#org @snippet4
random 0x98
compare 0x800D 0x0
if 0x1 goto @snippet4
compare LASTRESULT 0x2
if 0x1 goto @snippet4
compare LASTRESULT 0x3
if 0x1 goto @snippet4
compare LASTRESULT 0x5
if 0x1 goto @snippet4
compare LASTRESULT 0x6
if 0x1 goto @snippet4
compare LASTRESULT 0x8
if 0x1 goto @snippet4
compare LASTRESULT 0x9
if 0x1 goto @snippet4
compare LASTRESULT 11
if 0x1 goto @snippet4
compare LASTRESULT 12
if 0x1 goto @snippet4
compare LASTRESULT 14
if 0x1 goto @snippet4
compare LASTRESULT 15
if 0x1 goto @snippet4
compare LASTRESULT 17
if 0x1 goto @snippet4
compare LASTRESULT 18
if 0x1 goto @snippet4
compare LASTRESULT 20
if 0x1 goto @snippet4
compare LASTRESULT 22
if 0x1 goto @snippet4
compare LASTRESULT 24
if 0x1 goto @snippet4
compare LASTRESULT 26
if 0x1 goto @snippet4
compare LASTRESULT 28
if 0x1 goto @snippet4
compare LASTRESULT 30
if 0x1 goto @snippet4
compare LASTRESULT 31
if 0x1 goto @snippet4
compare LASTRESULT 33
if 0x1 goto @snippet4
compare LASTRESULT 34
if 0x1 goto @snippet4
compare LASTRESULT 36
if 0x1 goto @snippet4
compare LASTRESULT 38
if 0x1 goto @snippet4
compare LASTRESULT 40
if 0x1 goto @snippet4
compare LASTRESULT 42
if 0x1 goto @snippet4
compare LASTRESULT 44
if 0x1 goto @snippet4
compare LASTRESULT 45
if 0x1 goto @snippet4
compare LASTRESULT 47
if 0x1 goto @snippet4
compare LASTRESULT 49
if 0x1 goto @snippet4
compare LASTRESULT 51
if 0x1 goto @snippet4
compare LASTRESULT 53
if 0x1 goto @snippet4
compare LASTRESULT 55
if 0x1 goto @snippet4
compare LASTRESULT 57
if 0x1 goto @snippet4
compare LASTRESULT 59
if 0x1 goto @snippet4
compare LASTRESULT 61
if 0x1 goto @snippet4
compare LASTRESULT 62
if 0x1 goto @snippet4
compare LASTRESULT 64
if 0x1 goto @snippet4
compare LASTRESULT 65
if 0x1 goto @snippet4
compare LASTRESULT 67
if 0x1 goto @snippet4
compare LASTRESULT 68
if 0x1 goto @snippet4
compare LASTRESULT 70
if 0x1 goto @snippet4
compare LASTRESULT 71
if 0x1 goto @snippet4
compare LASTRESULT 73
if 0x1 goto @snippet4
compare LASTRESULT 75
if 0x1 goto @snippet4
compare LASTRESULT 76
if 0x1 goto @snippet4
compare LASTRESULT 78
if 0x1 goto @snippet4
compare LASTRESULT 80
if 0x1 goto @snippet4
compare LASTRESULT 82
if 0x1 goto @snippet4
compare LASTRESULT 85
if 0x1 goto @snippet4
compare LASTRESULT 87
if 0x1 goto @snippet4
compare LASTRESULT 89
if 0x1 goto @snippet4
compare LASTRESULT 91
if 0x1 goto @snippet4
compare LASTRESULT 93
if 0x1 goto @snippet4
compare LASTRESULT 94
if 0x1 goto @snippet4
compare LASTRESULT 97
if 0x1 goto @snippet4
compare LASTRESULT 99
if 0x1 goto @snippet4
compare LASTRESULT 101
if 0x1 goto @snippet4
compare LASTRESULT 103
if 0x1 goto @snippet4
compare LASTRESULT 105
if 0x1 goto @snippet4
compare LASTRESULT 106
if 0x1 goto @snippet4
compare LASTRESULT 107
if 0x1 goto @snippet4
compare LASTRESULT 110
if 0x1 goto @snippet4
compare LASTRESULT 114
if 0x1 goto @snippet4
compare LASTRESULT 115
if 0x1 goto @snippet4
compare LASTRESULT 117
if 0x1 goto @snippet4
compare LASTRESULT 119
if 0x1 goto @snippet4
compare LASTRESULT 121
if 0x1 goto @snippet4
compare LASTRESULT 122
if 0x1 goto @snippet4
compare LASTRESULT 124
if 0x1 goto @snippet4
compare LASTRESULT 125
if 0x1 goto @snippet4
compare LASTRESULT 126
if 0x1 goto @snippet4
compare LASTRESULT 130
if 0x1 goto @snippet4
compare LASTRESULT 134
if 0x1 goto @snippet4
compare LASTRESULT 135
if 0x1 goto @snippet4
compare LASTRESULT 136
if 0x1 goto @snippet4
compare LASTRESULT 139
if 0x1 goto @snippet4
compare LASTRESULT 141
if 0x1 goto @snippet4
compare LASTRESULT 142
if 0x1 goto @snippet4
compare LASTRESULT 143
if 0x1 goto @snippet4
compare LASTRESULT 144
if 0x1 goto @snippet4
compare LASTRESULT 145
if 0x1 goto @snippet4
compare LASTRESULT 146
if 0x1 goto @snippet4
compare LASTRESULT 148
if 0x1 goto @snippet4
compare LASTRESULT 149
if 0x1 goto @snippet4
compare LASTRESULT 150
if 0x1 goto @snippet4
compare LASTRESULT 151
if 0x1 goto @snippet4
if 0x3 goto @snippet4nippet5
goto @snippet4

#org @snippet4nippet5
copyvar 0x8000 0x800D
bufferpokemon 0x0 0x8000
cry 0x8000 0x0
showpokepic 0x8000 0xA 0x3
waitcry
callasm 0x8300DF1
givepokemon 0x8000 0x5 0x0 0x0 0x0 0x0
pause 0x13
fanfare 0x13E
msgbox @#String5 0x4
waitfanfare
closeonkeypress
hidepokepic
msgbox @#String6 0x5
compare 0x800D 0x1
if 0x1 call @snippet4nippet6
msgbox @#String2 0x6
releaseall
end

#org @snippet4nippet6
countpokemon
subvar 0x800D 0x1
copyvar 0x8004 0x800D
fadescreen 0x1
special 0xA1
waitstate
return

#org @#String1
= Quer fazer uma troca comigo?

#org @#String2
= Okay, volte quando mudar de ideia.

#org @#String3
= Selecione um Pokémon para a troca.

#org @#String5
= [player] recebeu um(a) [buffer1]!

#org @#String6
= Deseja dar-lhe um Apelido?
 
Last edited:

YoY-X

bootycable
126
Posts
6
Years
Does this work with a Rom with an expanded dex? Like for example, Having up to 6th gen mons.
 
7
Posts
7
Years
  • Age 30
  • Seen May 28, 2019
Does this work with a Rom with an expanded dex? Like for example, Having up to 6th gen mons.


Yes, it works perfectly. All you have to do is configure the script as needed.
I can state this because I tested in a rom with the expanded déx and it worked perfectly.
 
111
Posts
6
Years
  • Age 29
  • Seen Nov 11, 2023
This does not work for Emerald Version at all. I think there is an error somewhere in the script or conversion because it will not call the ASM routine no matter where I insert it in my rom.
 
9
Posts
6
Years
  • Age 30
  • Seen May 20, 2019
This does not work for Emerald Version at all. I think there is an error somewhere in the script or conversion because it will not call the ASM routine no matter where I insert it in my rom.

Yes, it works for Emerald.

You should have entered some erroneous information in the script.

Review your script completely and see where the error is.
 
111
Posts
6
Years
  • Age 29
  • Seen Nov 11, 2023
You were right I had an error in my script! Sorry about that. One issue I am having though is that Wonder Trading with a full party of 6 causes the game to give you a free Pokemon basically. It just puts the Pokemon you got into a PC box and doesn't take away the one you traded. Is there a workaround to this?
 
9
Posts
6
Years
  • Age 30
  • Seen May 20, 2019
You were right I had an error in my script! Sorry about that. One issue I am having though is that Wonder Trading with a full party of 6 causes the game to give you a free Pokemon basically. It just puts the Pokemon you got into a PC box and doesn't take away the one you traded. Is there a workaround to this?

The question here is identical to your previous question.
Something in your script has been inserted in the wrong way.

I just tested the Wonder Trade script with 6 Pokémon on the team, and it worked normally.

In my case, I switched my Charizard and won a Feebas.

Feebas stayed in Charizard's place on my 6-team Pokémon.

Check your script again and see where the error is.

Things like this are good to happen, because, you find out for yourself what you missed and learn from the mistake.

Any questions just ask.
 
1
Posts
8
Years
  • Age 23
  • Seen Jun 22, 2021
Could someone make the emerald pokemon available with wonder trade, I'm having difficulties
 
119
Posts
14
Years
Fire Red:
Spoiler:

Not sure if anyone will read this, but I was not clear on why the Fire Red script includes a certain check. I figured it out now, and leaving it here for anyone else wondering the same.

The script loops in case the random number generated is between (and including) 252 and 276. The reason for this is because these numbers are not assigned to specific Pokémon species. Basically, they are empty. For example, Treecko (#252 in the National Dex) is number 277 (hex 0x115) in the ROM data.

This is probably basic information for anyone who has written a givepokemon script before, but leaving it here anyway. Always make sure to check the right Pokémon number, by using a table like this one.
 
1
Posts
3
Years
  • Age 26
  • Seen Jun 23, 2021
Does anyone know a script that will allow me to change the nature of my pokémon in red fire?
 
Back
Top