• 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

1,591
Posts
10
Years
    • Seen Mar 20, 2024
    also have to have "#include "constants/map_groups.h" at the top of src\berry.c, or else it gives an error about the maps being undeclared in that function.
    Good point, I'll edit the post to include that. Wasn't needed in my repo but probably will be for most people's.
     

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • Quick heads up.
    I pushed a new commit to my gen6_exp_share branch after Jaizu pointed out to me that I forgot to clear the value of gSaveBlock2Ptr->expShare upon starting a New Game.


    Disable Pokémon animations [Em]
    Nice and simple. It's also a repost from here.
    These changes disable the sprite animations that Pokémon have in battle and in the Summary Screen too.
    I'm posting it here because it'd be better archived here than in some random thread.

    Showcase:
    Simple Modifications Directory


    To implement this, y'all can either track my GitHub repository via git remote and pull the branch where I'm hosting the code:
    Code:
    git remote add lunos https://github.com/LOuroboros/pokeemerald
    git pull lunos disable_pkmn_anims

    Or you can also apply the changes manually.
    Your choice.

    And that's pretty much it.​
    Quick update: I forgot to disable the battle anim. for opposing Pokémon in trainerbattles, so I pushed a commit to deal with that just now.
     
    49
    Posts
    5
    Years
    • Seen Dec 27, 2023
    [Pokeemerald] Register items in a list menu!
    This adds a list menu on the L button, which allows registering a choosen amount of items, currently 10 (but less or more are possible with changing 1 define).
    Simple Modifications Directory


    The menu offers:
    -variable number of registered items
    -allows changing the order by moving items with select!!!
    -remembers last item used and opens on that
    -includes a Cancel button for 1 handed mode
    -if L=A button mode is choosen, button automatically changes to R
    -retains the select register button for another item

    Simple Modifications Directory
    Simple Modifications Directory


    HOW TO:
    Code:
    git remote add xaman https://github.com/TheXaman/pokeemerald/
    git pull xaman tx_registered_items_menu
    make

    I hope you enjoy it, if you find any bugs or have suggestions: please let me know!


    Credits:
    ghoulslash
    TheXaman
     
    Last edited:

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • Gender-based Field Textboxes [Em]
    I did this completely on a whim. No particular reason.
    This branch adds new field textboxes that are used depending on the Player's gender.

    It also adds a third gender that acts as a stopgap until the Player chooses their definitive gender.
    I did this because otherwise, the male textbox was being used if you went back to the gender selection and that didn't sit well with me.

    Showcase:
    Simple Modifications Directory


    To implement this, you can track my GitHub repository via git remote and pull the branch gendered_tboxes which is where I'm hosting the code:
    Code:
    git remote add lunos https://github.com/LOuroboros/pokeemerald
    git pull lunos gendered_tboxes

    And that's pretty much it.​
     
    Last edited:
    22
    Posts
    14
    Years
    • Seen Oct 27, 2023
    HM Items [EM]

    This creates items that do the job of HMs and removes HM moves from the pokemon menu.

    Couple of notes:
    • There is an item for each HM except Fly and Waterfall
    • Waterfall is now a script flag that'll need to be set to use.
    • The items function both from item menu and by interacting with the overworld

    Update:
    I noticed that the repo was grossly out of date, so I've updated it to current pokeemerald.

    To do this just use my github:
    Code:
    git remote add ns https://github.com/NobodySociety/pokeemerald
    git pull ns HMItems

    Simple Modifications Directory
    Simple Modifications Directory
    Simple Modifications Directory
    Simple Modifications Directory
    Simple Modifications Directory
    Simple Modifications Directory
    Simple Modifications Directory
     
    Last edited:
    7
    Posts
    3
    Years
    • Seen Dec 26, 2023
    POKEEMERALD
    PSS IN THE START MENU
    Spoiler:
    Spoiler:


    Hey, I noticed an issue and I'm not sure what's causing it and I was wondering if you could help me out. When I start a new game everything works fine, but if I load a save then it sort of deletes the box data?? I'm not sure I'm working this very well, but here's a link to a pic. I can't post pics...
    *Edit: To clarify, it only deletes visual data. It removes the box names and changes all the wallpaper to the forest.

    https://imgur.com/gallery/iTH2cRV
     
    Last edited:
    22
    Posts
    14
    Years
    • Seen Oct 27, 2023
    POKEEMERALD
    PSS IN THE START MENU
    Spoiler:
    Spoiler:


    So I tried to implement this, but it kept freezing at black screen whenever I would leave the PC menu from the start menu. I'm fairly certain that the issue is
    Code:
    DisableInterrupts(FLAG_POKEMONPCMENU);
    in what was
    Code:
    static void FieldCb_ReturnToPcMenu(void)
    removing that line, everything seems to run fine, but I'm not 100% on what it does, and assume it has a reason for being there. Is it really important?
     
    18,811
    Posts
    21
    Years
  • [pokefirered] Native Real-Time Clock

    *gasp* I did something!

    Find this on GitHub: https://github.com/Sotomura/pokefirered/tree/pokefirered-rtc

    Add or clone it to your repo like this:
    Code:
    git remote add sotomura https://github.com/Sotomura/pokefirered/
    git pull sotomura pokefirered-rtc

    This here's a native real-time clock for pokefirered, because why should pokeruby and pokeemerald have all the fun? What's more, any modern emulator (read: not old versions of VBA) and even the 3DS Virtual Console should be able to detect and work with the real-time clock natively, so it's better than the binary implementations tenfold (until you remember it's GameFreak, who deliberately disabled the Year/Month/Day functionality in it). It should work perfectly with the Seiko Instruments RTC chip that actual Pokémon Ruby/Sapphire/Emerald carts have, which means it theoretically should play nice with flash carts that have RTC too.

    The functionality is outright ported from pokeemerald, right down to support for the wallclock specials. And because this code is opinionated, it also restores the EVO_FRIENDSHIP_DAY and EVO_FRIENDSHIP_NIGHT and Pokérus spread that was originally dummied out. It carves out FLAG_0x390 through to FLAG_0x3CF for daily flags, which as per the name are cleared each day. If you pull this branch you'll definitely need to tailor it to suit you.

    Play with src/clock.c to tailor what happens daily to suit your needs. I've left commented-out references to what the code usually does to help you out — like Mirage Island clearing and the lottery — although I haven't included that code in this. I've made bare minimum assumptions of what you'll need — the rest is up to you! :)

    This repo also doesn't have a variable for setting the time in the player's room, but you shouldn't have any trouble scripting that.

    Note: until I can figure it out (or someone can help me out — be my guest!) it also includes a buggy-as-hell RTC reset screen directly ported from Emerald. It works fine, but then it corrupts your boxes once it saves the game. Oh dear. It's disabled by default and requires certain flags to be set to be enabled again.
    Thanks to GriffinR, a small code change means the RTC reset's save process no longer corrupts the save. Yay!
     
    Last edited:
    70
    Posts
    10
    Years
    • Seen Nov 4, 2023
    [Pokeemerald] Register items in a list menu!
    This adds a list menu on the L button, which allows registering a choosen amount of items, currently 10 (but less or more are possible with changing 1 define).
    Simple Modifications Directory


    The menu offers:
    -variable number of registered items
    -allows changing the order by moving items with select!!!
    -remembers last item used and opens on that
    -includes a Cancel button for 1 handed mode
    -if L=A button mode is choosen, button automatically changes to R
    -retains the select register button for another item

    Simple Modifications Directory
    Simple Modifications Directory


    HOW TO:
    Code:
    git remote add xaman https://github.com/TheXaman/pokeemerald/
    git pull xaman tx_registered_items_menu
    make

    I hope you enjoy it, if you find any bugs or have suggestions: please let me know!


    Credits:
    ghoulslash
    TheXaman

    This is super cool. Its possible to have it on fire red too?
     

    ellabrella

    PKMN Trainer
    57
    Posts
    5
    Years
    • She/It
    • Seen Apr 17, 2024
    [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.
     
    Last edited:

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • Headbutt in the overworld [Em]
    Just like the gender-based textboxes, I did this completely on a whim and for no reason other than "I was bored".
    Essentially, this is a modified copy of the code for Rock Smash encounters.

    Notes:
    -The encounter rates don't use the official games' formula because I don't care much about that.
    -I left in a headbutt encounter table for Route 101 ready as some sort of example, but Porymap can read the tables just fine.
    -To make a headbuttable tree, simply set the metatile behavior of its tiles to MB_HEADBUTT.

    Showcase:


    To implement this, you can track my GitHub repository via git remote and pull the branch ow_headbutt which is where I'm hosting the code:
    Code:
    git remote add lunos https://github.com/LOuroboros/pokeemerald
    git pull lunos ow_headbutt
    Or you can implement it manually. Your choice.

    As you can see in the diff, the branch does not assign the MB_HEADBUTT to any tiles by default.
    This is to avoid potential conflicts with projects that may have performed tileset changes of any kind.

    And that's pretty much it.​
     
    Last edited:

    kuplion

    Autobot
    3
    Posts
    3
    Years
    • Seen Mar 14, 2024
    Nature-affected stats colouring

    I used the color red with light and dark shade to signify stat affected negatively and positively respectively. If you wish to use different colors, just modify the sTextNatureDown and sTextNatureUp strings, more specifically the byte value after {COLOR} special character.
    Code:
    src/pokemon_summary_screen.c
    Changes include functions in range BufferLeftColumnStats - BufferRightColumnStats.
    Spoiler:

    Screenshot:
    Spoiler:

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

    Hey all! I've searched around for it so hopefully it's not just my Google-fu failing me, but is there a FRLG port of this feature anywhere? I've tried porting it over myself but I'm honestly not strong enough on the language to do it yet.
     

    Jaizu

    Average rom hacker
    282
    Posts
    14
    Years
  • [Emerald] Let the player continue after losing a battle

    THIS IS OUTDATED, USE THIS INSTEAD
    https://www.pokecommunity.com/showthread.php?p=10450219#post10450219


    Simple Modifications Directory
    Simple Modifications Directory


    Code:
    script Debug_Script_4 {
    	trainerbattle_continue_after_lose(TRAINER_CALVIN_1, 0, "I lost!", Debug_Script_4_PostBattle)
    }
    
    script Debug_Script_4_PostBattle {
        specialvar(VAR_RESULT, GetBattleOutcome)
        if (var(VAR_RESULT) == B_OUTCOME_WON) {
            msgbox(format("I didn't know I could lose this!"))
        } else {
            msgbox(format("You are too weak to face me."))
        }
        special(HealPlayerParty)
        closemessage
    }

    Link: https://github.com/Jaizu/pkmn_cots/commit/8279cc0a45d7d853d86b17745339663fb21d2e48

    Edit: Improved it with this commit: https://github.com/Jaizu/pkmn_cots/commit/ecbb4b495123d24a65cc4cffcef81a6342779247

    Now you can have intro text and you don't need to add the 0 parameter.
    Code:
    script Debug_Script_4 {
    	trainerbattle_no_whiteout(TRAINER_CALVIN_1, "Intro text yay", "I lost!", Debug_Script_4_PostBattle)
    }
    
    script Debug_Script_4_PostBattle {
        specialvar(VAR_RESULT, GetBattleOutcome)
        if (var(VAR_RESULT) == B_OUTCOME_WON) {
            msgbox(format("I didn't know I could lose this!"))
        } else {
            msgbox(format("You are too weak to face me."))
        }
        special(HealPlayerParty)
        closemessage
    }
     
    Last edited:

    cbt

    1
    Posts
    2
    Years
    • Seen Feb 4, 2022
    [EM] Allow player to change direction while moving

    In Gen 3 games, when moving horizontally (left/right), pressing up/down will change the player's direction to face up/down.
    However, when moving vertically (up/down), pressing left/right will not make the player turn, and the player keeps going as before!
    This modification lets the player turn regardless of direction, similar to games in later generations.

    See the difference:
    Spoiler:


    Code changes:
    Spoiler:
     
    39
    Posts
    3
    Years
    • Seen Aug 23, 2023
    [PokeEmerald] Surfboard instead of HM Surf​
    Spoiler:

    Hi, want to check if anyone else encountered this: You can jump off bridges and northward cliffs
    Simple Modifications Directory
    Simple Modifications Directory
    Simple Modifications Directory


    If I'm not wrong, the new CanStartSurfing() checks if the tile to jump to is water, but not the player's tile, and the other check for COLLISION_ELEVATION_MISMATCH is not sufficient (???). The game has its own IsPlayerFacingSurfableFishableWater(), which additionally checks the player's tile for ZCoord == 3:
    Simple Modifications Directory

    I changed CanStartSurfing() to use IsPlayerFacingSurfableFishableWater():
    Code:
    static bool8 CanStartSurfing(s16 x, s16 y, u8 direction)
    {
        if (CheckBagHasItem(ITEM_SURFBOARD, 1) == FALSE)
        {
            return FALSE;
        }
    
        if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ON_FOOT)        //also remove to jump from bike, side effects unknown
    [COLOR="Red"]-     && MapGridGetZCoordAt(x, y) == 1[/COLOR]
    [COLOR="Lime"]+    && IsPlayerFacingSurfableFishableWater()[/COLOR]
         && GetObjectEventIdByXYZ(x, y, 1) == OBJECT_EVENTS_COUNT)
        {
            CreateStartSurfingTask(direction);
            return TRUE;
        }
        else
        {
            return FALSE;
        }
    }
    Simple Modifications Directory
     
    17
    Posts
    3
    Years
    • Seen May 10, 2024
    [EM] Adding Footprints
    So I wondered how I can add more unique footprints for....a certain follower mon commit by Merrp
    took a bit of fiddling and crashes, but I managed to add 3 new ones
    https://youtu.be/wi488feAkqU
    Here's how I did it
    First, make the pics to then place in graphics/field_effects/pics
    Spoiler:


    edit spritesheet_rules.mk

    Code:
    $(FLDEFFGFXDIR)/slither_tracks.4bpp: %.4bpp: %.png
    	$(GFX) $< $@ -mwidth 2 -mheight 2
    
    $(FLDEFFGFXDIR)/bug_tracks.4bpp: %.4bpp: %.png
    	$(GFX) $< $@ -mwidth 2 -mheight 2
    
    $(FLDEFFGFXDIR)/spot_tracks.4bpp: %.4bpp: %.png
    	$(GFX) $< $@ -mwidth 2 -mheight 2

    Then in include/constants, in field_effects.h

    Code:
    #define FLDEFF_MOVE_DEOXYS_ROCK          66
    [COLOR="SeaGreen"]#define FLDEFF_TRACKS_SLITHER            67
    #define FLDEFF_TRACKS_SPOT               68
    #define FLDEFF_TRACKS_BUG                69[/COLOR]

    Along with

    Code:
    #define FLDEFFOBJ_RAYQUAZA              36
    [COLOR="SeaGreen"]#define FLDEFFOBJ_TRACKS_SLITHER        37
    #define FLDEFFOBJ_TRACKS_SPOT           38
    #define FLDEFFOBJ_TRACKS_BUG            39[/COLOR]

    Then in event_objects.h, add the following

    Code:
    #define TRACKS_NONE       0
    #define TRACKS_FOOT       1
    #define TRACKS_BIKE_TIRE  2
    [COLOR="SeaGreen"]#define TRACKS_SLITHER    3
    #define TRACKS_SPOT       4
    #define TRACKS_BUG        5[/COLOR]

    Followed by these sets in data/field_effect_script.s

    Code:
    	.4byte gFieldEffectScript_MoveDeoxysRock            @ FLDEFF_MOVE_DEOXYS_ROCK
    [COLOR="SeaGreen"]	.4byte gFieldEffectScript_TracksSlither             @ FLDEFF_TRACKS_SLITHER
    	.4byte gFieldEffectScript_TracksBug                 @ FLDEFF_TRACKS_BUG
    	.4byte gFieldEffectScript_TracksSpot                @ FLDEFF_TRACKS_SPOT[/COLOR]

    And

    Code:
    gFieldEffectScript_SandFootprints:: @ 82DBB42
    	field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_SandFootprints
    	field_eff_end
    
    [COLOR="SeaGreen"]gFieldEffectScript_TracksBug:: @ 82DBB42
    	field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_TracksBug
    	field_eff_end
    
    gFieldEffectScript_TracksSpot:: @ 82DBB42
    	field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_TracksSpot
    	field_eff_end[/COLOR]

    Code:
    gFieldEffectScript_BikeTireTracks:: @ 82DBBFF
    	field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_BikeTireTracks
    	field_eff_end
    
    [COLOR="SeaGreen"]gFieldEffectScript_TracksSlither:: @ 82DBBFF
    	field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_TracksSlither
    	field_eff_end[/COLOR]

    If it wasn't clear, Slither's is based on the bike tracks, while bug and spot are based on footprints
    ------------------------------------------------------------------------------------------------------------------------------------

    In src/event_object_movement.c, we will make copies of the existing track functions for compatibility. First, add the new voids near the top

    Code:
    static void DoTracksGroundEffect_Footprints(struct ObjectEvent*, struct Sprite*, u8);
    [COLOR="SeaGreen"]static void DoTracksGroundEffect_FootprintsB(struct ObjectEvent*, struct Sprite*, u8);
    static void DoTracksGroundEffect_FootprintsC(struct ObjectEvent*, struct Sprite*, u8);[/COLOR]
    static void DoTracksGroundEffect_BikeTireTracks(struct ObjectEvent*, struct Sprite*, u8);
    [COLOR="SeaGreen"]static void DoTracksGroundEffect_SlitherTracks(struct ObjectEvent*, struct Sprite*, u8);[/COLOR]

    in
    Code:
    static void (*const sGroundEffectTracksFuncs[])
    , add to the list
    Code:
        DoTracksGroundEffect_None,
        DoTracksGroundEffect_Footprints,
        DoTracksGroundEffect_BikeTireTracks,
    	[COLOR="SeaGreen"]DoTracksGroundEffect_SlitherTracks,
    	DoTracksGroundEffect_FootprintsC,
    	DoTracksGroundEffect_FootprintsB,[/COLOR]

    The order actually matters, so beware!

    For the DoTracksX's....

    Code:
    [SPOILER]static void DoTracksGroundEffect_Footprints(struct ObjectEvent *objEvent, struct Sprite *sprite, u8 a)
    {
        // First half-word is a Field Effect script id. (gFieldEffectScriptPointers)
        u16 sandFootprints_FieldEffectData[2] = {
            FLDEFF_SAND_FOOTPRINTS,
            FLDEFF_DEEP_SAND_FOOTPRINTS
        };
    
        gFieldEffectArguments[0] = objEvent->previousCoords.x;
        gFieldEffectArguments[1] = objEvent->previousCoords.y;
        gFieldEffectArguments[2] = 149;
        gFieldEffectArguments[3] = 2;
        gFieldEffectArguments[4] = objEvent->facingDirection;
    	if (Random() % 2 == 0)
    		PlaySE(SE_M_SAND_ATTACK);
    	if (Random() % 2 == 1)
    		PlaySE12WithPanning(SE_M_SAND_ATTACK, 1);
        FieldEffectStart(sandFootprints_FieldEffectData[a]);
    }
    
    [COLOR="SeaGreen"]static void DoTracksGroundEffect_FootprintsB(struct ObjectEvent *objEvent, struct Sprite *sprite, u8 a)
    {
    	// First half-word is a Field Effect script id. (gFieldEffectScriptPointers)
    	u16 otherFootprintsA_FieldEffectData[2] = {
    		FLDEFF_TRACKS_SPOT,
    		FLDEFF_TRACKS_SPOT
    	};
    
    	gFieldEffectArguments[0] = objEvent->previousCoords.x;
    	gFieldEffectArguments[1] = objEvent->previousCoords.y;
    	gFieldEffectArguments[2] = 149;
    	gFieldEffectArguments[3] = 2;
    	gFieldEffectArguments[4] = objEvent->facingDirection;
    	if (Random() % 2 == 0)
    		PlaySE(SE_M_SAND_ATTACK);
    	if (Random() % 2 == 1)
    		PlaySE12WithPanning(SE_M_SAND_ATTACK, 1);
    	FieldEffectStart(otherFootprintsA_FieldEffectData[a]);
    }
    
    static void DoTracksGroundEffect_FootprintsC(struct ObjectEvent *objEvent, struct Sprite *sprite, u8 a)
    {
    	// First half-word is a Field Effect script id. (gFieldEffectScriptPointers)
    	u16 otherFootprintsB_FieldEffectData[2] = {
    		FLDEFF_TRACKS_BUG,
    		FLDEFF_TRACKS_BUG
    	};
    
    	gFieldEffectArguments[0] = objEvent->previousCoords.x;
    	gFieldEffectArguments[1] = objEvent->previousCoords.y;
    	gFieldEffectArguments[2] = 149;
    	gFieldEffectArguments[3] = 2;
    	gFieldEffectArguments[4] = objEvent->facingDirection;
    	if (Random() % 2 == 0)
    		PlaySE(SE_M_SAND_ATTACK);
    	if (Random() % 2 == 1)
    		PlaySE12WithPanning(SE_M_SAND_ATTACK, 1);
    	FieldEffectStart(otherFootprintsB_FieldEffectData[a]);
    }[/COLOR]
    
    static void DoTracksGroundEffect_BikeTireTracks(struct ObjectEvent *objEvent, struct Sprite *sprite, u8 a)
    {
        //  Specifies which bike track shape to show next.
        //  For example, when the bike turns from up to right, it will show
        //  a track that curves to the right.
        //  Each 4-byte row corresponds to the initial direction of the bike, and
        //  each byte in that row is for the next direction of the bike in the order
        //  of down, up, left, right.
        static const u8 bikeTireTracks_Transitions[4][4] = {
            1, 2, 7, 8,
            1, 2, 6, 5,
            5, 8, 3, 4,
            6, 7, 3, 4,
        };
    
        if (objEvent->currentCoords.x != objEvent->previousCoords.x || objEvent->currentCoords.y != objEvent->previousCoords.y)
        {
            gFieldEffectArguments[0] = objEvent->previousCoords.x;
            gFieldEffectArguments[1] = objEvent->previousCoords.y;
            gFieldEffectArguments[2] = 149;
            gFieldEffectArguments[3] = 2;
            gFieldEffectArguments[4] =
                bikeTireTracks_Transitions[objEvent->previousMovementDirection][objEvent->facingDirection - 5];
            FieldEffectStart(FLDEFF_BIKE_TIRE_TRACKS);
        }
    }
    
    [COLOR="SeaGreen"]static void DoTracksGroundEffect_SlitherTracks(struct ObjectEvent *objEvent, struct Sprite *sprite, u8 a)
    {
    	//  Specifies which bike track shape to show next.
    	//  For example, when the bike turns from up to right, it will show
    	//  a track that curves to the right.
    	//  Each 4-byte row corresponds to the initial direction of the bike, and
    	//  each byte in that row is for the next direction of the bike in the order
    	//  of down, up, left, right.
    	static const u8 slitherTracks_Transitions[4][4] = {
    		1, 2, 7, 8,
    		1, 2, 6, 5,
    		5, 8, 3, 4,
    		6, 7, 3, 4,
    	};
    
    	if (objEvent->currentCoords.x != objEvent->previousCoords.x || objEvent->currentCoords.y != objEvent->previousCoords.y)
    	{
    		gFieldEffectArguments[0] = objEvent->previousCoords.x;
    		gFieldEffectArguments[1] = objEvent->previousCoords.y;
    		gFieldEffectArguments[2] = 149;
    		gFieldEffectArguments[3] = 2;
    		gFieldEffectArguments[4] =
    			slitherTracks_Transitions[objEvent->previousMovementDirection][objEvent->facingDirection - 5];
    		FieldEffectStart(FLDEFF_TRACKS_SLITHER);
    	}
    }[/COLOR][/SPOILER]

    Moving on, in src/data/field_effects/field_effects_object_template_pointers.h

    Code:
    const struct SpriteTemplate gFieldEffectObjectTemplate_Rayquaza;
    [COLOR="SeaGreen"]const struct SpriteTemplate gFieldEffectObjectTemplate_SlitherTracks;
    const struct SpriteTemplate gFieldEffectObjectTemplate_BugTracks;
    const struct SpriteTemplate gFieldEffectObjectTemplate_SpotTracks;[/COLOR]

    And
    Code:
      [FLDEFFOBJ_RAYQUAZA]              = &gFieldEffectObjectTemplate_Rayquaza,
    [COLOR="SeaGreen"][FLDEFFOBJ_TRACKS_SLITHER]        = &gFieldEffectObjectTemplate_SlitherTracks,
        [FLDEFFOBJ_TRACKS_SPOT]           = &gFieldEffectObjectTemplate_SpotTracks,
        [FLDEFFOBJ_TRACKS_BUG]            = &gFieldEffectObjectTemplate_BugTracks,[/COLOR]

    Followed by src/data/field_effects/field_effect_objects.h

    Spoiler:

    Then graphics defines in src/data/object_events/object_event_graphics.h

    Code:
    const u32 gFieldEffectObjectPic_BikeTireTracks[] = INCBIN_U32("graphics/field_effects/pics/bike_tire_tracks.4bpp");
    [COLOR="SeaGreen"]const u32 gFieldEffectObjectPic_SlitherTracks[] = INCBIN_U32("graphics/field_effects/pics/slither_tracks.4bpp");
    const u32 gFieldEffectObjectPic_SpotTracks[] = INCBIN_U32("graphics/field_effects/pics/spot_tracks.4bpp");
    const u32 gFieldEffectObjectPic_BugTracks[] = INCBIN_U32("graphics/field_effects/pics/bug_tracks.4bpp");[/COLOR]

    And finally, for src/field_effect_helpers.c

    Spoiler:

    And it should be set. Just use TRACKS_BUG/TRACKS_SLITHER/TRACKS_SPOT in the footprint section in src/data/object_events/object_event_graphics_info.h for the specific OW object you want, and you should be set
     
    1,591
    Posts
    10
    Years
    • Seen Mar 20, 2024
    Showing IVs/EVs in Summary Screen [EM]

    Here's a quick demonstration of how it looks:

    Simple Modifications Directory

    Just like in the older version, the nature coloring is only shown when the regular stats are being displayed (this Grovyle is Docile, so that's why there's no coloring here). This can be changed by editing the second value in BufferStat calls for cases 0 and 1. See the calls in case 2 to see how they work.
    [/SPOILER]

    If you'd like, you can use both the old and the new methods in tandem, as they don't conflict with each other. Thanks again to AkimotoBubble for their code.

    Thought I'd share my modification of this too, as another option. I've tweaked AkimotoBubble's method a bit so that instead of pressing a different button for each set of stats, you can press A repeatedly to cycle through all of them:
    Simple Modifications Directory

    Changes required are viewable in a commit here: link.
     

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • Force load offscreen object events with a flag [Em]
    Well, there isn't much to say.
    Normally, object events are not loaded until they're just about to be visible on the screen.
    Something like this can be troublesome in very specific cases.
    One such case is if you want to write a cutscene where the camera slowly moves to a certain object event that is standing near water.
    The reflection won't be loaded until the object event is about to get on screen, and will thus look as if it popped out of nowhere, instead of being there all along.

    So what did I do to deal with this very specific thing?
    I added a flag that while set, forcefully makes the game load the objects that are outside of the screen.
    The usage I gave to it is simple. I set it before being warped into a map in order to start an event, and then I cleared it before the end of said event.

    To implement this, we'll go to the src/event_object_movement.c file. Specifically, to the UpdateObjectEventOffscreen function.
    As we can see, this function updates the status of an object event to signal whether it's outside of the screen or not.
    To keep our object events loaded, we just need to add a check however we want, that sets the offScreen value of the object event according to our needs.
    In my case, I decided to define a flag. When it's set, every NPC will be considered to be within the game's screen, so we'll add a new if statement like this:
    Code:
        if ((s16)x >= DISPLAY_WIDTH + 16 || (s16)x2 < -16)
            objectEvent->offScreen = TRUE;
    
        if ((s16)y >= DISPLAY_HEIGHT + 16 || (s16)y2 < -16)
            objectEvent->offScreen = TRUE;
    
    [COLOR="SeaGreen"]    if (FlagGet(FLAG_FORCE_LOAD_OFFSCREEN_OBJEV))
            objectEvent->offScreen = FALSE;[/COLOR]

    And that's pretty much it.​
     
    Last edited:
    1,591
    Posts
    10
    Years
    • Seen Mar 20, 2024
    Create Pokémon with Three Perfect IVs (Emerald)

    From XY onwards, certain Pokémon (usually legendaries, but not exclusively) will always have a minimum of three "perfect" IVs.

    One way to implement that in Pokeemerald is the following:

    First, we need to know where a Pokémon's IVs are chosen - that's handled in CreateBoxMon() in pokemon.c. Next, we need a way to choose three random stats, making sure that the three chosen are always different - you don't want to choose the same stat twice and make a two IV mon instead! So what we'll do is this: create an array representing each stat, shuffle it, and choose the first three elements as the IVs to be set to 31.

    Add at the top of CreateBoxMon(), add these variables:
    Code:
    u8 maxIV = MAX_IV_MASK;
    u8 statIDs[] = {0, 1, 2, 3, 4, 5};

    If you scroll down a bit you'll see a block of code that looks like this:
    Spoiler:
    This is what normally sets IVs for any mon with randomly generated stats. Below this code, within the else, add the following:
    Spoiler:
    This will set three random IVs to 31 and leave the other three as whatever random value they were initially set to. Of course, that code will only work if ShuffleStatArray() has been implemented, so at the bottom of the file we'll add this function:
    Spoiler:
    Don't forget to declare ShuffleStatArray() with the other function declarations near the top of pokemon.c: static void ShuffleStatArray(u8* statArray);.

    Important: as it is, this code will make all Pokémon the player encounters have three perfect IVs. If you only want it to apply to some Pokémon, you'll need to add some sort of check around the newly added code that sets the three perfect stats.
     

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • Get or Set a Pokémon's Seen/Caught flag from within a script [Em]
    I was playtesting my personal project and I thought: "wouldn't it be cool if the Shroomish-loving guy from Petalburg Woods rewarded the Player if they actually got one"?
    That thought led to me making this.

    To summarize, I added some code functions that Get or Set the Seen and/or Caught flags of a Pokémon.
    There's GetSeenMon and GetCaughtMon to check whether the Player has Seen or Caught a Pokémon.
    And then there's SetSeenMon and SetCaughtMon to set a Pokémon's Seen and/or Caught flags.

    Since my original intent was to use this stuff from within overworld scripts, I also added scripting macros that make use of them.
    The macros are easy to understand if you read them.

    To implement this, you can track my GitHub repository via git remote and pull the branch dexSeenCaughtFlags which is where I'm hosting the code:
    Code:
    git remote add lunos https://github.com/LOuroboros/pokeemerald
    git pull lunos dexSeenCaughtFlags
    Or you can implement it manually:
    https://github.com/LOuroboros/pokeemerald/commit/44a4be3a1c16a4937ab0561c288adeed944f5ee7
    Your choice.

    And that's pretty much it.​
     
    Last edited:
    Back
    Top