• 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

Lunos

Random Uruguayan User
3,114
Posts
15
Years
Adding the Fairy Type (Em)
I was bored, so I inserted the Fairy Type in a clean copy of Pokeemerald. Do I need to say anything else?
Hopefully, this can work as a template to learn how to insert entirely new types from.

The changes can be checked in this diff:
https://github.com/pret/pokeemerald/compare/master...LOuroboros:pokeemerald:fairy_type

To quickly incorporate it into a project, you just have to track my repository via git remote and pull the branch where I did the modifications using git pull, like so:
Code:
git remote add lunos https://github.com/LOuroboros/pokeemerald
git pull lunos fairy_type

Pics:
untitled4101-png.4832

Note: I only changed the type of Pound locally. It's not like that in the commit, though that's something everyone can see.

And that's pretty much it.​
 
Last edited:
239
Posts
8
Years
  • Age 31
  • Seen Apr 15, 2024
It's been a while since I've posted anything, so here's a small feature from fire red:

[Pokeemerald] Auto-read signposts

This feature allows the player to read a signpost by walking up to it, rather than needing to press A. The player is also able to walk away while the script is running.

erBt0nr.gif


How to add more signposts:
  • Currently, your tile must have behavior "MB_SIGNPOST" in order for this feature to work. Keep reading if you want to add new behaviors that the player can auto-read from
  • You can add a new signpost type based on these defines
  • Add your metatile behavior check here
  • Add your custom script in the switch statement here

How to add this feature:
 
239
Posts
8
Years
  • Age 31
  • Seen Apr 15, 2024
Uniquely Shuffle Arrays

This is a generic function to shuffle an array of values, for example species. It could be good for randomizers, challenge options, etc.

Check out the wiki post
 

colonelsalt

Guaranteed to raise the smile
111
Posts
11
Years
[Pokéfirered] Remove FRLG item use animation screen

hpLhlEv.gif


The little animation screen that plays when you use an item on a Pokémon in the field (medicine, TM/HM, Rare Candy, evolution stone, berry) may have looked cute when it came out, but right around your 340th time seeing it you'll be reaching for the fast-forward button.

These changes remove the screen entirely, so item use looks identical to RSE: https://github.com/pret/pokefirered/commit/b5cc9eb7bc167be1ee300e74bee0a49abf452fae
(Handy if you plan on also adding "repeated medicine use".)
 
7
Posts
3
Years
  • Age 32
  • Seen Dec 26, 2023
[EM] ADDING EVs TO TRAINERS

This tutorial will allow you to add EV values to any trainers you wish.
Spoiler:
Spoiler:


I'd just like to add on to this a little bit if I can. Adding abilities for trainers is very similar.

In include/data.h, you'll need to add u8 ability; to the trainer structs of your choice (I only did it in this one)
Code:
struct TrainerMonItemCustomMoves
{
    u16 iv;
    u8 lvl;
    u8 evs[NUM_STATS];
    u16 species;
    u16 heldItem;
    [B][COLOR="Red"]u8 ability;[/COLOR][/B]
    u16 moves[MAX_MON_MOVES];
};

Then in src/battle_main.c, you'll need to add this line
Code:
            case F_TRAINER_PARTY_CUSTOM_MOVESET | F_TRAINER_PARTY_HELD_ITEM:
            {
                const struct TrainerMonItemCustomMoves *partyData = gTrainers[trainerNum].party.ItemCustomMoves;

                for (j = 0; gSpeciesNames[partyData[i].species][j] != EOS; j++)
                    nameHash += gSpeciesNames[partyData[i].species][j];

                personalityValue += nameHash << 8;
                fixedIV = partyData[i].iv * 31 / 255;
                CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, OT_ID_RANDOM_NO_SHINY, 0);

                SetMonData(&party[i], MON_DATA_HELD_ITEM, &partyData[i].heldItem);

                [B][COLOR="Red"]SetMonData(&party[i], MON_DATA_ABILITY_NUM, &partyData[i].ability);[/COLOR][/B]

                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);
                }
                for (j = 0; j < NUM_STATS; j++)
                {
                    SetMonData(&party[i], MON_DATA_HP_EV + j, &partyData[i].evs[j]);
                }
                CalculateMonStats(&party[i]);
                break;
            }

