Hello everyone. You might have seen DarkMadMan_69's thread on his take on raid battles. This tutorial is okay, but doesn't use most of the raid battle functions CFRU adds. I've replied to his tutorial with a mini-tutorial, but this will be a full tutorial.
End Result (if you did it right):
You can find a very basic raid battle script in CFRU's documentation.
Here's the script, with some comments:
That will make a raid battle, but if you copy and paste this into a script and compile, nothing will happen. Why? Because you haven't defined any raid partners or encounters.
For encounters, go to src/Tables/raid_encounters.h, first delete the Unbound stuff (in the #ifdef Unbound block) and copy and paste this template above gRaidsByMapSection and adjust it:
Here's an example of what it might look like:
Inside of the gRaidsByMapSection table add this template and adjust it:
Here's another example of what it might look like:
Do this multiple times for each route and star. When you are done, open up raid_partners.h. Look at Unbound's raid partners or copy and paste this template above the gRaidPartners table and adjust it:
Here's an example of a raid partner (full code not in screenshot):
After that, above gRaidPartners and below the raid partners, add this:
In strings/raid_battle.string, add this at the bottom:
Add an entry to the table following this format:
Here's an example of mine:
If you did all of that correctly, you should have working raid battles!
End Result (if you did it right):
![[PokeCommunity.com] Raid Battles through the Complete Fire Red Upgrade. [PokeCommunity.com] Raid Battles through the Complete Fire Red Upgrade.](https://i.imgur.com/JwWKVFq.png)
You can find a very basic raid battle script in CFRU's documentation.
Here's the script, with some comments:
Code:
#org @RaidScript_Start
special SPECIAL_IS_RAID_BATTLE_AVAILABLE //this special checks if there is a raid battle available, returns 0 (i believe) if there isn't.
compare LASTRESULT 0x0
if == goto @RaidScript_NoBattle //Stop the script if there is no battle.
msgbox @StartRaidBattle MSG_SIGN //Display a message about the battle
fadescreen FADEOUT_BLACK //Fade the screen to black
special SPECIAL_RAID_BATTLE_INTRO //display the raid battle screen
waitstate
compare LASTRESULT 0x0
if == goto @RaidScript_End //if b is pressed end the script?
setflag FLAG_TAG_BATTLE //make the battle a 2 on 1 battle
msgbox @PartnerTeamedUp MSG_SIGN //display a message
special SPECIAL_CREATE_RAID_MON //create the raid mon based on src/Tables/raid_encounters.h
special SPECIAL_START_RAID_BATTLE //start the battle
waitstate
special2 LASTRESULT 0xB4 //Get battle outcome
compare LASTRESULT 0x4 //Ran
if == goto @RaidScript_End
compare LASTRESULT 0x5 //Teleported / Lost Battle
if == goto @RaidScript_End
special SPECIAL_SET_RAID_BATTLE_FLAG //set a var that says there is no raid for this route
setvar 0x4000 0x0
#org @RaidScript_GiveReward
special SPECIAL_GIVE_RAID_BATTLE_REWARDS //give the rewards based on src/Tables/raid_encounters.h
compare LASTRESULT 0x0
if != goto @RaidScript_End //Done giving rewards
callstd MSG_FIND //show the [player] found [item] message
goto @RaidScript_GiveReward //go again
#org @RaidScript_End
release
end
That will make a raid battle, but if you copy and paste this into a script and compile, nothing will happen. Why? Because you haven't defined any raid partners or encounters.
For encounters, go to src/Tables/raid_encounters.h, first delete the Unbound stuff (in the #ifdef Unbound block) and copy and paste this template above gRaidsByMapSection and adjust it:
Code:
static struct Raid sRoute/*ROUTE_NUM*/Raids/*STAR_NUM (1-6)*/Star[] =
{
{
.species = SPECIES_, //species, examples: SPECIES_SQUIRTLE, SPECIES_CHARMANDER.
.ability = RAID_ABILITY_2, //ability. can be RAID_ABILITY_1, (first ability), RAID_ABILITY_2, (second), RAID_ABILITY_HIDDEN, (hidden), RAID_ABILITY_RANDOM_1_2, (first or second), RAID_ABILITY_RANDOM_ALL, (any).
.drops =
{
/*100 %*/ ITEM_ , //define items here, such as ITEM_FIRE_GEM, ITEM_CHOICE_BAND, ITEM_CLEVER_WING, etc.
/* 80 %*/ ITEM_ ,
/* 80 %*/ ITEM_ ,
/* 50 %*/ ITEM_ ,
/* 50 %*/ ITEM_ ,
/* 30 %*/ ITEM_ ,
/* 30 %*/ ITEM_ ,
/* 25 %*/ ITEM_ ,
/* 25 %*/ ITEM_ ,
/* 5 %*/ ITEM_ ,
/* 4 %*/ ITEM_ ,
/* 1 %*/ ITEM_ ,
},
},
};
![[PokeCommunity.com] Raid Battles through the Complete Fire Red Upgrade. [PokeCommunity.com] Raid Battles through the Complete Fire Red Upgrade.](https://i.imgur.com/NuQHnS1.png)
Inside of the gRaidsByMapSection table add this template and adjust it:
Code:
[MAPSEC_ROUTE_/*ROUTE NUM*/ - MAPSEC_DYNAMIC] =
{
[ONE_STAR_RAID] = {sRoute/*ROUTE_NUM*/Raids/*STAR_NUM*/Star, NELEMS(sRoute/*ROUTE_NUM*/Raids/*STAR_NUM*/Star)},
},
![[PokeCommunity.com] Raid Battles through the Complete Fire Red Upgrade. [PokeCommunity.com] Raid Battles through the Complete Fire Red Upgrade.](https://i.imgur.com/pAkxKsk.png)
Do this multiple times for each route and star. When you are done, open up raid_partners.h. Look at Unbound's raid partners or copy and paste this template above the gRaidPartners table and adjust it:
Code:
static const struct BattleTowerSpread sRaidPartnerSpread_/*NAME*/_Rank/*STAR*/[] =
{
{
.species = SPECIES_, //pokemon species. examples are: SPECIES_BULBASAUR, SPECIES_ZAPDOS, etc.
.nature = NATURE_, //nature
.hpIv = 31, //iv
.atkIv = 0, //iv
.defIv = 31, //iv
.spAtkIv = 31, //iv
.spDefIv = 31, //iv
.spdIv = 31, //iv
.spAtkEv = 252, //evs. same naming scheme as the ivs except replace iv with ev.
.spDefEv = 4, //evs. same naming scheme as the ivs except replace iv with ev.
.spdEv = 252, //evs. same naming scheme as the ivs except replace iv with ev.
.ability = FRONTIER_ABILITY_2, //ability. same as raid abilities except with frontier at the start instead of raid
.item = ITEM_CHOICE_SPECS, //item
.moves =
{
MOVE_BUGBUZZ, //move 1
MOVE_AIRSLASH, //move 2
MOVE_UTURN, //move 3
MOVE_GIGADRAIN, //move 4
},
.ball = BALL_TYPE_GREAT_BALL, //ball
.forSingles = TRUE, //?
.forDoubles = TRUE, //?
.modifyMovesDoubles = FALSE, //?
},
{
//some more example mons. you can remove some if you don't want a team of 3.
.species = SPECIES_SLURPUFF,
.nature = NATURE_ADAMANT,
.hpIv = 31,
.atkIv = 31,
.defIv = 31,
.spAtkIv = 0,
.spDefIv = 31,
.spdIv = 31,
.atkEv = 252,
.hpEv = 4,
.spdEv = 252,
.ability = FRONTIER_ABILITY_2,
.item = ITEM_SITRUS_BERRY,
.moves =
{
MOVE_BELLYDRUM,
MOVE_RETURN,
MOVE_PLAYROUGH,
MOVE_DRAINPUNCH,
},
.ball = BALL_TYPE_GREAT_BALL,
.forSingles = TRUE,
.forDoubles = TRUE,
.modifyMovesDoubles = FALSE,
},
{
.species = SPECIES_MAGMORTAR,
.nature = NATURE_MODEST,
.hpIv = 31,
.atkIv = 31,
.defIv = 31,
.spAtkIv = 31,
.spDefIv = 31,
.spdIv = 31,
.spAtkEv = 252,
.spDefEv = 4,
.spdEv = 252,
.ability = FRONTIER_ABILITY_2,
.item = ITEM_SITRUS_BERRY,
.moves =
{
MOVE_FIREBLAST,
MOVE_FOCUSBLAST,
MOVE_THUNDERBOLT,
MOVE_TAUNT,
},
.ball = BALL_TYPE_GREAT_BALL,
.forSingles = TRUE,
.forDoubles = TRUE,
.modifyMovesDoubles = FALSE,
}
};
![[PokeCommunity.com] Raid Battles through the Complete Fire Red Upgrade. [PokeCommunity.com] Raid Battles through the Complete Fire Red Upgrade.](https://i.imgur.com/TuMs5F9.png)
After that, above gRaidPartners and below the raid partners, add this:
Code:
extern const u8 sTrainerName_NAME[];
Code:
#org @sTrainerName_NAME
NAME
Code:
{
.owNum = EVENT_OBJ_GFX_CRUSH_GIRL, //example. you can find more in include/constants/event_objects.h or you can use the number in AdvanceMap. Example: 9
.trainerClass = CLASS_PKMN_TRAINER_1, //trainer class. leave this if you want the class to be PkMn Trainer.
.backSpriteId = TRAINER_BACK_PIC_FEMALETRAINER, //back sprite. [B]this back sprite is NOT in CFRU by default and WILL error for you. If you want to add your own, go to page 61 in the CFRU documentation, or use one found in include/constants/trainers.h[/B]
.gender = FEMALE, //male or female
.otId = 0x87116209, //trainer ot. i dont modify this.
.name = sTrainerName_NAME, //set this to the name you added before.
.spreads =
{
[ONE_STAR_RAID ... THREE_STAR_RAID] = sRaidPartnerSpread_/*NAME*/_Rank/*STAR*/, // the ... in the middle of ONE_STAR and THREE_STAR means ONE_STAR, TWO_STAR, and THREE_STAR raids will use this trainer.
[FOUR_STAR_RAID ... SIX_STAR_RAID] = sRaidPartnerSpread_/*NAME*/_Rank/*STAR*/,
//you could also define each star like this:
[ONE_STAR_RAID] = sRaidPartnerSpread_/*NAME*/_Rank/*STAR*/,
[TWO_STAR_RAID] = sRaidPartnerSpread_/*NAME*/_Rank/*STAR*/,
etc...
},
.spreadSizes =
{
[ONE_STAR_RAID ... THREE_STAR_RAID] = NELEMS(sRaidPartnerSpread_/*NAME*/_Rank/*STAR*/),
[FOUR_STAR_RAID ... SIX_STAR_RAID] = NELEMS(sRaidPartnerSpread_/*NAME*/_Rank/*STAR*/),
},
},
![[PokeCommunity.com] Raid Battles through the Complete Fire Red Upgrade. [PokeCommunity.com] Raid Battles through the Complete Fire Red Upgrade.](https://i.imgur.com/m6f8Ioq.png)
If you did all of that correctly, you should have working raid battles!