• 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
Make Poké Balls usable outside of battles [Em]
So, earlier, someone asked in RHH's Discord if it was possible to modify the caught ball of a certain Pokémon in the party at will.
Naturally, that's perfectly possible because the entire source code of the game is laid right before our very eyes and the code itself already does it.
Then Jaizu brought up a very neat suggestion; to make Poké Balls usable outside of battle to set the caught ball directly like that.
Honestly, that sounded very cool to me so I just went and did it.
And now that it's done, I came here to post it because why not.

I don't think there's a need for explanations. You go to the bag, try to use a Poké Ball and the magic happens. It's all pretty straightforward.


To implement this, you can track my GitHub repository via git remote and pull the branch oobBalls which is where I'm hosting the code:
Code:
git remote add lunos https://github.com/LOuroboros/pokeemerald
git pull lunos oobBalls
Or you can implement things manually, which is preferable for people who use the item_expansion:
https://github.com/pret/pokeemerald/compare/master...LOuroboros:oobBalls

And that's pretty much it.

Bugs:
-When using a Poké Ball in battles, the party screen opened before throwing the Poké Balls in projects built with the Pokeemerald-expansion (noticed by me when I tested things after reading this post)
Fixed: https://github.com/LOuroboros/pokeemerald/commit/d48c92cdc76cedc5adfdc877e36f2fb1397d5171
 
Last edited:
14
Posts
1
Years
  • Age 17
  • Seen Oct 21, 2023
Scroll Start Menu(Em)

If you want the start menu to contain more options, then this is a good choice!

git remote add maplefall https://github.com/s744865306fang/pokeemerald
git pull maplefall scroll_start_menu
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
Scroll Start Menu(Em)

If you want the start menu to contain more options, then this is a good choice!

git remote add maplefall https://github.com/s744865306fang/pokeemerald
git pull maplefall scroll_start_menu
I'm noticing a couple of things that could be corrected.
-The branch reverts a lot of the changes made on Pret's side that involve documentation/readability, like or example this, this or this, which is probably not a good idea.
Note that there's no benefit in doing that, on the contrary, it just makes the code harder to read with the parameters passed through function calls being numerical values that hold no apparent meaning.
-There's a lingering declaration of a StartMenuDexNavCallback function, probably coming from Ghoulslash's Dexnav branch, which the branch does not contain.

There's also issues In-Game though.
-Sometimes, if you open the start menu, enter one of the start menu options such as the Pokédex and then you back out, you can't move the cursor at all until you close and open the start menu again.
WmfZnDm.gif


-These changes make the game unable to remember the option that was last selected unlike it happens in vanilla. When you open the start menu with these changes, it always starts in "POKéDEX".
 
14
Posts
1
Years
  • Age 17
  • Seen Oct 21, 2023
I'm noticing a couple of things that could be corrected.
-The branch reverts a lot of the changes made on Pret's side that involve documentation/readability, like or example this, this or this, which is probably not a good idea.
Note that there's no benefit in doing that, on the contrary, it just makes the code harder to read with the parameters passed through function calls being numerical values that hold no apparent meaning.
-There's a lingering declaration of a StartMenuDexNavCallback function, probably coming from Ghoulslash's Dexnav branch, which the branch does not contain.

There's also issues In-Game though.
-Sometimes, if you open the start menu, enter one of the start menu options such as the Pokédex and then you back out, you can't move the cursor at all until you close and open the start menu again.
WmfZnDm.gif


-These changes make the game unable to remember the option that was last selected unlike it happens in vanilla. When you open the start menu with these changes, it always starts in "POKéDEX".

Now,I have fixed all problem except this:
There's also issues In-Game though.
-Sometimes, if you open the start menu, enter one of the start menu options such as the Pokédex and then you back out, you can't move the cursor at all until you close and open the start menu again.
WmfZnDm.gif
 

セケツ

ポケハック初心者
61
Posts
7
Years
  • Age 26
  • Seen today
[PokeEmerald] Recover the R-button's Letter changing function of the naming screen.

For someone who is more familiar with the Japanese Pokeemerald, he or she would have probably noticed that the R-button is not just as useless as that in English vesion when it comes to the naming screen: once pressing the R-button during the process of inputting letters, the last inputted letter will be changed between the Upper & the Lower case. Moreover, for the Japanese characters' inputting, it's the R-button's pressing that is also a quicker and faster way to input small, voiced & half-voiced kanas. As far as I know, this tiny & little function is not only presented in the Japanese Pokeemerald, but also in the Japanese Pokeruby & Pokesapphire (FRLG is NOT due to the help system), while was finally & completely removed & became absent in their all 3 English versions.
For anyone still dosen't know what I'm talking about, please take a look at the pictures below. Moreover, I also showed the side-by-side comparison which conveys the difference of the naming screen itself between Both Pokeemerald and Pokesapphire & both versions.

