• 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
[Pokeemerald] Hidden Power type in summary screen

What's left to do:
- Add support to show the right type inside a battle
Following your lead, that was pretty easy to do.

Make the game read the dynamic type of Hidden Power in battles (Em)
To be honest, this is something I already tried to look into, but none of the things I tried worked.
After seeing Jirachii's post, I decided to take a stab at it once more and learning from their implementation, I was able to successfully pull it off.

The changes are done in the MoveSelectionDisplayMoveType function located in the src/battle_controller_player.c file.
We calculate Hidden Power's dynamic type normally, store the result in a variable called type and then copy the Type Name string of said type instead of the Type Name string of its true type.
Untitled3190.png


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

And that's pretty much it.​
 
20
Posts
8
Years
  • Age 41
  • Seen Nov 9, 2022
Showing IVs/EVs in Summary Screen [EM]

All of the code for this belongs in src\pokemon_summary_screen.c.

Search for static void Task_HandleInput(u8 taskId), and add these else if statements at the end of the method:
Spoiler:

This snippet needs to be placed after the "else if (JOY_NEW(B_BUTTON))" statement in that method not at the end of the method (inside the last bracket before the end bracket).
It should look like this:
Spoiler:

Also I looked into the code
Spoiler:
and it seems to make "gMain.newKeys & R_BUTTON" obsolete ...depreciated? outdated? I don't looks like the current commit uses "JOY_NEW(button)" now?
 
Last edited:
20
Posts
8
Years
  • Age 41
  • Seen Nov 9, 2022
"Move Pokémon" as first PSS option [EM]
WTwxHm8.png

Please don't use this until I fix a softlock when choosing the "Deposit Pokémon" option. Sorry for the inconvenience ^^;

In "src/pokemon_storage_system.c", change the order of this:
Spoiler:

and this:
Spoiler:

and below switch(task->data[2]) in Task_PokemonStorageSystemPC change these two:
Spoiler:

I didn't have any softlocks when I implemented this.
Spoiler:
 
98
Posts
6
Years
I didn't have any softlocks when I implemented this.
Spoiler:

Seems like it works just fine, applied it myself and no softlock. Maybe an update in pokeemerald itself fixed it automatically, not sure but yeah it's working just fine (I followed the exact steps as in the post about the patch).

Following your lead, that was pretty easy to do.

Spoiler:

Thanks sir, you are a legend!
 
11
Posts
5
Years
[Pokeemerald] Hidden Power type in summary screen

What's left to do:
- For people who use the old power calculation, show the right power as well (but I changed Hidden Power to gen VI+ where it's always 60 base power)

To add onto this impromptu Hidden Power collab, I've got the last part covered.

[Pokeemerald] Have the game display Hidden Power's true base power (for pre - Gen VI power calculations)

Just one function needs changing. I looked at what Jirachii did with the type and imitated that, but using the calculation for power instead.

In src/pokemon_summary_screen.c, look for static void PrintMovePowerAndAccuracy(u16 moveIndex). Replace what is there with the below code:
Code:
static void PrintMovePowerAndAccuracy(u16 moveIndex)
{
   	struct Pokemon *mon = &sMonSummaryScreen->currentMon;
    	u16 species = GetMonData(mon, MON_DATA_SPECIES);
     	const u8 *text;
     	if (moveIndex != 0)
     	{
         	FillWindowPixelRect(PSS_LABEL_WINDOW_MOVES_POWER_ACC, PIXEL_FILL(0), 53, 0, 19, 32);
		
		if (moveIndex == MOVE_HIDDEN_POWER)
		{
		 	u8 powerBits = ((GetMonData(mon, MON_DATA_HP_IV) & 2) >> 1)
             	 	 | ((GetMonData(mon, MON_DATA_ATK_IV) & 2) << 0)
             	 	 | ((GetMonData(mon, MON_DATA_DEF_IV) & 2) << 1)
              	 	 | ((GetMonData(mon, MON_DATA_SPEED_IV) & 2) << 2)
              	 	 | ((GetMonData(mon, MON_DATA_SPATK_IV)& 2) << 3)
             	 	 | ((GetMonData(mon, MON_DATA_SPDEF_IV) & 2) << 4);
			  
			u8 powerForHiddenPower = (40 * powerBits) / 63 + 30;
			  
			ConvertIntToDecimalStringN(gStringVar1, powerForHiddenPower, STR_CONV_MODE_RIGHT_ALIGN, 3);
			text = gStringVar1;
		}
		else
		{
			if (gBattleMoves[moveIndex].power < 2)
			{
				text = gText_ThreeDashes;
			}
			else
			{
				ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveIndex].power, STR_CONV_MODE_RIGHT_ALIGN, 3);
				text = gStringVar1;
			}
		}
       
         	PrintTextOnWindow(PSS_LABEL_WINDOW_MOVES_POWER_ACC, text, 53, 1, 0, 0);

         	if (gBattleMoves[moveIndex].accuracy == 0)
         	{
            	  	text = gText_ThreeDashes;
         	}
        	else
         	{
             	 	ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveIndex].accuracy, STR_CONV_MODE_RIGHT_ALIGN, 3);
             	 	text = gStringVar1;
         	}

         	PrintTextOnWindow(PSS_LABEL_WINDOW_MOVES_POWER_ACC, text, 53, 17, 0, 0);
     	}
}

