Giving Eggs
This section will cover how to give your player a Pokémon Egg.
Super easy.
Code:
Script_GiveEggDemo::
lock
faceplayer
msgbox Text_EggQuestion, MSGBOX_YESNO
compare VAR_RESULT, 0
goto_if_eq Script_PlayerAnsweredNo
getpartysize
compare VAR_RESULT, 6
goto_if_eq Script_PlayerHasFullParty
giveegg SPECIES_LARVITAR
playfanfare MUS_FANFA4
msgbox Text_ReceivedEgg, MSGBOX_DEFAULT
waitfanfare
release
end
Script_PlayerHasFullParty::
msgbox Text_PlayerHasFullParty, MSGBOX_DEFAULT
release
end
Script_PlayerAnsweredNo::
msgbox Text_PlayerAnsweredNo, MSGBOX_DEFAULT
release
end
Text_EggQuestion:
.string "Will you take this Egg?$"
Text_PlayerAnsweredNo:
.string "Oh, that's too bad.$"
Text_ReceivedEgg:
.string "{PLAYER} received the Egg!$"
Text_PlayerHasFullParty:
.string "Your party is full.\n"
.string "There's no room for this Egg.$"
If you've read the other sections of the tutorial, you'll see that this script asks the player whether or not they would like to accept the Egg. After that, if the player responds with "YES", it'll check if they have space in their party before giving it to them. I also already explained how to use
getpartysize in the
Giving Pokémon section, so I won't bother going over that again.