• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best places on the 'net to talk Pokémon and more! Community members will not see the bottom screen advertisements.
  • Want to share your adventures playing Pokémon?
    Check out our new Travel Journals forum for sharing playthroughs of ROM Hacks, Fan Games, and other Pokémon content!
  • IMPORTANT: Following a takedown request, the following hacks have been delisted from PokéCommunity:

    • Pokémon Glazed
    • Pokémon: Giratina Strikes Back
    • Pokémon Flora Sky
    • Pokémon Stranded
    The downloads and discussion threads for these hacks will no longer be accessible, and staff will be unable to return questions regarding accessing this content.

[Pokeemerald] Battle Transitions Guide

1,309
Posts
12
Years
  • Age 30
  • Seen Nov 24, 2023
Complete Guide to Battle Transitions

JEjeP1N.png
rczdyuY.png
JjVRwBc.png


Instead of creating a massive post, I've broken this up into smaller sections so you can find which subject you're looking for more easily.
I'll be covering how to configure, replace and add new ones.​

 
Last edited:
1,309
Posts
12
Years
  • Age 30
  • Seen Nov 24, 2023
Editing Existing Battle Transitions
To give the existing battle transitions a complete makeover, you'll need the latest version of esperance's Tilemap Creator and GraphicsGale, or another program capable of working with indexed images.

URJUwYD.png

We're going to be editing the "Big Pokéball" transition (as seen above). I've got a simple pre-made indexed tileset from one of my own projects that's ready to use (please don't steal; I spent a long time making sure it was perfect) so what I've done is deleted the original and replaced it with my own, renaming my .png file to match the original. Open the tileset for the transition you want to edit (in this case, "big_pokeball.png") with TMC and its corresponding tilemap ("big_pokeball_map.bin") with the size specifications set to 30x20 (some transitions have size specs of 32x32, either of those is fine).

FmiagDG.png

Don't panic if you're using a custom tileset like I have and the tilemap looks like an absolute mess as below - that's perfectly normal, it's just because the tilemap is still using its default tile arrangements from the original tileset it was created for. Draw your tilemap using the 8x8 blocks from the tileset on the left. Once you're happy with it, highlight the "Tilemap" drop-down and hit "Save". (Do not save your tileset, as it may result in an invalid .png signature error when you try to build.) Let's compile and see how it looks in-game...

FLUvK7K.png
 
Last edited:
1,309
Posts
12
Years
  • Age 30
  • Seen Nov 24, 2023
Adding New Battle Transitions
This demonstration won't show you how to create a whole new custom fancy transition animation - I'm not smart enough for that - but it should hopefully be helpful to you in some way if you've never looked at this stuff before, even if just to show how they're set up and structured. Think of this post as an easy beginner's guide as opposed to a complete compendium.

We're simply going to add a new transition that has the same animation style as Team Aqua/Magma - basically creating another version of it as though it was a battle transition for another trainer class. Maybe you want five evil teams instead of two or want a special transition for a particular character, etc!
Please note that Pokéemerald labels are always subject to change; I'll do my best to keep this post up to date (I wrote this ages ago and forgot to post it until now, oops). I've colour coded some labels to help show how sections are related to one another, so try to pay attention to those. As well as trying to describe where to put things I've also mentioned which line number I'm adding code to, but remember that due to Pokéemerald being updated so often, it might be slightly different for you.

-----------------------------------------------------------------------------------------------------------------------------------------------------

Alright, first things first: you will need a tilemap (.bin), palette (.pal) and tileset (.png) for your new transition. I've named all of mine "example_transition". These files go in the "pokeemerald\graphics\battle_transitions" folder.

jx7nLiL.png

Once you've got your files in the correct location, open "pokeemerald\include\battle_transition.h" and add an entry for your new transition before "B_TRANSITION_COUNT". (line 70)

Code:
...
#define B_TRANSITION_41                     41
#define B_TRANSITION_EXAMPLE                42
#define B_TRANSITION_COUNT                  43

#endif // GUARD_BATTLE_TRANSITION_H
The bottom of the file should then look something like the above. Remember to fix the numbers appropriately! Obviously since this is just a demonstration, I've named mine "B_TRANSITION_EXAMPLE".
You're finished with "battle_transition.h" now, so you can close it if you want.

-----------------------------------------------------------------------------------------------------------------------------------------------------

