#dynamic 0x9C0B20
#org @start
lock
faceplayer
checkflag 0x9A // Checks if you've already done this trade before
if 0x1 goto @AlreadyTraded
setvar 0x8008 0x2 // Sets 0x8008 to the trade value (i.e which trade you want to activate)
copyvar 0x8004 0x8008
special2 0x800D 0xFF // Buffers the species names of the Pokemon involved in the trade into [buffer1] and [buffer2]. Also loads the species number that the trader wants into 0x800D
copyvar 0x8009 0x800D // Copies the species number of the Pokemon the trader wants into 0x8009
msgbox @Introduction 0x5
compare 0x800D 0x0
if 0x1 goto @AnswerNo
special 0xA2 // Shows party screen
waitstate
copyvar 0x800A 0x8004 // Places the party position of the Pokemon you chose into 0x800A
compare 0x8004 0xFF // Checks if player pressed cancel
if 0x1 goto @AnswerNo
copyvar 0x8005 0x800A // Places the party position of the Pokemon you chose into 0x8005
special2 0x800D 0x102 // Loads the species number of the Pokemon the trader wants into 0x800D
copyvar 0x800B 0x800D // Copies the species number of the Pokemon the trader wants into 0x800B
comparevars 0x800D 0x8009
if 0x5 goto @NotTheSame // Checks if the species of the Pokemon you chose (0x800D) is the same as the one the trader want (0x8009)
copyvar 0x8004 0x8008 // Copies trade value into 0x8004
copyvar 0x8005 0x800A // Copies party position of the Pokemon you're trading into 0x8005
special 0x100
special 0x101 // Executes trade animation
waitstate
bufferpokemon 0x0 0x8009
msgbox @FinishTrade 0x6
setflag 0x9A // Sets flag to indicate that you've done this trade
release
end
#org @AlreadyTraded
msgbox @Done 0x6
release
end
#org @AnswerNo
msgbox @NoText 0x6
release
end
#org @NotTheSame
bufferpokemon 0x0 0x8009
msgbox @WrongPokemon 0x6
release
end
#org @Introduction
= Check out this [buffer2]!\pIt's the [buffer2] that I caught\nyesterday to celebrate my birthday!\pOh, I can see that you want it!\nAfter all, it's priceless!\pI'll tell you what. I might be willing\nto trade it for a [buffer1].
#org @FinishTrade
= Oh, so this is a [buffer1]?\pIt's sort of like a [buffer2],\nand yet it's subtly different.\pThank you!
#org @Done
= I know I could go looking for one\non my own, but[.]\pBut I really wanted to get a BAGON\nthat another TRAINER caught[.]
#org @NoText
= Oh, so you're not going to go through\nwith this?\pThat's cool. I'm not desperate to make\na trade or anything.
#org @WrongPokemon
= No, no, no! I won't accept any\nless than a real [buffer1]!