forked from DizzyEggg/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 3
Trainer Class Based Poké Balls
HunarPG edited this page Sep 1, 2022
·
3 revisions
Credit to Buffel Saft for posting this in the Simple Modifications Pokecommunity Thread.
This tutorial will implement different trainer classes sending out their Pokemon in different Poke Balls, just like in Gen 7.
First, this will require a new struct to be made in include/battle_main.h:
struct TrainerBall
{
u8 classId;
u8 Ball; // make this a u16 if needed
};
Now that we have the struct, we need to pair all the trainer classes to a Poke Ball type. Add this table to src/battle_main.c:
const struct TrainerBall gTrainerBallTable[] = {
{TRAINER_CLASS_TEAM_AQUA, ITEM_NET_BALL},
{TRAINER_CLASS_AQUA_ADMIN, ITEM_NET_BALL},
{TRAINER_CLASS_AQUA_LEADER, ITEM_MASTER_BALL},
{TRAINER_CLASS_AROMA_LADY, ITEM_FRIEND_BALL},
{TRAINER_CLASS_RUIN_MANIAC, ITEM_DUSK_BALL},
{TRAINER_CLASS_INTERVIEWER, ITEM_REPEAT_BALL},
{TRAINER_CLASS_TUBER_F, ITEM_DIVE_BALL},
{TRAINER_CLASS_TUBER_M, ITEM_DIVE_BALL},
{TRAINER_CLASS_SIS_AND_BRO, ITEM_POKE_BALL},
{TRAINER_CLASS_COOLTRAINER, ITEM_ULTRA_BALL},
{TRAINER_CLASS_HEX_MANIAC, ITEM_DUSK_BALL},
{TRAINER_CLASS_LADY, ITEM_LUXURY_BALL},
{TRAINER_CLASS_BEAUTY, ITEM_LOVE_BALL},
{TRAINER_CLASS_RICH_BOY, ITEM_LUXURY_BALL},
{TRAINER_CLASS_POKEMANIAC, ITEM_MOON_BALL},
{TRAINER_CLASS_SWIMMER_M, ITEM_DIVE_BALL},
{TRAINER_CLASS_BLACK_BELT, ITEM_HEAVY_BALL},
{TRAINER_CLASS_GUITARIST, ITEM_FAST_BALL},
{TRAINER_CLASS_KINDLER, ITEM_POKE_BALL},
{TRAINER_CLASS_CAMPER, ITEM_NEST_BALL},
{TRAINER_CLASS_OLD_COUPLE, ITEM_POKE_BALL},
{TRAINER_CLASS_BUG_MANIAC, ITEM_NET_BALL},
{TRAINER_CLASS_PSYCHIC, ITEM_DREAM_BALL},
{TRAINER_CLASS_GENTLEMAN, ITEM_LUXURY_BALL},
{TRAINER_CLASS_ELITE_FOUR, ITEM_ULTRA_BALL},
{TRAINER_CLASS_LEADER, ITEM_ULTRA_BALL},
{TRAINER_CLASS_SCHOOL_KID, ITEM_POKE_BALL},
{TRAINER_CLASS_SR_AND_JR, ITEM_POKE_BALL},
{TRAINER_CLASS_POKEFAN, ITEM_POKE_BALL},
{TRAINER_CLASS_EXPERT, ITEM_ULTRA_BALL},
{TRAINER_CLASS_YOUNGSTER, ITEM_POKE_BALL},
{TRAINER_CLASS_CHAMPION, ITEM_CHERISH_BALL},
{TRAINER_CLASS_FISHERMAN, ITEM_LURE_BALL},
{TRAINER_CLASS_TRIATHLETE, ITEM_FAST_BALL},
{TRAINER_CLASS_DRAGON_TAMER, ITEM_ULTRA_BALL},
{TRAINER_CLASS_BIRD_KEEPER, ITEM_QUICK_BALL},
{TRAINER_CLASS_NINJA_BOY, ITEM_QUICK_BALL},
{TRAINER_CLASS_BATTLE_GIRL, ITEM_HEAVY_BALL},
{TRAINER_CLASS_PARASOL_LADY, ITEM_POKE_BALL},
{TRAINER_CLASS_SWIMMER_F, ITEM_DIVE_BALL},
{TRAINER_CLASS_PICNICKER, ITEM_FRIEND_BALL},
{TRAINER_CLASS_TWINS, ITEM_POKE_BALL},
{TRAINER_CLASS_SAILOR, ITEM_DIVE_BALL},
{TRAINER_CLASS_COLLECTOR, ITEM_REPEAT_BALL},
{TRAINER_CLASS_RIVAL, ITEM_PREMIER_BALL},
{TRAINER_CLASS_PKMN_BREEDER, ITEM_TIMER_BALL},
{TRAINER_CLASS_PKMN_RANGER, ITEM_SAFARI_BALL},
{TRAINER_CLASS_TEAM_MAGMA, ITEM_NEST_BALL},
{TRAINER_CLASS_MAGMA_ADMIN, ITEM_NEST_BALL},
{TRAINER_CLASS_MAGMA_LEADER, ITEM_MASTER_BALL},
{TRAINER_CLASS_LASS, ITEM_POKE_BALL},
{TRAINER_CLASS_BUG_CATCHER, ITEM_NET_BALL},
{TRAINER_CLASS_HIKER, ITEM_HEAVY_BALL},
{TRAINER_CLASS_YOUNG_COUPLE, ITEM_LOVE_BALL},
{TRAINER_CLASS_WINSTRATE, ITEM_GREAT_BALL},
{TRAINER_CLASS_PKMN_TRAINER_2, ITEM_HEAVY_BALL},
{0xFF, ITEM_POKE_BALL},
};
You are free to customize this table to your liking.
Finally, we need to have the trainers use the Poke Balls we defined earlier. In the CreateNPCTrainerParty
function of src/battle_main.c, add the following:
for (j = 0; j < MAX_MON_MOVES; j++)
{
SetMonData(&party[i], MON_DATA_MOVE1 + j, &partyData[i].moves[j]);
SetMonData(&party[i], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp);
}
break;
}
}
+ for (j = 0; gTrainerBallTable[j].classId != 0xFF; j++)
+ {
+ if (gTrainerBallTable[j].classId == gTrainers[trainerNum].trainerClass)
+ break;
+ }
+ SetMonData(&party[i], MON_DATA_POKEBALL, &gTrainerBallTable[j].Ball);
}
gBattleTypeFlags |= gTrainers[trainerNum].doubleBattle;
}
return gTrainers[trainerNum].partySize;
}
And that's it!