Next, open "pokeemerald\src\battle_transition.c". It's a pretty big file, but don't worry, there are a lot of annotations - look for //const rom data and add a few lines to the end of this section. (starting at line 317)
Code:
static const u32 [COLOR="Magenta"]sExampleTransition_Palette[/COLOR][] = INCBIN_U32("graphics/battle_transitions/example_transition.gbapal");
static const u32 [COLOR="Magenta"]sExampleTransition_Tileset[/COLOR][] = INCBIN_U32("graphics/battle_transitions/example_transition.4bpp.lz");
static const u32 [COLOR="Magenta"]sExampleTransition_Tilemap[/COLOR][] = INCBIN_U32("graphics/battle_transitions/example_transition.bin.lz");
On the left side of the "=" we have our label and on the right we have the file's location. Simple enough, right?
You'll want to follow the above example using your own labels and file names.

-----------------------------------------------------------------------------------------------------------------------------------------------------

Now that you're done with that, we're going to define our functions. Look for //this file's functions (or just Ctrl+F if you get lost scrolling). You will want to add lines to the end of that list. (starting at line 262)
Code:
[COLOR="darkorange"]static void Phase2Task_ExampleTransition[/COLOR](u8 taskId);
static bool8 [COLOR="mediumturquoise"]Phase2_ExampleTransition_Func1[/COLOR](struct Task *task);
static bool8 [COLOR="mediumturquoise"]Phase2_ExampleTransition_Func2[/COLOR](struct Task *task);
The lines you add should look like this but with your own labels, of course. If you search for "TaskFunc sPhase2_Tasks" you should come across a list with commented corresponding numbers. Scroll to the bottom of this list and add an entry for the orange label shown above. (line 371)

Code:
...
Phase2Task_40,                          [COLOR="SeaGreen"]// 40[/COLOR]
Phase2Task_41,                          [COLOR="SeaGreen"]// 41[/COLOR]
[COLOR="DarkOrange"]Phase2Task_ExampleTransition[/COLOR],           [COLOR="SeaGreen"]// 42[/COLOR]
	
};
This happens to have the same corresponding number as it does in "battle_transition.h". Searching for "Phase2Task_BigPokeball" will bring you to a bunch of functions that look similar to what we've got below - simply copy it and replace the label with your own. (line 1268)
Code:
static void [COLOR="DarkOrange"]Phase2Task_ExampleTransition[/COLOR](u8 taskId)
{
   while ([COLOR="Red"]sPhase2_ExampleTransition_Funcs[/COLOR][gTasks[taskId].tState](&gTasks[taskId]));
}
You'll notice that we have a new label here - "sPhase2_ExampleTransition_Funcs".

-----------------------------------------------------------------------------------------------------------------------------------------------------

Search "TransitionStateFunc sPhase2_Magma_Funcs" to find this snippet here:
Code:
static const TransitionStateFunc sPhase2_Magma_Funcs[] =
{
    Phase2_Magma_Func1,
    Phase2_Magma_Func2,
    Phase2_BigPokeball_Func3,
    Phase2_BigPokeball_Func4,
    Phase2_BigPokeball_Func5,
    Phase2_FramesCountdown,
    Phase2_BigPokeball_Func6
};
If you've looked at the code you'll notice that the battle transitions for Team Magma and Aqua use almost exactly the same functions as the big Pokéball transition aside from the first two. As this demo is for making a simple trainer class style transition, just copy & paste that and replace the first two labels with your own. (line 424) For instance, I now have:
Code:
static const TransitionStateFunc [COLOR="Red"]sPhase2_ExampleTransition_Funcs[/COLOR][] =
{
    [COLOR="mediumturquoise"]Phase2_ExampleTransition_Func1[/COLOR],
    [COLOR="MediumTurquoise"]Phase2_ExampleTransition_Func2[/COLOR],
    Phase2_BigPokeball_Func3,
    Phase2_BigPokeball_Func4,
    Phase2_BigPokeball_Func5,
    Phase2_FramesCountdown,
    Phase2_BigPokeball_Func6
};
We're nearly done. Ctrl+F "Phase2_Magma_Func1" & "Phase2_Magma_Func2" and copypaste those as well, making the following changes:
Code:
static bool8 [COLOR="mediumturquoise"]Phase2_ExampleTransition_Func1[/COLOR](struct Task *task)
{
    u16 *dst1, *dst2;

    task->tFrames = 60;
    sub_814669C(task);
    sub_8149F58(&dst1, &dst2);
    CpuFill16(0, dst1, 0x800);
    LZ77UnCompVram([COLOR="Magenta"]sExampleTransition_Tileset[/COLOR], dst2);
    LoadPalette([COLOR="Magenta"]sExampleTransition_Palette[/COLOR], 0xF0, 0x20);

    task->tState++;
    return FALSE;
}
The pink labels are for our tileset and tilemap - remember we added these back at the start?