Spoiler:

Well, although there was no code & clue of this function left in the decomp files anymore, I still luckily figure out one possible way to recover it by editing the source file. Here is it below.

1. Open the "naming-screen.c" file laid in the src folder of the decomp files. And then add the separate definition of the R-button at the beginning of the code strings.

Spoiler:


2. Next, scroll down to the forward declaration of all the functions, and add a COMPLETELY NEW function for future use.
The name of this newly added function can be given freely, Hence, I used "ChangeCharacter" for instance in the picture below.

Spoiler:


3. Then, go to the function named "bool8 HandleKeyboardevent", which takes control of all the buttons used for the naming screen itself, and then add a new "else if" branch for the R-button containing the new function which had been declared in the previous step.

Spoiler:


4. After the previous step, jump to the function named "Input_Enabled", then insert another new "else if" branch for the R button in order to make it become available.

Spoiler:


5. Finally, find a place to paste & adjust the codes below freely. Remember to save your file before you make & test your ROM.

Spoiler:


And here is the result, what's more, to make more characters can be changed by this function. you can add more "else if" branch into it just simply by copying, pasting and adjusting the range of one single branch.

Spoiler:


Edit:
Since the function was added, the blue labor above the naming screen also needs giving a little modification to explain this new function.
Open "strings.c" file, jump to the line where holds the const context of the strings "gtext_MoveOkBack".
And then add the text " {R_BUTTON}CHANGE CASE" at the end of that original line.
Spoiler:

Here is the result.
Spoiler:

Thanks eatthepear for pointing out this detail in the respond #417.

Also, If you find another error, bug or glitch of my tutorial & codes, or you have much simpler & easier ways to do it. please at least leave a comment or respond below to point it out, which I would very appreciate to fix, absorb & update.
Thank everyone reading this tutorial again and sorry for my poor English.
 
Last edited:
50
Posts
13
Years
[pokeemerald] Running speed by default

This simple change is made at "src/field_player_avatar.c"

Go to "static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys)"

Find and swap the following highlighted code at the end:
Code:
    if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_UNDERWATER) && (heldKeys & B_BUTTON) && FlagGet(FLAG_SYS_B_DASH)
     && IsRunningDisallowed(gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior) == 0)
    {
        [COLOR="RoyalBlue"]PlayerRun(direction);
        gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_DASH;[/COLOR]
        return;
    }
    else
    {
        [COLOR="Red"]PlayerWalkNormal(direction);[/COLOR]
    }

It should look like this:
Code:
    if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_UNDERWATER) && (heldKeys & B_BUTTON) && FlagGet(FLAG_SYS_B_DASH)
     && IsRunningDisallowed(gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior) == 0)
    {
        PlayerWalkNormal(direction);
        return;
    }
    else
    {
        PlayerRun(direction);
        gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_DASH;
    }

Now, you will walk at running speed, and you can slow down by holding B.
 

セケツ

ポケハック初心者
61
Posts
7
Years
  • Age 26
  • Seen today
[PokeEmerald] Enable the Opponent Trainers to throw Pokeball instead of dropping it directly to the battlefield.