You have to add it to all the applicable trainer parties now....yay~
0 will be it's first ability, 1 it's second (or hidden if it doesn't have a second), and 2 hidden (if it has two other abilities).
Code:
static const struct TrainerMonItemCustomMoves sParty_WallyMauville[] = {
    {
    .iv = 0,
    .lvl = 5,
    .evs = {0, 0, 0, 0, 0, 0},
    .species = SPECIES_RALTS,
    .heldItem = ITEM_NONE,
    [B][COLOR="Red"].ability = 1;[/COLOR][/B] // gives Ralts the ability Trace
    .moves = {MOVE_GROWL, MOVE_CONFUSION, MOVE_NONE, MOVE_NONE}
    } 
};

I hope this helps for people who want to add extra challenge in their games.
 
Last edited:
441
Posts
6
Years
  • Age 37
  • Seen today
Custom Battle Music Via Scripting (Emerald / Firered)

This modification allows you to set any song to play during the next battle from a script.
Spoiler:
 
11
Posts
3
Years
  • Age 33
  • Seen Jul 12, 2021
Implement a metatile behavior for Feebas encounters (Emerald)

A very simple little tweak.

https://github.com/surskitty/pokeemerald/commit/fea41dbc7a8620782b1c1a67f60db6aaddca46c1

You can then use Porymap to edit Route 119, make a new tile with the behavior MB_FEEBAS, and use that tile to set that as the location for Feebas.

In ORAS, Feebas are found under the bridge next to the Weather Institute during the daytime, and by the rock in the water at the southern end of Route 119 during the night.

Code:
git remote add surskitty https://github.com/surskitty/pokeemerald
git cherry-pick fea41dbc7a8620782b1c1a67f60db6aaddca46c1
 
441
Posts
6
Years
  • Age 37
  • Seen today
Display Mugshots/Other Images In The Overworld (Emerald / Firered)

This modification allows you to load images onto BG0 from a script. It can only show one 16-color image at a time.
53dUjef.png
XVCLIMD.png


1. Installation
Spoiler:


2. Adding new mugshots
Spoiler:


3. Using mugshots in a script
Spoiler:
 
Last edited:
239
Posts
8
Years
  • Age 31
  • Seen Apr 15, 2024
[Pokeemerald]Spawn an invisible Player

This feature lets us use a flag to spawn the player invisible after warping, which is useful for cutscenes (using a flag instead of requiring messy map scripts)

see the wiki post here
 
1,403
Posts
10
Years
  • Seen today
Code:
void DrawMugshot();
void DrawMugshotAtPos();
void ClearMugshot();
Hiya, I guess you're a C++ programmer. Unlike C++ where empty parens mean "no parameters", in C what you've written is prototypes that can take any arguments at all (think something like how ... is used by printf). You'd want to write, e.g. void DrawMugshot(void);. (It's not going to break anything if you don't, but it's pretty bad style and can mask errors when you get it wrong in header files!)
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
Locktarget Overworld scripting command (Em)
About an hour ago, SBird in Pret's Discord server brought up how the lock scripting command locks the movement of all the event objects on screen instead of just locking the event object that the Player is interacting with.
I decided to take a stab at it since it sounded like a fairly easy thing to address.

The changes can be checked in this commit:
https://github.com/LOuroboros/pokeemerald/commit/05f57351a0cf8a97134d7ef5067d4e68aab5bb1c

To quickly incorporate it into a project, you just have to track my repository via git remote and pull the branch where I did the modifications using git pull, like so:
Code:
git remote add lunos https://github.com/LOuroboros/pokeemerald
git pull lunos locktarget

Note: Depending on the feature branches you use in your project, you may need to adjust some of these values.
For example, if you added other new scripting commands to your project you'll need to change the internal ID of locktarget from 0xe3 to something else.


Pic:
FUuUwt3.gif


And that's pretty much it.​
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
Making Pokémon with Poison Heal be unaffected by poison in the overworld (Em)
Note: Poison Heal is an ability introduced in Gen. 4 and it's naturally not present in Pokemon Emerald by default.
This is mainly an optional thing you can add to projects that make use of DizzyEgg's battle_engine.


Earlier, Meister_anon from this forums' Discord server asked some tips because they wanted to make Pokémon with the Poison Heal ability not be affected by poison in the overworld, an effect that should have been implemented in the official games since its introduction, imo.
I decided to take a stab at it since it sounded like a fairly easy thing to do.

There are no commits this time. I won't make a branch because it's so utterly simple it doesn't warrant making one.
All you need to do is to go to the DoPoisonFieldEffect function in src/field_poison.c, and add the following check to the first if statement inside the for loop:
Code:
&& GetMonAbility(&gPlayerParty[i]) != ABILITY_POISON_HEAL

Don't forget to throw in a #include "pokemon.h" and a #include "constants/abilities.h" at the end of the header files list at the top of the file.
src/field_poison.c can't recognize constant labels for species abilities nor the GetMonAbility function by default.

Video:


And that's pretty much it.

EDIT (28/08/2023): I updated the post. I forgot to mention that include/pokemon.h has to be #included too.​
 
Last edited:
853
Posts
3
Years
  • Age 33
  • Seen Nov 9, 2023
Excluding pokemon with Ability POISON_HEAL from overworld poison damage.

I started it, but most credit goes to Lunos, for the fix.

This works for all decomps far as I can tell, I've checked poke-emerald and poke-firered
this change goes in the field_poison.c file

Screenshot (1276).png
 
1,591
Posts
10
Years
  • Age 30
  • Seen Mar 20, 2024
Remove the need to water berries on rainy Routes (Emerald)

Ever watered berry trees in the thunderstorm on Route 119 and thought "this makes no sense"?

This little tweak will make any berry trees on specified routes give out their maximum number of berries all the time, as if the weather watered them for you!