Basically what we do is, after checking that the move isn't MOVE_NONE (aka a moveIndex of 0), check if the move is Hidden Power. If so, calculate its power using Hidden Power's special formula, store it in a variable, convert it to a string, and store the string in the variable used for displaying a move's power. If the move isn't Hidden Power, then the function does the stuff it does prior to being edited. After that, the move's power is printed and the function then goes on to display the accuracy.

Sample Image:
24a581002c5645530a4315b015d746e9e3b4fb93.png

Natu has Poison-type Hidden Power with a base power of 48.
 
Last edited:

Subzero Eclipse

Because I say so.
24
Posts
6
Years
  • Age 31
  • Seen Mar 4, 2023
[Pokeemerald] Fully functional debug menu with Flags, Vars, Items, Pokemon and more!
This is my implementation of a debug menu based on Ketsuban's tutorial and some code from Pyredrid, AsparagusEduardo and Ghoulslash.
Tc9Ydjz.gif


Features:
Spoiler:


How to:
Add and clone it into your repo:
Code:
git remote add xaman https://github.com/TheXaman/pokeemerald/
git pull xaman tx_debug_system
make clean
make debug


Access ingame:
From now one if you want the menu to show up you have to run your make command with the addition parameter: debug or debug _modern, for example make debug -j8. Those parameters already include DINFO=1.
To access ingame press R + Start.



That it, now enjoy and if you find any bugs or if you write some cool additions you think others could profit from, please let me know in this threat, via pm or over on github!


Credits: If you use this, you have to give credit to all following people!
TheXaman
Ketsuban
Pyredrid
AsparagusEduardo
Ghoulslash
exposneed

This debug menu is awesome and I have been using it since you first posted; there's a little issue if used in tandem with the rhh expansions though, specifically the pokemon_expansion one. The reason is that they axed the special Deoxys handling that is checked by some functions of src/debug.c; I managed to solve it and build the ROM by just deleting ,TRUE in the lines 1597, 1635 and 1683.
 
49
Posts
5
Years
  • Age 29
  • Seen Dec 27, 2023
This debug menu is awesome and I have been using it since you first posted; there's a little issue if used in tandem with the rhh expansions though, specifically the pokemon_expansion one. The reason is that they axed the special Deoxys handling that is checked by some functions of src/debug.c; I managed to solve it and build the ROM by just deleting ,TRUE in the lines 1597, 1635 and 1683.

Happy to hear that and thank you for pointing it out, just pushed a quick fix:

Code:
    #ifndef POKEMON_EXPANSION
        gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create pokemon sprite
    #endif
    #ifdef POKEMON_EXPANSION
        gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite
    #endif
 
50
Posts
13
Years
[Pokéemerald] - Register pokémon you battle at the Battle Frontier in the Pokédex

This also works for e-reader, link, recorded, and Trainer Hill battles.

At src/battle_main.c search and comment/delete the following:

static void BattleIntroDrawTrainersOrMonsSprites(void):

Spoiler:

static void BattleIntroRecordMonsToDex(void):

Spoiler:

Finally at src/battle_script_commands.c search and comment/delete the following:

static void Cmd_switchinanim(void):

Spoiler:
 
Last edited:

Subzero Eclipse

Because I say so.
24
Posts
6
Years
  • Age 31
  • Seen Mar 4, 2023