Code:
static bool8 [COLOR="MediumTurquoise"]Phase2_ExampleTransition_Func2[/COLOR](struct Task *task)
{
    u16 *dst1, *dst2;

    sub_8149F58(&dst1, &dst2);
    LZ77UnCompVram([COLOR="Magenta"]sExampleTransition_Tilemap[/COLOR], dst1);
    sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160);

    task->tState++;
    return FALSE;
}
Again, the pink text is the tilemap's label. What's next? Save all that and now you are finished! You can assign your new battle transition to a trainer class in "src\battle_setup.c". Just to demonstrate, I gave mine to the standard wild Pokémon battle. All that's left to do is test in-game and see how it looks.

vbw5XGz.gif
 
1,309
Posts
12
Years
  • Age 30
  • Seen Nov 24, 2023
Configuring Battle Transitions
This is the easiest bit which people should find the most straight forward, but writing this anyway in case it isn't so obvious to newbies at first glance.
Have "src\battle_setup.c" open. As mentioned earlier on in the guide, you'll find the transitions list in "include\battle_transition.h".

Standard Battles
Spoiler:

Trainer Classes
Spoiler:

Specific Pokémon
Spoiler:
 
8
Posts
3
Years
  • Age 32
  • Seen Sep 12, 2023
So I've followed this guide to add some new transitions, and they all seem to be working except for their palettes. I created the tilesets in Graphics Gale as 4bpp (16 colors), saved each palette, then loaded those tilesets into Tilemap Studio to create the tilemap. But none of my tilemaps seem to be using their individual palettes.

I've double-checked the code and I'm pretty sure that's all good. My feeling is it's something to do with creating the tileset and tilemaps, as that's what I'm least knowledgeable with, and the guide itself isn't very clear about creating a tileset .png and palette so I may have missed something during that process.

Any ideas?
 
8
Posts
3
Years
  • Age 32
  • Seen Sep 12, 2023
I figured it out this morning, there's a palette tab in Tilemap Studio and I just had mark each tile as 'F'. Not sure what that means, or what values 1-E do, but that did the trick.
 
1,405
Posts
9
Years
  • Seen Feb 1, 2024
I figured it out this morning, there's a palette tab in Tilemap Studio and I just had mark each tile as 'F'. Not sure what that means, or what values 1-E do, but that did the trick.

It's which palette to use. There are 16 of them, and I guess battle transition palettes must be loaded as the 16th (i.e. F, from 0–F)
 
15
Posts
2
Years
  • Age 35
  • Seen Nov 7, 2022
Hi there Avara.

First of all, thanks so much for that tutorial on battle transitions.
I'm new to the decomp scene but definitely will be using your resources as my main go-to.

I have this concept of making shiny encounters more memorable and recognizable (Less 'missing out' on a shiny when grinding and not paying attention).

Essentially the idea is to add a battle transition that's unique to shiny encounters, add a star next to their name as well as change battle music.

For the battle transitions I'm curious how I'd go about targeting a pokemon's shiny status instead of its species.

Code:
switch (GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, NULL))
    {
    default:
    case SPECIES_GROUDON:

GetMonData and specifically MON_DATA_SPECIES makes sense to me, but looking through pokemon.h I only see entries for shiny chance and for OT_ID_RANDOM_NO_SHINY

There are references to 'sheen', which is probably something else?

Am I going about figuring this out the wrong way? Is there another property I can look at? Would shiny status need to be calculated instead?

Thanks in advance for your input as well as the resources you've released so far.
 

Lunos

Random Uruguayan User
3,105
Posts
15
Years
For the battle transitions I'm curious how I'd go about targeting a pokemon's shiny status instead of its species.
There's a function explicitly for this, "IsMonShiny".
You could write an if statement like:
Code:
    if (IsMonShiny(&gEnemyParty[0]))
        do_something;
There are references to 'sheen', which is probably something else?
Yes. Sheen is a hidden stat for Pokémon Contests. When a Pokémon's Sheen is maxed out, you can't feed any more Pokéblocks to that Pokémon.
 
15
Posts
2
Years
  • Age 35
  • Seen Nov 7, 2022
There's a function explicitly for this, "IsMonShiny".
You could write an if statement like:
Code:
    if (IsMonShiny(&gEnemyParty[0]))
        do_something;

Thank you Lunos! Will search for that function when I get home.

Btw, your set up guide for getting up and running with decomps was pivotal to get me started, and the "How to start a project using DizzyEgg's works" guide helped a ton as well... not to mention all the tools and other posts that I've seen!
Thank you!

EDIT:
This is amazing!
(Can't get the youtube embeds to work I'm afraid, so here's a link)
https://www.youtube.com/watch?v=cdztsYVN6bI
Spoiler:


Still need to follow the tutorial around making a custom transition (stole Groudon's transition here, and Mew's music).
But the power of decomps is insane!
 
Last edited:
Back
Top