Skip to content
judicornadamsfoster edited this page May 29, 2026 · 1 revision

Daily Random Egg

randomegg randomegg2 randomegg3

Ever wanted to get a random Pokemon egg without knowing what you'll hatch?

This script adds an NPC "working for the Daycare Center" that will give you a random egg from a selection once per day. It also gives two specific eggs for your 10th and 20th.

The selection on mons can be added to or removed, as many as you want, just add SPECIES_* to the list.

Steps:

in include/constants/flags.h, rename any unused daily flag to:

#define FLAG_DAILY_RANDOM_EGG_NPC                   (DAILY_FLAGS_START + 0x0)  // Unused Flag

(Any unused daily-safe flag is fine to use. It must be a daily flag to have it automatically cleared each day)


in include/constants/vars.h, rename any unused var to:

#define VAR_DAILY_RANDOM_EGG_NPC                                0x409B // Unused Var

(any unused VAR is fine)


in src/field_specials.c, add these 3 lines to the top in the #includes section

#include "daycare.h"
#include "constants/species.h"
#include "constants/region_map_sections.h"

Add this section to the end of the file


void GiveRandomEgg(void)
{
    static const u16 randomEggSpeciesList[] = {
       SPECIES_GASTLY,
       SPECIES_SURSKIT,
       SPECIES_LICKITUNG,
       SPECIES_POLIWAG,
       SPECIES_HOPPIP,
       SPECIES_RATTATA,
       SPECIES_DROWZEE,		
       SPECIES_TYROGUE

    };

    struct Pokemon mon;
    u32 eggCycles;
    u16 species = randomEggSpeciesList[Random() % ARRAY_COUNT(randomEggSpeciesList)];
	
	// change MAPSEC_ROUTE_117 to any map you wish
    CreateEgg(&mon, species, MAPSEC_ROUTE_117);

    // Return value ignored (should only ever go to party)
    GiveMonToPlayer(&mon);
}


in data/specials.inc, add this line to the end of the file

	def_special GiveRandomEgg

In your chosen map script or where you insert custom scripts (I chose outside the Daycare Center on Rt 117), add the below. Then in your map, add an NPC object and give it Route117_EventScript_DailyEgg_Start


Route117_EventScript_DailyEgg_Start::
    lock
    faceplayer
    goto_if_set FLAG_DAILY_RANDOM_EGG_NPC, Route117_EventScript_DailyEgg_AlreadyTaken
	goto_if_unset FLAG_DAILY_RANDOM_EGG_NPC, Route117_EventScript_DailyEgg_Intro
	
Route117_EventScript_DailyEgg_Intro::
    msgbox Route117_Text_DailyEgg_Intro, MSGBOX_DEFAULT
	compare VAR_DAILY_RANDOM_EGG_NPC, 9
	goto_if_eq Route117_EventScript_DailyEgg_Received10
	compare VAR_DAILY_RANDOM_EGG_NPC, 19
	goto_if_eq Route117_EventScript_DailyEgg_Received20
	msgbox Route117_Text_DailyEgg_Ask, MSGBOX_YESNO
	goto_if_eq VAR_RESULT, FALSE, Route117_EventScript_DailyEgg_No
    getpartysize
    compare VAR_RESULT, 6
    goto_if_eq Route117_EventScript_DailyEgg_PartyFull
    special GiveRandomEgg
    goto Route117_EventScript_DailyEgg_Finish

Route117_EventScript_DailyEgg_No::
    msgbox Route117_Text_DailyEgg_No, MSGBOX_DEFAULT
    release
    end

Route117_EventScript_DailyEgg_Received10::
    msgbox Route117_Text_DailyEgg_Received10, MSGBOX_DEFAULT
    giveegg SPECIES_PORYGON
    goto Route117_EventScript_DailyEgg_Finish

Route117_EventScript_DailyEgg_Received20::
	msgbox Route117_Text_DailyEgg_Received20, MSGBOX_DEFAULT
	giveegg SPECIES_TOGEPI
    goto Route117_EventScript_DailyEgg_Finish

Route117_EventScript_DailyEgg_Finish::
    playfanfare MUS_OBTAIN_ITEM
    msgbox Route117_Text_DailyEgg_Received, MSGBOX_DEFAULT
    waitfanfare
    setflag FLAG_DAILY_RANDOM_EGG_NPC
	addvar VAR_DAILY_RANDOM_EGG_NPC, 1
	msgbox Route117_Text_DailyEgg_ComeFindTomorrow, MSGBOX_DEFAULT
    release
    end

Route117_EventScript_DailyEgg_PartyFull::
    msgbox Route117_Text_DailyEgg_PartyFull, MSGBOX_DEFAULT
    release
    end

Route117_EventScript_DailyEgg_AlreadyTaken::
    msgbox Route117_Text_DailyEgg_AlreadyTaken, MSGBOX_DEFAULT
    release
    end


Route117_Text_DailyEgg_Intro:
	.string "WOMAN: I work for the POKéMON DAYCARE.\p"
	.string "I give out POKéMON EGGS that other\n"
	.string "trainers haven't wanted.$"

Route117_Text_DailyEgg_Ask:
	.string "Would you like to receive one today?$"

Route117_Text_DailyEgg_No:
	.string "Hmmm… OK then.$"

Route117_Text_DailyEgg_Received:
    .string "{PLAYER} received an Egg from the woman!$"

Route117_Text_DailyEgg_PartyFull:
    .string "Hmmm… Your party is full.\n"
    .string "Come back when you have space.$"

Route117_Text_DailyEgg_AlreadyTaken:
    .string "Hmmm… Don't be greedy!\p"
	.string "You already had an EGG from me today.\n"
    .string "Come back tomorrow.$"

Route117_Text_DailyEgg_ComeFindTomorrow:
	.string "Come find me again tomorrow and I\n"
	.string "should have more eggs to give out.$"

Route117_Text_DailyEgg_Received10:
	.string "Hmmm… This is the 10th EGG I've given to\n"
	.string "you, I wonder if this EGG will be that\l"
	.string "special POKéMON you've been waiting for!$"

Route117_Text_DailyEgg_Received20:
	.string "Hmmm… You're very keen on hatching EGGS\n"
	.string "aren't you?\p"
	.string "This is the 20th EGG I've given to you.\p"
	.string "Something tells me that this EGG will be\l"
	.string "one that will bring you lots of joy!$"


//debug for testing
Route117_EventScript_DailyEgg_ClearFlag::
    clearflag FLAG_DAILY_RANDOM_EGG_NPC
	msgbox Route117_Text_DailyEgg_ClearFlag MSGBOX_DEFAULT
	end

Route117_Text_DailyEgg_ClearFlag:
	.string "FLAG DAILY RANDOM EGG cleared.$"

Clone this wiki locally