- 17
- Posts
- 1
- Years
- Seen Nov 30, 2024
I'm trying to trigger the Itemfinder effect every time the player takes a step. (I know it seems weird, but I'm developing my own feature branch and this is my first step.)
I figured I could just include the item_use.h file at the top of field_control_avatar.c and then call the ItemUseOutOfBattle_Itemfinder function within ProcessPlayerFieldInput where the game checks to see if you've taken a step. Like so:
This compiles successfully, but has no effect when I take a step in game. Is this due to the fact that ItemUseOutOfBattle_Itemfinder has an associated u8 var that is not being included when I call it? If so, where is this var initialized?
I'm probably just out of my depth here. I have a decent grasp on how C works (even if my lingo is terrible), but trying to understand how pokeemerald's code is written has proven challenging.
I figured I could just include the item_use.h file at the top of field_control_avatar.c and then call the ItemUseOutOfBattle_Itemfinder function within ProcessPlayerFieldInput where the game checks to see if you've taken a step. Like so:
Spoiler:
Code:
if (input->tookStep)
{
IncrementGameStat(GAME_STAT_STEPS);
IncrementBirthIslandRockStepCount();
if (TryStartStepBasedScript(&position, metatileBehavior, playerDirection) == TRUE)
return TRUE;
//itemfinderchange
ItemUseOutOfBattle_Itemfinder;
}
This compiles successfully, but has no effect when I take a step in game. Is this due to the fact that ItemUseOutOfBattle_Itemfinder has an associated u8 var that is not being included when I call it? If so, where is this var initialized?
I'm probably just out of my depth here. I have a decent grasp on how C works (even if my lingo is terrible), but trying to understand how pokeemerald's code is written has proven challenging.