From the GEN3 pokemon games, it is the player himself (or the trainers in the player's side such as double-battle partners or catching tutors) that had been added the feature enabling him or her to throw their pokeball to the battlefield, which also took place of that simple & massively used "drop & out" animation presented in GEN1 & 2. However, for the trainers in the opposite side, it's a shame that they still simply drop & leave their pokeball behind themselves and then slide away, which is nothing but the old & only method for pokeball's presenting in trainer battle.
Well, after some shallow & easy research of the decomp files, I finally succeeded in enabling the opponent trainers to throw their pokeball to the battlefield, just like what the player could.
For anyone not clear with what I said above, please take a look at the picture below.

Spoiler:

And here, it's time for the explanation in detail.
1. First of all, open the "pokeball.c" lying under the src folder, here you will clearly see all the codes & functions that controlling all kinds of performances of the Pokeballs during the battle.

2. Second, jump to the strings of this file's declarations, add "_1" the declaration of the function named "SpriteCB_OpponentMonSendOut". And then add a totally new declaration of a new function named "SpriteCB_OpponentMonSendOut_2" just below it.

Spoiler:

3. By finishing the former step, scorlling down to the function named "Task_DoPokeballSendOutAnim", finding the switch structure of the throw case itself, and make some modifications of the case named "POKEBALL_OPPONENT_SENDOUT" just as the picture below.

Spoiler:

4. After that, scorlling down to the strings for the original function "SpriteCB_OpponentMonSendOut", select & delete it completely, and insert the codes I presents below.

Spoiler:

And here come the complete codes:
Code:
static void SpriteCB_OpponentMonSendOut_1(struct Sprite *sprite)
{
    sprite->data[0] = 25;
    sprite->data[2] = GetBattlerSpriteCoord(sprite->sBattler, BATTLER_COORD_X);
    sprite->data[4] = GetBattlerSpriteCoord(sprite->sBattler, BATTLER_COORD_Y) + 24;
    sprite->data[5] = -30;
    sprite->oam.affineParam = sprite->sBattler;
    InitAnimArcTranslation(sprite);
    sprite->callback = SpriteCB_OpponentMonSendOut_2;
}

#define HIBYTE(x) (((x) >> 8) & 0xFF)

static void SpriteCB_OpponentMonSendOut_2(struct Sprite *sprite)
{
    u32 r6;
    u32 r7;

    if (HIBYTE(sprite->data[7]) >= 35 && HIBYTE(sprite->data[7]) < 80)
    {
        s16 r4;

        if ((sprite->oam.affineParam & 0xFF00) == 0)
        {
            r6 = sprite->data[1] & 1;
            r7 = sprite->data[2] & 1;
            sprite->data[1] = ((sprite->data[1] / 3) & ~1) | r6;
            sprite->data[2] = ((sprite->data[2] / 3) & ~1) | r7;
            StartSpriteAffineAnim(sprite, 4);
        }
        r4 = sprite->data[0];
        AnimTranslateLinear(sprite);
        sprite->data[7] += sprite->sBattler / 3;
        sprite->y2 += Sin(HIBYTE(sprite->data[7]), sprite->data[5]);
        sprite->oam.affineParam += 0x100;
        if ((sprite->oam.affineParam >> 8) % 3 != 0)
            sprite->data[0] = r4;
        else
            sprite->data[0] = r4 - 1;
        if (HIBYTE(sprite->data[7]) >= 80)
        {
            r6 = sprite->data[1] & 1;
            r7 = sprite->data[2] & 1;
            sprite->data[1] = ((sprite->data[1] * 3) & ~1) | r6;
            sprite->data[2] = ((sprite->data[2] * 3) & ~1) | r7;
        }
    }
    else
    {
        if (TranslateAnimHorizontalArc(sprite))
        {
            sprite->x += sprite->x2;
            sprite->y += sprite->y2;
            sprite->y2 = 0;
            sprite->x2 = 0;
            sprite->sBattler = sprite->oam.affineParam & 0xFF;
            sprite->data[0] = 0;

            if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->introAnimActive
             && sprite->sBattler == GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))
                sprite->callback = SpriteCB_ReleaseMon2FromBall;
            else
                sprite->callback = SpriteCB_ReleaseMonFromBall;

            StartSpriteAffineAnim(sprite, 0);
        }
    }
}

#undef HIBYTE

5. Finally, save & test.

I haven't found any bug yet. Moreover, for anyone who wants this ball-throwing animation vivider. There is an option that he or she could also add a sound effect to it. Just by scrolling back to the "Task_DoPokeballSendOutAnim" function, and adding a line of the "PlaySE" command simply in that switch structure mentioned above, like the picture presented here.

Spoiler:

Also, If anyone reading this post find any error, bug or glitch of my codes & tutorial itself. Please at least leave a comment below or give a respond for me.
Very appreciated for anyone's reading.
 
Last edited:
4
Posts
7
Years
  • Age 21
  • Seen Sep 29, 2023
BW Repel

Whenever the Repel's effect wears off, a prompt will appear asking player if they wish to use another one. Similarly to my old pre-decomp implementation, this one also lets you choose which Repel(Regular, Super, Max) to use. Obviously, if you have only one kind, this part is skipped.

Code:
src/script_menu.c DrawMultichoiceMenu
I modified the function, so it works with custom menu options, in ours case Repels ones. Change that part to:
Spoiler:

