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

[Script] Get Selected Pokemon's Level

36
Posts
5
Years
  • Age 24
  • Seen Apr 18, 2024
I'm using Lunos' wonder trade script and it all works well. However, right now the Pokemon you receive is at level five no matter what, as seen here:
givepokemon 0x8000 0x5 0x0 0x0 0x0 0x0

Is there some way to store your chosen Pokemon's level in a variable, then give you a random Pokemon at that same level? I have JPAN's hacked engine applied, if that helps.


Here's the script I'm using:
Code:
'---------------
#org 0x834DAB
faceplayer
lockall
msgbox 0x88BBDDE MSG_YESNO '"Wanna wonder trade?"
compare LASTRESULT 0x1
if 0x1 goto 0x88F83F4
msgbox 0x88EEFED MSG_NORMAL '"Come back anytime."
releaseall
end

'---------------
#org 0x8F83F4
countpokemon
compare LASTRESULT 0x1
if 0x1 goto 0x88F3419
msgbox 0x88FEF7D MSG_NORMAL '"Select the Pokémon you wanna trade..."
special 0x9F
waitstate
special2 0x8003 0x147
compare 0x8003 0x19C
if 0x1 goto 0x88BA2AA
compare 0x8004 0x6
if 0x4 goto 0x88BEEE1
goto 0x88EDAB2

'---------------
#org 0x8F3419
msgbox 0x8866BC4 MSG_NORMAL '"Sorry, you need two Pokémon\nto us..."
releaseall
end

'---------------
#org 0x8BA2AA
msgbox 0x8812385 MSG_NORMAL '"I'm sorry, you cannot trade\na Pok..."
releaseall
end

'---------------
#org 0x8BEEE1
msgbox 0x88EEFED MSG_NORMAL '"Come back anytime."
releaseall
end

'---------------
#org 0x8EDAB2
random 0x19C
compare LASTRESULT 0x0
if 0x1 goto 0x88EDAB2
compare LASTRESULT 0xFB
if 0x3 goto 0x88BB32D
compare LASTRESULT 0x115
if 0x4 goto 0x88BB32D
goto 0x88EDAB2

'---------------
#org 0x8BB32D
copyvar 0x8000 LASTRESULT
bufferpokemon 0x0 0x8000
showpokepic 0x8000 0xA 0x3
waitcry
callasm 0x871E751
givepokemon 0x8000 0x5 0x0 0x0 0x0 0x0
pause 0x13
fanfare 0x13E
msgbox 0x88BFC33 MSG_KEEPOPEN '"[player] got a [buffer1]!"
waitfanfare
closeonkeypress
hidepokepic
msgbox 0x88D4343 MSG_YESNO '"Wanna give it a nickname?"
compare LASTRESULT 0x1
if 0x1 call 0x8844FED
msgbox 0x88EEFED MSG_NORMAL '"Come back anytime."
releaseall
end

'---------------
#org 0x844FED
countpokemon
subvar LASTRESULT 0x1
copyvar 0x8004 LASTRESULT
fadescreen 0x1
special 0x9E
waitstate
return


'---------
' Strings
'---------
#org 0x8BBDDE
= Wanna wonder trade?

#org 0x8EEFED
= Come back anytime.

#org 0x8FEF7D
= Select the Pokémon you wanna trade.

#org 0x866BC4
= Sorry, you need two Pokémon\nto use the Wonder Trade.\pCome back anytime.

#org 0x812385
= I'm sorry, you cannot trade\na Pokémon Egg using the\lWonder Trade System.\pCome back anytime.

#org 0x8BFC33
= [player] got a [buffer1]!

#org 0x8D4343
= Wanna give it a nickname?

It's probably a simple question, but I'm just having trouble figuring it out. Thanks!
 
119
Posts
14
Years
Dragonite2963, this Reddit post seems to have exactly what you need. I was looking for this type of script myself, and I've tried out this ASM routine and it works as intended.

I am copying it here for reference/archival purposes, but all credit goes to the OP, /u/IncompleteThought:

Spoiler:
This a fairly simple case of inserting an ASM routine, so I'm not adding extensive step-by-step instructions here. If you are not familiar with ASM yet, you should be fine by simply following FBI's instructions. I am absolutely not versed in ASM but could somehow make it work.

Avoid the rookie mistakes I made:
  • Don't forget to open the .bin file in the Hex editor (and not the .asm file). As clearly stated in FBI's tutorial.
  • Don't forget to insert your own offset in the second piece of code. There where it says "ldr r2, =(0x.....".
  • Don't forget that pointers in ASM always add +1 to the actual offset. As you can see from the sample, the offset for the new script was 0x83F0A8 but the second piece of code is ldr r2, =(0x0883F0A9). This is stated in FBI's tutorial as well, so I don't have much to add. This is simply meant as a reminder.
  • Finally, don't forget to insert a regular XSE script in which the level is stored in variable 0x8001.
Let me know if this works for you or not.
 
Last edited:
Back
Top