- 183
- Posts
- 7
- Years
- Seen Jan 22, 2025
I've been trying to do this, at first, I grabbed the code from the Hidden Moves that check if you have the required move, "ScrCmd_checkpartymove", but i can't seem to get it to work. It just returns the first pokémon of the team without any comparation.
This is the code i used:
and
This is the code i used:
Code:
bool8 ScrCmd_checkpartytype(struct ScriptContext *ctx)
{
u8 i;
u16 type = ScriptReadHalfword(ctx);
gSpecialVar_Result = PARTY_SIZE;
for (i = 0; i < PARTY_SIZE; i++)
{
u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL);
if (!species)
break;
if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) && MonIsType(&gPlayerParty[i], type) == TRUE)
{
gSpecialVar_Result = i;
gSpecialVar_0x8004 = species;
break;
}
}
return FALSE;
}
Code:
bool8 MonIsType(struct Pokemon *mon, u16 type)
{
u8 i;
u16 species = GetMonData(mon, MON_DATA_SPECIES);
if (IS_BATTLER_OF_TYPE(species, type))
return TRUE;
return FALSE;
}
Last edited: