• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • 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.

[pokeemerald] Need help "AI controls my pokemon" script

  • 6
    Posts
    1
    Years
    • Seen yesterday
    Hi everyone, I recently became interested in decomp romhacking.
    I would like to do this:
    when you select "fight" during a battle, ai chooses the move to make.

    I think I found the point where I can insert the code:
    in battle_main_c
    case B_ACTION_USE_MOVE:
    ...


    and maybe can i copy the code from:
    battle_controller_opponent
    static void OpponentHandleChooseMove(void)
    {
    ....



    any suggestions?

    Thx.
     
    Hi everyone, I recently became interested in decomp romhacking.
    I would like to do this:
    when you select "fight" during a battle, ai chooses the move to make.

    I think I found the point where I can insert the code:
    in battle_main_c
    case B_ACTION_USE_MOVE:
    ...


    and maybe can i copy the code from:
    battle_controller_opponent
    static void OpponentHandleChooseMove(void)
    {
    ....



    any suggestions?

    Thx.
    The game already has the logic for doing that in battle palace. See PlayerHandleChooseMove in src/battle_controller_player.c.
     
    found, tested and....work! dude you changed my day.
    THX!

    edit:
    sorry, have this problem:
    sometimes (random) my pokemon hits itself.
    Is there any value to set to prevent this from happening?
     
    Last edited:
    update:
    I have to test more to be sure but...
    I think I found the problem:
    in the Battle Place when the pokemon does not find a move compatible with nature, use a random move. this used move is put in the list of moves "won't be used anymore".
    if that move is used again in the following turn, the "penalty" reaction is triggered and the pokemon hits itself.
    this happens especially in low level pokemon with only 2 moves to use.
    so to avoid this I eliminated the logic "won't be used anymore".
    Now I seem to have solved the problem.
     
    update:
    I have to test more to be sure but...
    I think I found the problem:
    in the Battle Place when the pokemon does not find a move compatible with nature, use a random move. this used move is put in the list of moves "won't be used anymore".
    if that move is used again in the following turn, the "penalty" reaction is triggered and the pokemon hits itself.
    this happens especially in low level pokemon with only 2 moves to use.
    so to avoid this I eliminated the logic "won't be used anymore".
    Now I seem to have solved the problem.
    Is there a way to do this for pokémon fire red
     
    Back
    Top