Improved Editing Trainer Parties [EM]

Provides control over most aspects of NPC trainers and homogenizes party types. Based off part of Syreldar's hack. Thanks to UltimaSoul for helping me get it to work.

How to use:

Code:
git remote add surskitty https://github.com/surskitty/pokeemerald
git pull surskitty trainer_control

src/data/trainer_parties.h will need all structs changed to TrainerMon and src/data/trainers.h needs to have .TrainerMon instead of .NoItemDefaultMoves et al. Those are both already applied to vanilla, but if you've done substantial edits, keep your versions and then do the find-replace to change structs and .party type.

More detailed usage notes are over here.

.gender and .nature should be set together. Nature needs to be non-Hardy for a pokemon to be guaranteed male.

I've done some testing, but if there's some other bugs, sorry about that.

There is an issue if used with the battle_engine: in the file src/battle_tower.c there is a block(that controls the multi-battle partner feature, I suppose) inside the function FillPartnerParty that still uses the old structs like TrainerMonNoItemCustomMoves, etc. that in your branch have been fused into TrainerMon. Hence the compiler does not accept them, I tried to do something myself but I'm not too sure on how to do that :\
 
11
Posts
3
Years
  • Age 33
  • Seen Jul 12, 2021
There is an issue if used with the battle_engine: in the file src/battle_tower.c there is a block(that controls the multi-battle partner feature, I suppose) inside the function FillPartnerParty that still uses the old structs like TrainerMonNoItemCustomMoves, etc. that in your branch have been fused into TrainerMon. Hence the compiler does not accept them, I tried to do something myself but I'm not too sure on how to do that :\
Thanks, I just went and built that in. :)
 
49
Posts
5
Years
  • Age 29
  • Seen Dec 27, 2023
[Pokeemerald] Improved scrolling options menu with faster text, HP and EXP bar speeds and a metric unit option!
This is an improved options menu with the ability to scroll for more than the standard amount of options, developed by DizzyEgg.
JgAsm1D.gif



Features:
ds2G4vh.gif

Text speed: Slow, Mid, Fast, Fatser (based on the work of ella_trifle)
Unit system: Metric, Imperial
HP bar speed: 0-10(instant)
Exp bar speed: 0-10(instant)


How to:
Code:
git remote add xaman https://github.com/TheXaman/pokeemerald/
git pull xaman tx_optionsPlus
make clean



Warning:
This implementations slighty changes SaveBlock2, but I've been extra carefull and as far as I can tell no problems with old savegames should occure.


I hope you enjoy and if you find any bugs, please let me know in this threat, via pm or over on github!


Credits: If you use this, you have to give credit to all following people!
DizzyEgg
Lunos
AsparagusEduardo
ella_trifle
 
Last edited:
853
Posts
3
Years
  • Age 33
  • Seen Nov 9, 2023
OK, I can't tell you how proud I am to finally have something worth contributing to one of these research/development threads.
But today I bring you a fix to make shedinja a good pokemon.

So those that know shedinja, know it sucks because its base hp stat is stuck at one never increasing.

I have a fix for that. I did mine in cfru, but I imagine it should work for pokefirered and pokeemerald or anything else as well.

for cfru this is done in the file build_pokemon.c

for regular decomps its just the pokemon.c file.

What you need to do is search for all instances of
#ifdef species_Shedinja

there should be 2, within the file.

So reading the function there you can tell that shedinja's hp is limited because, shedinja literally has its own hp calc function.

The fix is to make that work on the ability WonderGuard instead. so what you need to do is replace

#ifdef Species_Shedinja with #ifdef ABILITY_WONDERGUARD

next step
on the line under both #ifdefs you'll see
if (species == SPECIES_SHEDINJA)

we need to replace those as well. we replace it with,

if (GetMonAbility(mon) == ABILITY_WONDERGUARD)


So the code should now look like this,

Code:
	#ifdef ABILITY_WONDERGUARD
	if (GetMonAbility(mon) == ABILITY_WONDERGUARD)

But you can change it to literally any ability at this point, if you want shedinja to just operate as a normal pokemon I recommend changing it to illuminate.

Illuminate Raises the likelihood of meeting wild Pokémon. I'm sure not many would miss that ability.

Then just use any program to change shedinja's base hp stat.


Well that's it a simple two step change and shedinja is a good pokemon; for sake of balance I recommend keeping their base hp on the low side. For reference the lowest base stat hp in the game is for shuckle at 20.

