#dyn 0x740000 ' Firstly this is in PKSV not XSE, compile it in PKSV and Decompile it in XSE to fully understand
compare 0x5001 0x2
if == jump @end' If it's 0x2 I assume the full script is completed
compare 0x5001 0x1
if == jump @check_want' If it's 0x1 then I didn't have room for mankey last time I was here
msgbox @appears 'The message you had
clearflag 0x202 'Set mankey's personID to 202, and set this flag in a green script tile before this script(player's room is a good place)
reappear 0x2 'Mankey appears
setvar 0x5001 0x1 ' I set 5001 to 1, ensuring I've already had mankey appear
jump @check_want ' I jump to the yesno message, you'll see why
msgbox @want ' Ask if I want mankey
compare LASTRESULT YES ' If yes I jump to @get (yes I jump, not call)
if == jump @get
msgbox @too_cute 'If I said I don't want mankey, it says something like makey's cute though and loops again
jump @check_want 'Part that makes it loop
countpokemon ' Checks the amount of 'mon in my party
copyvar 0x5002 LASTRESULT ' I'm setting 0x5002 to this value for a reason, you'll see why
compare 0x5002 0x6 ' Check if the number of party 'mon are 6
if == jump @makeroom
addpokemon MANKEY 0x5 NONE 0x0 0x0 0x0 ' If less than six give me mankey
storepokemon 0x0 MANKEY ' Equivalent to XSE's bufferpokemon
showmsg 'Shows the message I prepared
msgbox @give_nick 'Ask if I want to nickname it, I'm not forcing a nickname though
compare LASTRESULT YES 'If yes call @nickname. I'm calling here, not jumping because I will returning to this point later
if == call @nickname
disappear 0x2 'Mankey disappears
setflag 0x202 ' set 202
setvar 0x5001 0x2
jump @battle_section ' I don't need to make the jump, but it makes the script more readable
copyvar 0x8004 0x5002 ' Now I copy 0x5002's value (1-6) into 0x8004
subtractvar 0x8004 0x1 ' I subtract one, because for nickname special you need to set 0x8004 to pokemon slot number (0-5)
return 'I return back the where this subroutine was called
reappear 0x74 ' Mistake? Or you really have someone's person ID set to 116?
msgbox @force_battle 'The pidgey wants to battle text
pause 0x40 'Now I create the ingame illusion that it's evolving by quickly flashing the screen white
msgbox @evolving 'pidgey evolving message
disappear 0x74 ' I don't believe these person IDs you have lol
cry 0x17 0x0 'Not sure if right cry, I just copied what you had
msgbox @scream ' Part where it screams "Pidddddddddgey!"
setflag 0x201 'Set flag 201 to keep the pidgey/pidgeotto disappeared
battle 0x11 0xA 0x0 'Again not sure if right, I just copied what you had
disappear 0x72'pidgeotto disappears
releaseall 'FINALLY WE END
msgbox @full_party'tell the player to come back with less than six, also event is paused for duration
releaseall'script already complete, but player walking in tile anyways
= Pidgey wants to battle!\nIt's not very strong though[.]
= PIDEOTTO: Pidddddge!
= Give MANKEY a nickname?
= Wait! Pidgey is evolving!
= This pidgey forces you to\na battle.\pBut it's not strong.
= Awww[.]\nIt's eyes gleam with love!\lI can't just leave it.
= This Mankey looks cute!\nDo you want to take it with you?
= I don't have room[.]\nBetter come back for it later!
= \v\h01 obtained a \v\h02!