Now
Code:
data/scripts/repel.inc
Spoiler:

Screenshots:
Spoiler:

I also have the code in my github branch called repel, so you can pull directly from it.

I'm terribly sorry to bother, but I am having some issues with this. I am very new to decompilation, so that can probably explain it, but, after following the post step-by-step, making sure I didn't miss anything, when I run the "make" command to build the ROM it tells me that a bunch of functions have been "declared implicitly". Now, I know what this means, but I can't figure out how to fix this.

Not only that, after trying to fix it a couple times, I tried by directly copying and pasting the code for BOTH "script_menu.c" and "repel.inc" that were posted in the github branch at the end of the quoted post, but that still didn't do anything and the issue persists.

I'm attaching an image that will hopefully make you understand a little more the situation I am in. If anyone could please help me, I would be extremely grateful for that.
 

Attachments

  • helpme.png
    helpme.png
    13.8 KB · Views: 13

Lunos

Random Uruguayan User
3,114
Posts
15
Years
I'm terribly sorry to bother, but I am having some issues with this. I am very new to decompilation, so that can probably explain it, but, after following the post step-by-step, making sure I didn't miss anything, when I run the "make" command to build the ROM it tells me that a bunch of functions have been "declared implicitly". Now, I know what this means, but I can't figure out how to fix this.
Replace the labels that are out of date with their current equivalent.
For example, Egg's branch is using the label SE_TU_SAA inside the data/scripts/repel.inc file. However, that label was renamed to SE_REPEL 2 years ago.
Thus, you need to replace SE_TU_SAA which is a label that a modern copy of Pokeemerald wouldn't be able to find, with SE_REPEL which does exist within the codebase.

Normally, your terminal should tell you which specific labels you need to swap out, because it will give you an error message along the lines of "undefined reference to [label]".
To learn what's their new name, you can use git log -n 5 -S [label] to check the last 5 commits in which the label was used.
Normally, the very first commit showed is the latest commit in which the label was used. Normally, that is the commit in which the label was renamed.
You can then check the changes in that commit on your terminal, or using a Git GUI program, or using Visual Studio Code with extensions, or even just check it on GitHub.com.
Not only that, after trying to fix it a couple times, I tried by directly copying and pasting the code for BOTH "script_menu.c" and "repel.inc" that were posted in the github branch at the end of the quoted post
You shouldn't have done that.
Egg's branch is out of date. A lot of the labels used in its files are old, hence why you're told that there's "undefined references" and "implicit declaration" of functions.
Copy-pasting entire outdated files is a perfect recipe for disaster as you're bound to get multiple errors involving things that changed over time.
 
Last edited:
4
Posts
7
Years
  • Age 21
  • Seen Sep 29, 2023
Replace the labels that are out of date with their current equivalent.
For example, Egg's branch is using the label SE_TU_SAA inside the data/scripts/repel.inc file. However, that label was renamed to SE_REPEL 2 years ago.
Thus, you need to replace SE_TU_SAA which is a label that a modern copy of Pokeemerald wouldn't be able to find, with SE_REPEL which does exist within the codebase.

Normally, your terminal should tell you which specific labels you need to swap out, because it will give you an error message along the lines of "undefined reference to [label]".
To learn what's their new name, you can use git log -n 5 -S [label] to check the last 5 commits in which the label was used.
Normally, the very first commit showed is the latest commit in which the label was used. Normally, that is the commit in which the label was renamed.
You can then check the changes in that commit on your terminal, or using a Git GUI program, or using Visual Studio Code with extensions, or even just check it on GitHub.com.

You shouldn't have done that.
Egg's branch is out of date. A lot of the labels used in its files are old, hence why you're told that there's "undefined references" and "implicit declaration" of functions.
Copy-pasting entire outdated files is a perfect recipe for disaster as you're bound to get multiple errors involving things that changed over time.

Thank you very much for the help, I will try fixing it and see if I can make it work.
Luckily I always like to make tons of backups, so replacing the whole thing hopefully hasn't really affected anything (I can just restore it to how it was before).

EDIT:
I fixed it! git log -n 5 -S [label] was super useful and i'll keep that line in mind every time I'm having a hard time understanding what's wrong.
Once again, thank you so much for the help!!
 
Last edited:
446
Posts
6
Years
  • Age 37
  • Seen today
Scripted Evolution (Emerald)

This modification lets you trigger evolution from scripts.

jfSFsPy.gif


Setup:
Spoiler:


Examples:
Spoiler:
 