Thanks to both anon822 and Mklok103, for tips, getting me started on decomp etc.



quick edit, I'm relatively new to decomp so in case these changes are important I want to make sure everything is included.
To make sure the file can find and define the ability I added abilities.h from the include/constants folder to the list of includes at the top of the file.

I also listed the type for ability, at the bottom of the main function that #ifdef Species_Shedinja is in, shown below (I added u8 ability; )

Spoiler:

also normally evs are u8 if you're just copying what I have, your evs should not be u16.

Ok I think that's everything.


edit edit:
so looking at the ability table, if you don't want to waste illuminate you could probably change it to work on ability_none, that way shedinja works, and no pokemon is made less viable.
Haven't yet tested it, but no reason it shouldn't work.
 
Last edited:
10
Posts
4
Years
Oh huh, guess I totally forgot the battle_move_effects include. Thanks!

There is a bug regarding the battle type effectiveness in doubles.

enemy team, geodude, mudkip

my team: goldeen, bellsprout

if i use goldeen's water gun on geodude it will be green, but if i faint it the next turn water gun will still be green even though it's not very effective on the mudkip.
In that case I need to click it and select the mudkip to update its effectiveness to red.

There are 2 solutions:
1. don't display effectiveness of a move in doubles until a move and a target is selected (don't show any effectiveness on moves that hit multiple targets ofc).
2. try to update the possible target instantly, before even selecting the move.
 
1
Posts
3
Years
[Pokeemerald] Changing encounter groups with map scripts

Porymap makes it easy to add new encounter groups to a map. This is a little guide on how to utilize and switch encounter groups with map scripts.

1. Add a new encounter group to a map
I'd recommend doing this in Porymap (as seen in the link above), but basically you add a new encounter table for the map with a new base label in src/data/wild_encounters.json. In my case, I decided to add a new encounter group to Route 111, with Pokémon intended to be encountered in tall grass in the southern section of the map.

2. Add a new var in include/constants/vars.h
This new var will be used to determine which encounter group gets used for the map. I decided to use one of the unused vars.
Code:
[COLOR="Red"]-#define VAR_UNUSED_0x404E                    0x404E // Unused Var[/COLOR]
[COLOR="Green"]+#define VAR_ROUTE111_WILD_SET                0x404E[/COLOR]


3. Update GetCurrentMapWildMonHeaderId in src/wild_encounter.c
This function handles which pokémon encounters to load on a map. By default, it doesn't take into consideration if a map has multiple encounter groups and only use the first one defined for a map. In vanilla pokeemerald, only Altering Cave has multiple encounter groups, so it has it own check to load the appropriate encounter group. A similar check has to be added for the map with newly added encounter groups.
Code:
static u16 GetCurrentMapWildMonHeaderId(void)
{
    u16 i;

    for (i = 0; ; i++)
    {
        const struct WildPokemonHeader *wildHeader = &gWildMonHeaders[i];
        if (wildHeader->mapGroup == 0xFF)
            break;

        if (gWildMonHeaders[i].mapGroup == gSaveBlock1Ptr->location.mapGroup &&
            gWildMonHeaders[i].mapNum == gSaveBlock1Ptr->location.mapNum)
        {
[COLOR="Green"]+            if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(ROUTE111) &&
+                gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE111))
+                i += VarGet(VAR_ROUTE111_WILD_SET);
+
[/COLOR]            if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(ALTERING_CAVE) &&
                gSaveBlock1Ptr->location.mapNum == MAP_NUM(ALTERING_CAVE))
            {
                u16 alteringCaveId = VarGet(VAR_ALTERING_CAVE_WILD_SET);
                if (alteringCaveId > 8)
                    alteringCaveId = 0;

                i += alteringCaveId;
            }

            return i;
        }
    }

    return -1;
}

4. Add map scripts that changes the encounter group var
You can now switch encounter groups by using the setvar script command in a map script and setting the encounter group var to the corresponding value of the desired encounter group.
Code:
setvar VAR_EXAMPLE_NAME, [I]n[/I]
0 is the value for the first encounter group, 1 for the second group etc.

A simple option would be to add new map trigger scripts to act as switches for the var.
Code:
Map_EventScript_WildSet1Trigger::
	setvar VAR_EXAMPLE_NAME, 0
	end

