• 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 fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Simple Modifications Directory

239
Posts
8
Years
  • Age 31
  • Seen Apr 15, 2024
[Pokeemerald] Toggle Trainers "Seeing" You

This is probably mostly useful for a debug menu, but could have utility for certain game events.
  • Add FLAG_TOGGLE_TRAINER_BATTLES in include/constants/flags
  • Change CheckForTrainersWantingBattle in src/trainer_see.c to:
    Code:
    bool8 CheckForTrainersWantingBattle(void)
    {
        u8 i;
        
        if (FlagGet(FLAG_TOGGLE_TRAINER_BATTLES))
            return FALSE;
        
        gNoOfApproachingTrainers = 0;
        //etc...
  • set FLAG_TOGGLE_TRAINER_BATTLES in a script or function!

Obviously, still talking directly to the trainer will trigger the battle, but they won't catch sight of you.
 
186
Posts
7
Years
  • Age 34
  • Seen today
[EM] FRLG / Gen IV and Onwards White Out Money Calculation (with messages)

This implementation is based on AsparagusEduardo's implementation of that same feature, but I added the required messages, taking the FRLG decomp as a point of start, and then modifying the getmoneyreward function in battle_script_commands.c, so it handles this part better and the buffer is updated, so the money value is taken correctly.

53dbf2a9599bdc6407160763125b1888.png
7a2e1d79aa7281633fe6b41d90664d90.png
6750aa92a3d60718a48283a5f308e436.png
f8cb3a7bcd2b4904f3e574d1ca8056b8.png
bec8f971008dbfab22b3adcafeb49630.png


You can pull this feature from this branch:

GitHub Link:
https://github.com/lightgod87/pokeemerald/tree/whiteoutmoney

Thanks to GriffinR and AsparagusEduardo for making this possible.

There's something VERY wrong about the code, but I'm not 100% sure. Yesterday I installed (manually) 4 simple modifications of these posts, one of them being this one. For some reason, after a won battle with any trainer, the game would crash. Manually reverting the code did nothing. In fact, a backup of my repository and the same repository with the 4 modifications reverted (so theoretically the same, right? I may be wrong?) behaved differently: one worked, one crashed.

Anyways, I reverted to my "clean" copy and everything worked. Tried installing all 4 modifications again and this time the battles didn't crash but instead, the next battle after a double battle, the first Pokémon sent by the trainer was a ?. who instantly froze the game. This bug worked in any double battle and any trainer afterwards. Again, reverting the code did nothing. In fact, I tried copying over only the affected files from my backup. Didn't work, the game remained broken.

It wasn't me, since the day before I literally beat the game as a test with the version I had a backup of and never had a single problem like this. After a few tries I installed all 3 modifications except this one, and it seems to work perfectly. Battles end fine and battles after double battles work. None of these modifications affect battles, so it makes sense.

After reading the code (keeping in mind that I'm still learning how to read and write code) I can't find anything that can make this happen, except this line added in src/battle_main.c:
Code:
EWRAM_DATA u8 gMaxPartyLevel = 1;

I have literally no idea how EWRAM works in this game, so I may be pulling this from my ass. But it's the only thing that maybe persists after compiling? I dunno, I think the most interesting fact is that it remains after reverting the code and compiling again.

Please excuse me if this makes sense and it's normal that code persists even after reverting it, since again I'm still learning to code. Correct me if I'm wrong.
 
4
Posts
5
Years
  • Age 27
  • Seen Mar 22, 2021
Hello, not sure if this the right place to ask. I am trying to add a new species with help of the wiki tutorial. I did everything up to step 2, then tried to compile the game but I get this error when doing so.

"tools/gbagfx/gbagfx.exe graphics/pokemon/firedog/anim_front.png graphics/pokemon/firedog/anim_front.4bpp
"graphics/pokemon/firedog/anim_front.png" has an unsupported color type.
make: *** [Makefile:209: graphics/pokemon/firedog/anim_front.4bpp]"

Anyone knows what the problem could be? Thanks in advance!
 

Lunos

Random Uruguayan User
3,113
Posts
15
Years
Hello, not sure if this the right place to ask. I am trying to add a new species with help of the wiki tutorial. I did everything up to step 2, then tried to compile the game but I get this error when doing so.

"tools/gbagfx/gbagfx.exe graphics/pokemon/firedog/anim_front.png graphics/pokemon/firedog/anim_front.4bpp
"graphics/pokemon/firedog/anim_front.png" has an unsupported color type.
make: *** [Makefile:209: graphics/pokemon/firedog/anim_front.4bpp]"

Anyone knows what the problem could be? Thanks in advance!
You may have indexed Firedog's anim_front.png incorrectly.
Make sure the sprite has a maximum of 16 colors, and that the first color in its palette is the same color used for the background.
 
4
Posts
5
Years
  • Age 27
  • Seen Mar 22, 2021
You may have indexed Firedog's anim_front.png incorrectly.
Make sure the sprite has a maximum of 16 colors, and that the first color in its palette is the same color used for the background.

I got anim_front.png and back.png to work but now footprint.png have the same problem as before even the index 0 is white because the background is white and the footprint is black.



I got the footprint to work! But now there's an issue with the normal.pal I think, here's my RGB values for the sprite:

"JASC-PAL
0100
16
239 229 177
81 145 209
17 17 17
73 73 81
169 169 169
249 249 249
201 121 169
255 0 255
255 0 255
255 0 255
255 0 255
255 0 255
255 0 255
255 0 255
255 0 255
16 16 16 "

And I got this error:

"tools/gbagfx/gbagfx.exe graphics/pokemon/firedog/normal.pal graphics/pokemon/firedog/normal.gbapal
Garbage after blue color component.
make: *** [Makefile:211: graphics/pokemon/firedog/normal.gbapal] "

I am not sure what line correlates to what.
 
Last edited by a moderator:
239
Posts
8
Years
  • Age 31
  • Seen Apr 15, 2024
[Pokeemerald] Plural giveitem

Currently the game only properly converts giveitem to a plural string if you are receiving a berry or a poke ball. So I fixed it for all items.

1cDuh4f.gif


Here is the repo to pull from. Alternatively, follow the wiki guide

How to pull from the repo:
Spoiler:
 
239
Posts
8
Years
  • Age 31
  • Seen Apr 15, 2024
[Pokeemerald] Run Custom Scripts on Trainer Sight

By default trainers will only function properly if the first argument is a trainerbattle command. This feature allows you to run any script instead:

JJ81c6i.gif


Here is the repo. You can pull from it or follow the wiki post I made. This has set up instructions at the bottom.
 
Last edited:
1,591
Posts
10
Years
  • Age 30
  • Seen Mar 20, 2024
LGPE-style Premier Balls (Emerald)

In Let's Go Pikachu and Eevee, buying Poké Balls in bulk will give the player one Premier Ball for every ten balls purchased (e.g. buying 30 balls at once gives you three free Premier Balls). This also applies to all types of ball, instead of just regular Poké Balls.

To implement this in pokeemerald, go to src/shop.c and change Task_ReturnToItemListAfterItemPurchase to the following:
Spoiler:
Then, add an extra string to src/strings.c, like so:
Code:
const u8 gText_ThrowInPremierBalls[] = _("I'll throw in some Premier Balls, too.{PAUSE_UNTIL_PRESS}");
And don't forget to declare it in include/strings.h:
Code:
extern const u8 gText_ThrowInPremierBalls[];
 
Last edited:
1,591
Posts
10
Years
  • Age 30
  • Seen Mar 20, 2024
Change Time-Based Evolution Times (Emerald)
For whatever reason, Game Freak decided that day time in Gen III should be from 12:00 p.m. to 11:59 p.m. (and night time should be 12:00 a.m. to 11:59 a.m.). As there's no day/night cycle, it only really affected Eevee's evolution into Espeon or Umbreon. To change these to more sensible values, first open up include/pokemon.h and define two new constants:
Code:
#define DAY_START 4
#define NIGHT_START 18
These are in 24 hour time, and will determine when day and night start. Set them to any value you want (as long as it's between 0 and 24). Then, go to src/pokemon.c and make the following text replacements:
  • Replace gLocalTime.hours >= 12 && gLocalTime.hours < 24 with gLocalTime.hours >= DAY_START && gLocalTime.hours < NIGHT_START
  • Replace gLocalTime.hours >= 0 && gLocalTime.hours < 12 with (gLocalTime.hours >= NIGHT_START || gLocalTime.hours < DAY_START)
If you're using Dizzy Egg's repos you may have a few instances of these, but otherwise there's only one of each. Also, if you've chosen different day/night start times, double check that the AND and OR conditions above still make sense.
e.g. if you have something like DAY_START = 12 and NIGHT_START = 0 (so you'd have gLocalTime.hours >= 12 && gLocalTime.hours < 0), that won't work (because the gLocalTime.hours can't be greater than 12 and less than 0 at the same time).
 
23
Posts
6
Years
  • Age 32
  • Seen Nov 28, 2023
Shops with single items to buy [EM]
6IkX98R.gif
In later Generations, there are some shops that would only let you buy one of each item (like TM Shops), so I created a pokeemerald branch that implements the option to create shops of this type.

How to use:
  1. You first need to clone this branch into your project.
  2. Whenever you call the pokemart command in your map scripts, you can add a number that represents a TM Shop's id. Since 0 is the default value, setting it to 0 won't work. If you repeat that shop's id in another one, they will share the same flags.
    Spoiler:

  3. You can specify the amount of TMShops that you want to implement in include\shop.h.
    Spoiler:

  4. By default, the max amount of items per TM Shop is 16, so any item added past this will be ignored and not added to the list.
  5. If for any reason you need more than 16 items per TM Shop, you'll need to change the data type from u16 to u32 or u64 in the following sections:
    Spoiler:

Thanks to:
  • UltimaSoul for their help debugging and teaching me how to bit shift :P
  • ghoulslash for advice and the inspiration for this branch

This is a fantastic feature, I really like it! I only have one question: the number of TM shops (TMSHOP_COUNT) is defined as 4. Does this mean that there can be a maximum of four individual TM shops? If so, can the number of TM shops be increased or will it cause adverse effects (seeing as we are also modifying the size of the save block)?

Thank you for your modifications, they are awesome!
 
239
Posts
8
Years
  • Age 31
  • Seen Apr 15, 2024
[Pokeemerald] Snow Weather Fix

Vanilla emerald (and fire red) snow weather stops after only a few flakes. This fixes the problem!

Here is a wiki post on how to do it. Alternatively, pull from my repo

Enjoy this peaceful gif:
aaCBZGX.gif


Credit
 
Last edited:

AsparagusEdu

AsparagusEduardo
30
Posts
10
Years
  • Age 30
  • Seen Apr 14, 2024
This is a fantastic feature, I really like it! I only have one question: the number of TM shops (TMSHOP_COUNT) is defined as 4. Does this mean that there can be a maximum of four individual TM shops? If so, can the number of TM shops be increased or will it cause adverse effects (seeing as we are also modifying the size of the save block)?

Thank you for your modifications, they are awesome!

Yes, 4 is the default maximum. I left it like that for testing, but as far as I know if you have enough space in the save block for more, there shouldn't be an issue increasing it.
 

Lunos

Random Uruguayan User
3,113
Posts
15
Years
Let the Player only buy TMs and HMs once (Emerald)

I think the title is self-explanatory, isn't it?
The code changes presented here will make it so you can only buy TMs or HMs out of a PokéMart once and never again.
This is intended to complement the Reusable TMs feature posted by Paccy in this same thread.

Quick Showcase:


Link:
https://github.com/LOuroboros/pokeemerald/commit/2e6af4e1c4a55e100882d0ccb009d91cef8c0259

To implement the feature on a project, the code can be implemented manually.
Alternatively, you can track my Pokeemerald Repository via git remote and then pull from the branch in which the commit is located, assuming your project is up-to-date with upstream (Pret's repository).

Ex:
Code:
git remote add lunos https://github.com/LOuroboros/pokeemerald
git pull lunos OneTimePurchase_TMsHMs

Bugs:
-For a single frame right after purchasing a TM, the buy menu overlaps the text box, reported by AsparagusEduardo on Discord
Fixed.

And that's pretty much it.​


EDIT:
Gen VIII style Premier Balls (Emerald)
There's a very, very small issue in your modification, it's definitely not super important but I think it's worth mentioning.
The msgbox shouldn't be flashing before the "Here you go!" message shows up.

Vanilla:
wKMXaNE.gif


Your Task_ReturnToItemListAfterItemPurchase:
sl2Yn36.gif


This isn't really a Gen. 8 feature, btw. It started with LGPE which is widely considered a Gen. 7 game.
 
Last edited:
1,591
Posts
10
Years
  • Age 30
  • Seen Mar 20, 2024
There's a very, very small issue in your modification, it's definitely not super important but I think it's worth mentioning.
The msgbox shouldn't be flashing before the "Here you go!" message shows up.

Vanilla:
wKMXaNE.gif


Your Task_ReturnToItemListAfterItemPurchase:
sl2Yn36.gif


This isn't really a Gen. 8 feature, btw. It started with LGPE which is widely considered a Gen. 7 game.
Oh, I haven't played LGPE and didn't know that, will update the post. I'll look into the flashing issue too, thanks for pointing that out!
 

Lunos

Random Uruguayan User
3,113
Posts
15
Years
Let a Pokémon forget any move they know (Emerald)

As you all know, there's certain moves that a Pokémon can't forget on their own, these are the Hidden Machine Moves.
There is a function which handles that, it's called CanReplaceMove and it can be found in the src/pokemon_summary_screen.c file.
By making this function always return a value of TRUE, we can let any Pokémon forget any of their moves at will.

To do this, let's open up the src/pokemon_summary_screen.c file and change the CanReplaceMove function from this:
Code:
static bool8 CanReplaceMove(void)
{
    if (sMonSummaryScreen->firstMoveIndex == MAX_MON_MOVES
        || sMonSummaryScreen->newMove == MOVE_NONE
        || IsMoveHm(sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex]) != TRUE)
        return TRUE;
    else
        return FALSE;
}

To this:
Code:
static bool8 CanReplaceMove(void)
{
    return TRUE;
}

Save, build a ROM and that's basically it.




Alternatively, we can instead remove this function and adjust the code where it's called from accordingly.
Thankfully, the CanReplaceMove function is only called in the Task_HandleReplaceMoveInput function, so basically we'd need to:
1) Remove the declaration of the CanReplaceMove function (Line 214 by default).
2) Remove the CanReplaceMove function (Lines 2210 to 2218 by default).
3) Adjust the if check of the Task_HandleReplaceMoveInput function where CanReplaceMove is called, changing it from this:
Code:
            else if (gMain.newKeys & A_BUTTON)
            {
                if (CanReplaceMove() == TRUE)
                {
                    StopPokemonAnimations();
                    PlaySE(SE_SELECT);
                    sMoveSlotToReplace = sMonSummaryScreen->firstMoveIndex;
                    gSpecialVar_0x8005 = sMoveSlotToReplace;
                    BeginCloseSummaryScreen(taskId);
                }
                else
                {
                    PlaySE(SE_HAZURE);
                    ShowCantForgetHMsWindow(taskId);
                }
            }

To this:
Code:
            else if (gMain.newKeys & A_BUTTON)
            {
                StopPokemonAnimations();
                PlaySE(SE_SELECT);
                sMoveSlotToReplace = sMonSummaryScreen->firstMoveIndex;
                gSpecialVar_0x8005 = sMoveSlotToReplace;
                BeginCloseSummaryScreen(taskId);
            }

Quick Showcase:
gTMYk31.gif


And that's pretty much it.




EDIT: I completely forgot to link it here, but thespbgamer brought up a fair point in this thread about 3 months after I originally posted this.
The changes I present in this post don't cover the replacement of a move in battle, because I absolutely forgot that was a thing honestly.
Click here if you want to learn how to address that.

EDIT2: And just as I finish editing this post, Jaizu is telling me that I also forgot to mention the removal of a move after evolution.
Just go to src/evolution_scene.c and remove the 2 if statements that call the IsHMMove2 function.
That means you have to do something like this:
Spoiler:

As evidenced by git grep "IsHMMove2", the function is not used anywhere else, so y'all can safely remove it if you want to.
 
Last edited:

Jaizu

Average rom hacker
282
Posts
14
Years
If you want to remove the contest movs tab in the summary screen (and being able to easily restore them later) you just have to modify src/pokemon_summary_screen.c
In the function ShowPokemonSummaryScreen there is this code 3 times:
Code:
sMonSummaryScreen->maxPageIndex = PSS_PAGE_COUNT - 1;
We just have to change - 1 to - 2 in all three cases, like this
Code:
    case PSS_MODE_BOX:
        sMonSummaryScreen->minPageIndex = 0;
        sMonSummaryScreen->maxPageIndex = PSS_PAGE_COUNT - 2; // It was -1
        break;
    case PSS_MODE_LOCK_MOVES:
        sMonSummaryScreen->minPageIndex = 0;
        sMonSummaryScreen->maxPageIndex = PSS_PAGE_COUNT - 2; // It was -1
        sMonSummaryScreen->lockMovesFlag = TRUE;
        break;
    case PSS_MODE_SELECT_MOVE:
        sMonSummaryScreen->minPageIndex = PSS_PAGE_BATTLE_MOVES;
        sMonSummaryScreen->maxPageIndex = PSS_PAGE_COUNT - 2; // It was -1
        sMonSummaryScreen->lockMonFlag = TRUE;
        break;
 
239
Posts
8
Years
  • Age 31
  • Seen Apr 15, 2024
[Pokeemerald] Stair Warps

This feature ports the stair warping effect from FRLG to Emerald:
(sorry for the bad tiles)
q9SzXmW.gif


Options:
 
239
Posts
8
Years
  • Age 31
  • Seen Apr 15, 2024
[Pokeemerald] Disable Catching Pokemon & Disable Bag Use In Battle

These are pretty simple. Each uses a flag to disable the respective feature. The wiki posts are linked.

Be sure to clear the flags in Overworld_ResetStateAfterWhiteOut if you want them to be cleared when you lose a battle!

Disable Bag Use:
IaSvW30.png


Disable Catching:
fm2Q6Ds.png
 
Last edited:
239
Posts
8
Years
  • Age 31
  • Seen Apr 15, 2024
[Pokeemerald] Fix Surf Dismount Ground Effects

This fixes a pretty subtle oversight by Gamefreak - when dismounting a surf blob, the player's ground effects are not updated, which can look weird.

Before: and After:
tzppyWl.gif
0VdHg2d.gif


It's a very simple fix. Here's the wiki post on how to fix it.
 
Last edited:
Back
Top