セケツ

ポケハック初心者
61
Posts
7
Years
  • Age 26
  • Seen today
[PokeEmerald] Make the Edit of the "Copyright Text" and "THE END" screen in ending credits directly done by tilemap tools.

As we all know, when it comes to the ending of the game, there are two black screens showing up in the end of the credits. One conveys the copyrights and some right-reserved information, the other is a black screen with white text "THEEND" placed in the center.
For anyone not know what I'm talking about, please take a look at these two pictures of them.

Spoiler:

If you are willing to spend time taking a more clear look of them, you would notice that they are also simliar to the copyright screen showing up before the introduction. Actually, Not only are they the background pictures generated by compressed tiles & showed in BG2, but also do they share the same palette, However, while the screen of copyright showing before the introduction had been separated to the tilemap file in .bin format long time ago, it's a shame that the screen of copyright and "THE END" letters showing up at the end of the credits are still something simply generated merely by the C files, which can not be edited by tilemap tools like NTME or tilemap studio directly.
Here, in this tutorial, I finally figured out a way to edit those two screens directly, just based on some changes & modifications of the source files themselves, which will be presented below.

1. Download the file named "CreditsGraphics.zip" from THIS uploader, which contains the tilemap & tiles for both of those two screens mentioned above. Unzip it, and then move all the files to the "graphics/credits" folder in order to replace the original one.
Spoiler:

2. Open the "credits.c" file, then jump to the declaration lines, add these completely new declaration codes presented below.
Spoiler:

3. Then, scroll down and remove the code lines constructing "THEND" five letters, which have become outdated due to the addition of the tilemap.
Spoiler:

4. After complete all the steps above, jump to the places where lies the function named "LoadTheEndScreen", And from there you need to make several changes for four functions until the one named "DrawTheEnd".
Spoiler:

The first one is the function "LoadTheEndScreen" itself, here comes the complete codes.
Spoiler:

The second one is the function named "GetLetterMapTile", you need to do nothing but delete it from your file completely, since it would be unneeded.
Spoiler:

The third one is the function named "DrawLetterMap" tiles, which is also no longer needed here and wait to be deleted completely.
Spoiler:

The last one is the function named "DrawTheEnd", which must be changed to the codes presented below.
Spoiler:

5. Finally, remeber to save your files before you build your ROM and test.
From now, you could edit those two screens in a direct & efficient way just by using the tilemap tools like tilemap studio or NTME, which also requires nothing but only some binary hacking knowledge of how to edit them.
Also, If you find any bug, error or glitch of this tutorial. Please at least leave a comment below or send a message to me.
Thanks everyone's reading and sorry for my poor English.
 

セケツ

ポケハック初心者
61
Posts
7
Years
  • Age 26
  • Seen today
[PokeEmerald] Print the Icons of the Player's Party Pokemon on the Back Side of the Trainer Card.

In PokeFirered, there is one special event that enables players to print the icons of their party pokemon on their trainer cards' backside, triggered by "taking one photo" on the machine in the rocket game corner. As far as I know, this special event is not completely deleted or removed in the Pokeemerald and still can be seen when the players try to connect with the save files of the Firered in the cable club (By checking the opponent's card). What's more, the complete codes of itself still remains unchanged in the emerald decomp files, which can be easily enabled just by re-adding the deleted vars back. However, since it's a special event controlled & stored by the vars, it's a shame that it CAN ONLY BE triggered by the players, means when the party team was changed (put a new pokemon into/away from the party) it can't be updated automatically, or print the changes properly and timely.
Luckily, after breifly looking through how the icons become printed in the party menu, I finally figured out one alternate way of solving this problem. And succeed in making the icon of the player's team printed & update properly. Here is it.
For anyone still doesn't get what I'm talking about, please take a look at the picture below.
Spoiler:

And then, it's time for the explanation in detail.
First, open the file "trainer-card.c", which lies in the src folder of the decomp files. The initial thing is to include "pokemon.h" at the beginning. And then go into the declaration parts then add the declarations of 2 completely new function. Here, I used "UpdateTrainerCardMonIcons" & "DestoryTrainerCardMonIcons" for instance. And you can give them names freely just as what you want.
Spoiler:

Next, jump to the part where stores the declaration of the ewram data. And there need to be added 2 new declaration for the sprite data & palettes of the pokemon icons.
Spoiler:

Then, it's time to add all of these codes provided below. For this tutorial, I just chose to place all of the codes to the bottom of this file itself.
Spoiler:

