• 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.

[SOLVED] [pokeemerald] Trying to activate Itemfinder effect without using the item

11
Posts
226
Days
    • Seen yesterday
    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:

    Spoiler:


    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.
     
    453
    Posts
    6
    Years
    • Seen May 17, 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:

    Spoiler:


    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.
    You claim to be decent at C but you don't know how to call a function? Your current code isn't calling anything.
    You're supposed to put parenthesis after the function's name and inside those parenthesis the arguments given to the function.
    In the case of ItemUseOnFieldCB_Itemfinder you need a single argument of type u8 and by reading the code you can see that it's supposed to be the id of a task.

    You can look at UseRegisteredKeyItemOnField for an example of how to call item functions in the field.
     
    11
    Posts
    226
    Days
    • Seen yesterday
    You claim to be decent at C but you don't know how to call a function? Your current code isn't calling anything.
    You're supposed to put parenthesis after the function's name and inside those parenthesis the arguments given to the function.
    In the case of ItemUseOnFieldCB_Itemfinder you need a single argument of type u8 and by reading the code you can see that it's supposed to be the id of a task.

    You can look at UseRegisteredKeyItemOnField for an example of how to call item functions in the field.
    I was unaware of the depth of my ignorance here. Thank you for taking the time to point me in the right direction. I'm sorry if this thread was inappropriate for me to post. I didn't mean to take up your time with something so basic. I'll try to be more careful with my own learning in the future.

    You were a great help. Thanks again!
     
    Back
    Top