Make Mirage Island Appear with Pokemon in party or a flag being set - pret/pokeemerald GitHub Wiki
Make Mirage Island appear with different methods.
All of these changes go in file src/time_events.c
appears with 1 specific Pokemon in your party
credit to resetes12 / Modern Emerald
replace all code in bool8 IsMirageIslandPresent(void) with:
{
u16 rnd = GetMirageRnd() >> 16;
int i;
for (i = 0; i < PARTY_SIZE; i++)
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_JIRACHI)
return TRUE;
return FALSE;
}
appears with mutiple specified pokemon in party
credit to resetes12 / Modern Emerald
replace all code in bool8 IsMirageIslandPresent(void) with:
{
u16 rnd = GetMirageRnd() >> 16;
int i;
for (i = 0; i < PARTY_SIZE; i++)
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_JIRACHI)
return TRUE;
else if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_CELEBI)
return TRUE;
return FALSE;
}
appears when a flag is set
first, in include/constants/flags.h, rename an unused flag
example:
#define FLAG_FORCE_MIRAGE_ISLAND 0x20
then, back in src/time_events.c replace all code in bool8 IsMirageIslandPresent(void) with:
{
if (FlagGet(FLAG_FORCE_MIRAGE_ISLAND))
return TRUE;
return FALSE;
}
Then just create a script that does a setflag FLAG_FORCE_MIRAGE_ISLAND
having multiple methods
you can also keep the original method of having a pokemon with the correct random number and add one (or all) of the above methods by adding them as else if rather than just if
example:
{
u16 rnd = GetMirageRnd() >> 16;
int i;
for (i = 0; i < PARTY_SIZE; i++)
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && (GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY) & 0xFFFF) == rnd)
return TRUE;
else if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_MEW)
return TRUE;
else if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_MEWTWO)
return TRUE;
else if (FlagGet(FLAG_FORCE_MIRAGE_ISLAND))
return TRUE;
return FALSE;
}