Codes:
Spoiler:

After adding the codes, scorll up to the function "Task_TrainerCard", which controls the display & the filp of the trainer card itself. Here you must do several changes to the codes in order to make the mon icons appear/disappear properly & timely.
For case STATE_WAIT_FLIP_TO_BACK, you need to add "UpdateTrainerCardMonIcon();" in the second line. And for case STATE_HANDLE_INPUT_BACK, you need to add "DestoryTrainerCardMonIcons" in the first if & else branch, just like the picture presented below.
Spoiler:

Then it comes to the last step, since the newly added function has conflicted with the original print function of the tranier card. It is necessary to scroll down to the original display function "PrintAllOnCardBack" and then delete the original "PrintPokemonIconsOnCard" function, which is presented in case 6.Moreover, since the place where mon icons displayed is conflicted with the text of the battle points, it's also necessary to remove it from the whole process of displaying.
Spoiler:

That's all, finally, save the files, build your ROM & test.
There is only one affair I noticed later that it may break the function of displaying the original icon photos on trainer card properly when being connected to the Firered save files. But I haven't tested it yet since I didn't have the save files that had completed through the seven islands plots.
Also, if anyone find any bug, error or glitch of my tutorial, please leave a comment below or at least send a message to me.
Very appreciated for anyone reading it.
 
Last edited:
17
Posts
3
Years
  • Age 42
  • Seen Apr 22, 2024
[PokeEmerald] Recover the R-button's Letter changing function of the naming screen.

You can add a label to the top of the nicknaming screen by editing "gText_MoveOkBack" in src/strings.c

For example, you can set it to "{DPAD_NONE}Move {A_BUTTON}Ok {B_BUTTON}Back {R_BUTTON}Change case"
 
17
Posts
3
Years
  • Age 42
  • Seen Apr 22, 2024
[Pokeemerald] DS-Style party screen (2 versions)
In V2, there's a bug where selecting half your party for the battle frontier results in some buggy text appearing in the bottom right. The fix to this is in the function "CreateCancelConfirmWindows". We need to replace

cancelWindowId = AddWindow(&sMultiCancelButtonWindowTemplate);
with:
if (gPartyMenu.layout == PARTY_LAYOUT_SINGLE)
cancelWindowId = AddWindow(&sMultiCancelButtonWindowTemplate_equal);
else
cancelWindowId = AddWindow(&sMultiCancelButtonWindowTemplate);
 

セケツ

ポケハック初心者
61
Posts
7
Years
  • Age 26
  • Seen today
[PokeEmerald] Held Item Animation in HGSS Style.

For the GEN3 Pokemon games, the original complicated & slow animation for the held item coming to effect in battle is always blamed for wasting of time. Combined by three different & long-lasted animation tasks, just watching & waiting that animation itself to over may have already become a pain for anyone familiar with the original GEN3 games. Especially when it comes to the quick-pace 3v3 battle in battle tower or battle frontier. Trying to imagine how the quick battle itself had been turned to a slow and long-lasted nightmare when you and your opponent both choose to send out two high HP LV100 SNORLAX or BLISSEY but both with LEFTOVERS carried (Something that usually happens in the battle factory).
If I remember correctly, it is the HeartGold & SoulSilver Version in GEN4 that have one totally different & simplified animation for the held item effect. (NOTE: I don't know whether the other games in GEN4 used the same animation or not. Since I'm unfamiliar with GEN4 at all). And it's lucky that after some simple researches and discoveries of the file of animation scripts, I finally figured out one possible way to port this new animation back to the PokeEmerald decomp files.
For anyone doesn't get what I'm talking about, here is the picture below.
Spoiler:

Then, it's comes to explain it in detail.

1. Build the New Animation Task.

Personally thinking, the animation of the held item in HGSS itself is similar to the animation of move "FACADE" presented in the GEN3 games, but the former does not have any "purple sweat" coming out. Moreover, the whole animation of the held item in HGSS also just displays for twice instead of three time.
In spite of those two evident differences, I still decided to use the animation of FACADE as the basis for the new held item animation. Actually, there will be just a few & tiny modifications needing to be done for the original codes.
Open the file named "battle_anims_effects_3.c", and then give the new declaration of a totally new tasks at the beginning, the name of which could be given whatever you want, and here I used the strings "Animtask_HeldItemSquish_Step" for instance.
Spoiler:

