• 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.

Fire Red Wonder Trade tut

18
Posts
6
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!!!!!

    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.
    http://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:


    This is the code explained in full....
    Spoiler:


    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:



    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:
    51
    Posts
    9
    Years
    • Seen Nov 18, 2023
    Good job!!!
    I fixed it, now works perfectly. The last problem is the level of the Pok?mon.
    The fiirst part till #org @end

    #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
     
    18
    Posts
    6
    Years
    • Seen Apr 24, 2023
    Awesome, thanks eMMEe97, I'll update the code an credit you for the fix!

    I had it figured out once but the impossible levels are what would be a pain through this method like level 1 gyrados or level 10 venusaur for example without having some other kind of filter....
     
    51
    Posts
    9
    Years
    • Seen Nov 18, 2023
    Ok I complete it!
    The only "bug" is that the new pok?mon has the name of the old pok?mon.

    If you have JPAN hacked engine installed

    #dynamic 0x800000
    #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
    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
    bufferpokemon 0x0 LASTRESULT
    goto @trade

    #org @trade
    showpokepic 0x800D 0x3 0x3
    preparemsg @get-msg
    fanfare 0x101
    waitmsg
    waitfanfare
    waitkeypress
    hidepokepic
    special 0x6
    copyvar 0x8005 LASTRESULT
    special 0x16
    special 0x6
    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!

    If you NON have JPAN Hacked Engine installed

    This is the original routine https://www.pokecommunity.com/showpost.php?p=8513264&postcount=34, I modified it!

    .text
    .align 2
    .thumb
    .thumb_func
    .global Indexnumber_changeand20bytes_recalc

    main:
    push {r0-r3, lr}
    getpokeoffset:
    ldr r0, varnumber_8004
    ldrh r2, [r0]
    mov r0, #100
    mul r2, r0
    ldr r0, partystart
    add r3, r2, r0
    push {r3}
    getandsetnewindexnumber:
    ldr r0, vartocontainnewindexnumber
    mov r2, r0
    mov r1, #0xB
    ldr r0, [sp]
    ldr r3, pokeencrypt
    bl bxr3
    recalc20bytes:
    pop {r0}
    ldr r3, effectivestatsrecalc
    bl bxr3
    pop {r0-r3, pc}
    bxr3:
    bx r3

    .align 2
    varnumber_8004: .word 0x020370C0
    partystart: .word 0x02024284
    vartocontainnewindexnumber: .word 0x020370D0
    pokeencrypt: .word 0x0804037C+1
    effectivestatsrecalc: .word 0x0803e47c+1

    Insert the routine in free space and call asm in a script

    This is the script that i use

    #dynamic 0x800000
    #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
    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
    bufferpokemon 0x0 LASTRESULT
    goto @trade

    #org @trade
    showpokepic 0x800D 0x3 0x3
    preparemsg @get-msg
    fanfare 0x101
    waitmsg
    waitfanfare
    waitkeypress
    hidepokepic
    callasm 0x8FFFFFF
    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!

    the FFFFFF is the offset of the routine +1
     
    18
    Posts
    6
    Years
    • Seen Apr 24, 2023
    This is a really bad solution. This should be done in C and not in scripts.

    Then do it better. This is something I did for fun so it at least emulates it and posted so people can use an modify or even improve. So far, gen 3 games don't have anything similar that I've seen at least in any hack.
     

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years

  • Grabbed this and modified it a bit.
    I've added the possibility to add a nickname to the Pok?mon you obtain and I've also changed the script so it doesn't start unless you have 5 Pok?mon or less in your team.
    Spoiler:

    Unfortunately and as DizzyEgg said, this implementation of the Wonder Trade is awful and shouldn't be used in any serious project at all.
    The nickname isn't the only thing that the Pok?mon you've got keeps from your original Pok?mon, it'll get the nature and moves that the original Pok?mon had too, and I suppose the same thing applies to EVs and IVs.
     
    18
    Posts
    6
    Years
    • Seen Apr 24, 2023
    I've added the possibility to add a nickname to the Pokémon you obtain and I've also changed the script so it doesn't start unless you have 5 Pokémon or less in your team.IVs.

    Nice, I'll have to update top post when I get the chance.

    The nickname isn't the only thing that the Pokémon you've got keeps from your original Pokémon, it'll get the nature and moves that the original Pokémon had too, and I suppose the same thing applies to EVs and IVs.

    Nature IV's and moves transferring as well? Thats... Odd. I haven't seen that, at least in the version eMMe put up.

    And I want to rephrase, I AM NEW TO THIS. Glad you made a better version, saw it on youtube first.
     
    Back
    Top