Go to src\berry.c and find the function named GetBerryCountByBerryTreeId().
Replace it with the following:
Code:
static u8 GetBerryCountByBerryTreeId(u8 id)
{
    struct BerryTree *tree = GetBerryTreeInfo(id);
    const struct Berry *berry = GetBerryInfo(tree->berry);
    u16 currentMap = gMapHeader.regionMapSectionId;

    if (currentMap == MAPSEC_ROUTE_119 || currentMap == MAPSEC_ROUTE_120 || currentMap == MAPSEC_ROUTE_123)
        return berry->maxYield;
    else
        return gSaveBlock1Ptr->berryTrees[id].berryYield;
}
Then you'll probably need to add #include constants/map_groups.h at the top of src\berry.c so the compiler recognizes the map names.

The maps used here are just examples, so you can change them to whatever condition you want.
 
Last edited:
441
Posts
6
Years
  • Age 37
  • Seen today
Prevent Map Fade With A Flag (Emerald)

This modification allows you to stop the screen from fading after loading a map - useful for cutscenes.

EJ4VfgW.gif


Spoiler:
 
441
Posts
6
Years
  • Age 37
  • Seen today
Moderator notice:
We highly recommend reviewing the pokeemerald tutorials at the pokeemerald wiki, viewable here, as they are much more regularly maintained:
https://github.com/pret/pokeemerald/wiki/Tutorials

––––
Original post follows:

I noticed that despite being updated recently, the starting post is missing quite a few older modifications.
Here is a list of them:

Spoiler:


Update: Now contains modifications up to page 17
 
Last edited by a moderator:
853
Posts
3
Years
  • Age 33
  • Seen Nov 9, 2023
Greetings everyone, I've got a pretty desirable fix I think, with credit and thanks to Buffel Saft, for helping me understand the function, I was able to figure a simple way of adding fairy type to hidden power.

It's just a simple C trick but this should work for firered and leaf green. Emerald doesn't seem to have mystery type so unfortunately this wouldn't work for it.

in pokefirered there's a line of code that essentially says, if hidden power type is greater or equal to type mystery add 1. (this is to remove mystery type from pool of possible results.

Code:
if (gBattleStruct->dynamicMoveType >= TYPE_MYSTERY)
  gBattleStruct->dynamicMoveType++;
the ++ is the plus 1.

now from messing around with effect spore I learned a trick of replacing an effect by setting it equal to another field. And that's what I did to get fairy in.
I replaced the above with this...

Code:
if (gBattleStruct->dynamicMoveType == TYPE_MYSTERY)
  gBattleStruct->dynamicMoveType = TYPE_FAIRY;
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
Greetings everyone, I've got a pretty desirable fix I think, with credit and thanks to Buffel Saft, for helping me understand the function, I was able to figure a simple way of adding fairy type to hidden power.

It's just a simple C trick but this should work for firered and leaf green. Emerald doesn't seem to have mystery type so unfortunately this wouldn't work for it.

in pokefirered there's a line of code that essentially says, if hidden power type is greater or equal to type mystery add 1. (this is to remove mystery type from pool of possible results.

Code:
if (gBattleStruct->dynamicMoveType >= TYPE_MYSTERY)
  gBattleStruct->dynamicMoveType++;
the ++ is the plus 1.

now from messing around with effect spore I learned a trick of replacing an effect by setting it equal to another field. And that's what I did to get fairy in.
I replaced the above with this...

Code:
if (gBattleStruct->dynamicMoveType == TYPE_MYSTERY)
  gBattleStruct->dynamicMoveType = TYPE_FAIRY;
Emerald does have the Mystery Type. Every game up to HeartGold and SoulSilver have it, in fact, as it was removed in Black and White (1).
It's highly likely your modification will work on a clean copy of Pokeemerald normally, assuming Hidden Power's type can be set to Type Mystery normally.
 
Last edited:
1,403
Posts
10
Years
  • Seen today
Code:
if (gBattleStruct->dynamicMoveType == TYPE_MYSTERY)
  gBattleStruct->dynamicMoveType = TYPE_FAIRY;

I might be mistaken, but won't this basically replace Hidden Power Dark with Fairy?

My thinking is that before the numbers worked like this:
Code:
 i | i + 1
 9 | TYPE_FIRE (10)
10 | TYPE_WATER (11)
11 | TYPE_GRASS (12)
12 | TYPE_ELECTRIC (13)
13 | TYPE_PSYCHIC (14)
14 | TYPE_ICE (15)
15 | TYPE_DRAGON (16)
16 | TYPE_DARK (17)
But now that you've replaced ++ (i.e. + 1) with turning TYPE_MYSTERY (8) into TYPE_FAIRY (18) you get this:
Code:
 i | i == 8 ? 18 : i
 9 | TYPE_FAIRY (18)
10 | TYPE_FIRE (10)
11 | TYPE_WATER (11)
12 | TYPE_GRASS (12)
13 | TYPE_ELECTRIC (13)
14 | TYPE_PSYCHIC (14)
15 | TYPE_ICE (15)
16 | TYPE_DRAGON (16)

I think you both need to generate a number that's 1 bigger and remap TYPE_MYSTERY to TYPE_FAIRY to have all the types. This might actually be working on your thread? I saw you and Buffel Saft made some changes to how dynamicMoveType was calculated.
 
Back
Top