Then, jump to the end of that file, pasting all these codes provided below for the animation's task that has been declared in the previous step. Actually, the code provided below is just a modified copy of the same task for move FACADE at all, but with the display of purple sweat removed from it completely.
Spoiler:

Codes:
Spoiler:
After that, save and close that file. And get ready for moving towards the next part.

2. Modifiy the Animation Script.

Same as all the animations used for the battle, the Animation of the held item itself is also laid in the file "battle_anim_script.s".
Although it's not a .c file, if you have some basic knowledge & experience of binary hacking, you will find it giving you a familiar sense of the event scripts presented in ScripTEditor or XSE just by the time you open it.
Take use of the search bar which makes it much quicker to find the code "General_HeldItemEffect" throughout hundreds of lines, then in there replace the original script with the script I presents below.
I have explained a few usages for some functions and parameters used by the animation codes in the pictures. For anyone interested, feel free to check it out.
Spoiler:

For anyone have known them or don't intend to see them at all, here is the code itself.
Spoiler:
After that, save your files and build your ROM. If everything goes well, this time the game will display the new animation of held item in battle. Just the same as the .gif that I showed at the beginning of this tutorial.

3. Add the Blue Star Healing Animation for the case when the held item restores health (Optional)

In the original GEN3 games, when the held item restoring health, the game wouldn't present any special animation and go to the change of the HP Bar itself directly, which is nothing but the same routine used by many other effects like recovering all the stats or coming back from the status conditions.
Therefore, in order to make it distinguished & different from the majorities. it is some hacks that have succeeded in adding the Blue Star Healing Animation (presented after the move ABSORB or RECOVER), specifically for the case when held items restoring health.
For anyone interested in it, please take a look at this picture below:
Spoiler:

Although it is not presented in the original HGSS (if I am not wrong), since some hacks do get this features implemented. I will post how to do it in detail below. Whether update it in your files or not is up to yourself.
First, reopen the file "battle_anim_script.s" previously mentioned, and then add a completely new declaration with a new var attached. Both of them should be placed in the part of the declaration for all General animations used in the battle.
Spoiler:

Next, scroll down & go straight to the part containing the scripts of all the general animations, then add the codes provided below there.
The code below is nothing but one modified copy of that blue star animation, which has been changed a litttle to fit for all the general animations used there.
Spoiler:

Codes:
Spoiler:
After having completed the previous step, save your file and then open the header file named "battle_anim.h", there you should add the declaration for the var used by newly added animation for the later use.
Spoiler:

Then it comes to last part, since the blue star animation had been implemented to the files, it's time to make it work & display.
Open another script file named "battle_script.s", which contains the whole script used by the held items in battle. And then, it's time to make only two tiny & little changes for the codes itself to make our newly added animation display.
The first one is "ItemHealHP_RemoveItem", used by the Berries that could be used to heal HP only for once in the battle.
Spoiler:

The second one is "Item_HealHP_Ret", used by items like LEFTOVERS or that restores the health of the pokemon everyturn.
Spoiler:

What you need to do in these two places is only to type & write strings "playanimation BS_ATTACKER B_ANIM_HELD_ITEM_RESTORE_HP" there. Just as the pictures showing. In the end, remember to save your files before building your ROM.
And that's all for what I'm talking about, if anyone reading & using this tutorial finds out bug, glitch, places needing modification or just advice that should be included there. Please at least leave a comment below or send a respond to me.
Thanks for everyone reading it and sorry for my poor English.
 
Last edited:

Lunos

Random Uruguayan User
3,114
Posts
15
Years
Displaying the power of Frustration/Return in the Summary Screen [Em]
Yesterday, Petuuuhhh asked if someone implemented a way to see the power of the moves Frustration and Return InGame.
I looked into it, and after a couple of minutes I did it myself.
I didn't think about posting it, but today it kinda feels like a good idea to just drop it here.

No commits or pullable branches, it's an extremely easy modification.
Spoiler:

MmjwwAc.png

Note: This Groudon has 255 points of Friendship.

EDIT: I didn't think it was necessary to mention it since anyone can git grep or use the Searching functionality that certain IDEs or specialized text editors like VSC or N++ have, but PrintMovePowerAndAccuracy is located in src/pokemon_summary_screen.c, the file that controls... the code that is used for the summary screen.
Coincidentally, PrintMovePowerAndAccuracy prints a move's power and accuracy. Quite surprising.

EDIT2 (21/04/2024): Fixed the diff's formatting in the post after the drastic changes in the forum's software.

And that's pretty much it.​
 