Map_EventScript_WildSet2Trigger::
	setvar VAR_EXAMPLE_NAME, 1
	end

But you can let your imagination free on how to actually switch the encounter group. For example, this can be used as a way of to increase levels of Pokémon in the area after battling a trainer or legendary Pokémon.

In my case, I settled on taking advantage of the pre-existing weather scripts on Route 111. Basically, the grass encounters get set when clear weather appears, and the desert encounters get set when a sandstorm appears.
Code:
Route111_EventScript_CheckSetSandstorm:: @ 81F0DE6
	getplayerxy VAR_TEMP_0, VAR_TEMP_1
	compare VAR_TEMP_1, 34
	goto_if_lt Route111_EventScript_EndCheckSetSandstorm
	compare VAR_TEMP_1, 107
	goto_if_gt Route111_EventScript_EndCheckSetSandstorm
	compare VAR_TEMP_1, 72
	goto_if_gt Route111_EventScript_SetSandstorm
	compare VAR_TEMP_0, 2000
	goto_if_gt Route111_EventScript_EndCheckSetSandstorm
	compare VAR_TEMP_0, 8
	goto_if_lt Route111_EventScript_EndCheckSetSandstorm
Route111_EventScript_SetSandstorm:: @ 81F0E22
	setweather WEATHER_SANDSTORM
[COLOR="Green"]+	setvar VAR_ROUTE111_WILD_SET, 1
+	return
+
[/COLOR]Route111_EventScript_EndCheckSetSandstorm:: @ 81F0E25
[COLOR="Green"]+	setvar VAR_ROUTE111_WILD_SET, 0[/COLOR]
	return

Code:
Route111_EventScript_SunTrigger:: @ 81F0FB0
	setweather WEATHER_SUNNY
	fadenewbgm MUS_ROUTE110
	doweather
	setvar VAR_TEMP_3, 0
[COLOR="Green"]+	setvar VAR_ROUTE111_WILD_SET, 0[/COLOR]
	end

Route111_EventScript_SandstormTrigger:: @ 81F0FBD
	setweather WEATHER_SANDSTORM
	fadenewbgm MUS_ROUTE111
	doweather
[COLOR="Green"]+	setvar VAR_ROUTE111_WILD_SET, 1[/COLOR]
	end

That's pretty much it!
PS. This is the first time I've tried write a guide like this, so I'm sorry if it is unclear or otherwise rough around the edges. 😅
 

Attachments

  • Rt111Grass.gif
    Rt111Grass.gif
    424.8 KB · Views: 92
  • Rt111Desert.gif
    Rt111Desert.gif
    523.7 KB · Views: 73

Lioniac

High-level Language Developer trying to learn ASM
13
Posts
6
Years
  • Age 35
  • Seen Nov 13, 2021
[Pokeemerald] Bag Sorting

This feature adds bag sorting by the following:
  • Name (alphabetical)
  • Quantity (most -> least)
  • Type (see gItemsByType)

Here is the repo.

How to Activate: Press the Start Button in the bag.

Credit:
  • Skeli / CFRU source

[Pokefirered] Pokeemerald Bag Sort Ported (Credit: ghoulslash)

With ghoulslash guidance (Thanks!), I finally ported this to pokefirered.
Same activation method: Press Start in the bag.

giphy.gif


Instructions: https://github.com/lioniac/pokefirered/commit/a46c37af34d913019589abe14b5ecb49c22f5484
 
Last edited:

Lioniac

High-level Language Developer trying to learn ASM
13
Posts
6
Years
  • Age 35
  • Seen Nov 13, 2021
Last edited:

Lioniac

High-level Language Developer trying to learn ASM
13
Posts
6
Years
  • Age 35
  • Seen Nov 13, 2021
Last edited:

Lioniac

High-level Language Developer trying to learn ASM
13
Posts
6
Years
  • Age 35
  • Seen Nov 13, 2021
Editing Default Options Settings
If you open "src\new_game.c" you'll come across this:

L7JcDgm.png


These are the attributes you can change from the "Options" window in the start menu - text speed, the menu frame, battle style (set/shift) etc. Having the text speed automatically set to fast is something I'd recommend to everyone, since going straight to the options menu and changing it is one of the first things a lot of people do in-game!

This also works for [pokefirered]. Please update the "index" post.
 
Last edited:
Back
Top