#dynamic 0x800000
#org @main
lock
showsprite 0x(hex value of rival's sprite in Advance Map)
applymovement 0x(hex value of rival's sprite in Advance Map) @toPlayer
applymovement 0xFF @faceRival
waitmovement 0x0
trainerbattle 0x1 0x(hex byte for the trainer in Advance Map) 0x0 @hey @lost @continue
end
#org @continue
setvar 0x(var number for the tile in Advance Map) 0x(var value for the tile in Advance Map)
msgbox @darn 0x6
applymovement 0x(hex value of rival's sprite in Advance Map) @leave
waitmovement 0x0
hidesprite 0x(hex value of rival's sprite in Advance Map)
release
end
#org @toPlayer
movement data so the rival walks to the player
#raw 0xFE
#org @faceRival
movement data so the player will be facing the rival
#raw 0xFE
#org @hey
= [rival]: Hey, [player]! Let's battle!
#org @lost
= Aww, I lost!
#org @darn
= [rival]: Darn, I'll get you next time, [player]!
#org @leave
movement data so the rival walks off screen
#raw 0xFE