Last edited:
4
Posts
5
Years
  • Age 27
  • Seen Apr 17, 2024
Displaying the power of Frustration/Return in the Summary Screen [Em]
Yesterday, Petuuuhhh asked if someone implemented a way to see the power of the moves Frustration and Return InGame.
I looked into it, and after a couple of minutes I did it myself.
I didn't think about posting it, but today it kinda feels like a good idea to just drop it here.

No commits or pullable branches, it's an extremely easy modification.
Spoiler:


MmjwwAc.png

Note: This Groudon has 255 points of Friendship.

And that's pretty much it.​

Return/Frustration has a minimum base power of 1, outside of Gen2. Your screenshot shows 0.
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
Return/Frustration has a minimum base power of 1, outside of Gen2. Your screenshot shows 0.
That's handled automatically by the game's battle engine. Whenever gBattleMoveDamage is about to be 0, Game Freak just manually sets it to 1.
You can check that out yourself just reading code in files such as src/battle_script_commands.c.
If you want to, you can do the calcs using local variables in the function and check if the result is 0 in a similar fashion, like this:
Spoiler:

And it'd hardly be any different.
 
3
Posts
2
Years
  • Age 31
  • Seen Nov 22, 2023
[pokeemerald] Increase Text Speed Beyond Fast

compared to newer games, text speed is a large part of what makes gen 3 feel slow. the game already prints 1 character per frame when the text speed is set to fast, so we are going to alter it to print more than one character per frame. we can also set the original "fast" speed to be our slowest speed. you can fine-tune the exact speed at each setting to your liking.

part 1: multiple characters per frame

Spoiler:


part 2: changing slow and mid

Spoiler:


i hope you find this modification useful! i've only just added it to my hack today, and i've fixed a couple of bugs with it already. if any more pop up, i'll edit this post to fix them. if anyone else finds bugs with it, please let me know and i'll see what i can do.


Hi,

Compiling with additions to Show Type Effectiveness In-Battle gives the errors below. It may be due to changes in the pokeemerald since this doc was posted.

agbcc: warnings being treated as errors
src/battle_controller_player.c: In function `MulModifier':
src/battle_controller_player.c:1503: warning: implicit declaration of function `UQ_4_12_TO_INT'
src/battle_controller_player.c:1503: `UQ_4_12_ROUND' undeclared (first use in this function)
src/battle_controller_player.c:1503: (Each undeclared identifier is reported only once
src/battle_controller_player.c:1503: for each function it appears in.)
src/battle_controller_player.c: In function `TypeEffectiveness':
src/battle_controller_player.c:1508: `B_FLAG_INVERSE_BATTLE' undeclared (first use in this function)
src/battle_controller_player.c:1514: `sTypeEffectivenessTable' undeclared (first use in this function)
src/battle_controller_player.c:1527: warning: implicit declaration of function `UQ_4_12'
src/battle_controller_player.c: In function `MoveSelectionDisplayMoveTypeDoubles':
src/battle_controller_player.c:1553: structure has no member named `bufferA'
tools/agbcc/bin/agbcc <flags> -o build/emerald/src/time_events.o src/time_events.c
tools/agbcc/bin/agbcc <flags> -o build/emerald/src/player_pc.o src/player_pc.c
tools/agbcc/bin/agbcc <flags> -o build/emerald/src/coord_event_weather.o src/coord_event_weather.c
tools/agbcc/bin/agbcc <flags> -o build/emerald/src/battle_anim_effects_1.o src/battle_anim_effects_1.c
tools/agbcc/bin/agbcc <flags> -o build/emerald/src/minigame_countdown.o src/minigame_countdown.c
tools/agbcc/bin/agbcc <flags> -o build/emerald/src/battle_anim_throw.o src/battle_anim_throw.c
tools/agbcc/bin/agbcc <flags> -o build/emerald/src/pokemon_size_record.o src/pokemon_size_record.c
tools/agbcc/bin/agbcc <flags> -o build/emerald/src/move_relearner.o src/move_relearner.c
tools/agbcc/bin/agbcc <flags> -o build/emerald/src/bike.o src/bike.c
tools/agbcc/bin/agbcc <flags> -o build/emerald/src/apprentice.o src/apprentice.c
make: *** [Makefile:337: build/emerald/src/battle_controller_player.o] Error 1
make: *** Deleting file 'build/emerald/src/battle_controller_player.o'
make: *** Waiting for unfinished jobs....
 
Back
Top