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

[Battle] Physical moves only battle

17
Posts
3
Years
    • Seen Jul 8, 2022
    Hello,

    As the title suggests I would like to create a "physical moves only battle". So I thought the way I could set this up, is by setting a flag before the battle starts and then in the function static void HandleInputChooseMove(void) in src/battle_controller_player.c I would check wether the flag is set and then use IS_MOVE_PHYSICAL(move) mentioned in include/battle.h to check whether a move is physical or not. instead of "move" I had put gMoveSelectionCursor[gActiveBattler]. Obviously this didnt work otherwise I wouldnt be posting here 😅. I was wondering if anybody knows what to do or has a different way to set this up.

    Here is my current HandleInputChooseMove, keep in mind I was just trying stuff so the coding is probably kinda messy
    Spoiler:
     
    447
    Posts
    6
    Years
    • Seen today
    Hello,

    As the title suggests I would like to create a "physical moves only battle". So I thought the way I could set this up, is by setting a flag before the battle starts and then in the function static void HandleInputChooseMove(void) in src/battle_controller_player.c I would check wether the flag is set and then use IS_MOVE_PHYSICAL(move) mentioned in include/battle.h to check whether a move is physical or not. instead of "move" I had put gMoveSelectionCursor[gActiveBattler]. Obviously this didnt work otherwise I wouldnt be posting here 😅. I was wondering if anybody knows what to do or has a different way to set this up.

    Here is my current HandleInputChooseMove, keep in mind I was just trying stuff so the coding is probably kinda messy
    Spoiler:

    Based on this line of code
    Code:
    if (moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] == MOVE_CURSE)

    it would seem that moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] contains the selected move instead of gMoveSelectionCursor[gActiveBattler].
    In that case you should instead check:
    Code:
    if(IS_MOVE_PHYSICAL(moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]) == TRUE)
     
    17
    Posts
    3
    Years
    • Seen Jul 8, 2022
    Based on this line of code
    Code:
    if (moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] == MOVE_CURSE)

    it would seem that moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] contains the selected move instead of gMoveSelectionCursor[gActiveBattler].
    In that case you should instead check:
    Code:
    if(IS_MOVE_PHYSICAL(moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]) == TRUE)

    Thanks for the response!

    Tried this but it didn't change anything, can still use other moves besides physical. Maybe this isn't the right function to set this up in
     
    447
    Posts
    6
    Years
    • Seen today
    Thanks for the response!

    Tried this but it didn't change anything, can still use other moves besides physical. Maybe this isn't the right function to set this up in

    You could maybe add the check in the same places where choice items are handled.
     
    17
    Posts
    3
    Years
    • Seen Jul 8, 2022
    You could maybe add the check in the same places where choice items are handled.

    Thats a good idea. I'll look into that, thank you! Edit: Still can't seem to get it working. If someone has any ideas please share them
     
    Last edited:
    447
    Posts
    6
    Years
    • Seen today
    i can still use non-physical moves, for example using ember en growl when using torchic instead of only being able to use scratch

    I can't tell you what you did wrong since I have no idea what you did, but I tried making the change myself and it seems to work.

    WBfojHw.gif


    I edited pokeemerald-expansion but the edited code is pretty similar to vanilla pokeemerald.

    include/constants/flags.h
    Code:
    [COLOR="Red"]-#define FLAG_UNUSED_0x020    0x20 // Unused Flag[/COLOR]
    [COLOR="PaleGreen"]+#define FLAG_PHYS_MOVE_BATTLE    0x20[/COLOR]

    src/battle_util.c
    Code:
    @@ -1705,7 +1705,14 @@ u8 TrySetCantSelectMoveBattleScript(void)
         u32 move = gBattleMons[gActiveBattler].moves[moveId];
         u32 holdEffect = GetBattlerHoldEffect(gActiveBattler, TRUE);
         u16 *choicedMove = &gBattleStruct->choicedMove[gActiveBattler];
    [COLOR="PaleGreen"]+	
    +	if (FlagGet(FLAG_PHYS_MOVE_BATTLE) && !IS_MOVE_PHYSICAL(move)){
    +        gBattleScripting.battler = gActiveBattler;
    +        gCurrentMove = move;
    +        gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingDisabledMove;
    +        limitations++;
    +    }
    +	[/COLOR]
         if (gDisableStructs[gActiveBattler].disabledMove == move && move != MOVE_NONE)
         {
             gBattleScripting.battler = gActiveBattler;
    
    
    @@ -1958,6 +1965,9 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
             // Gorilla Tactics
             else if (GetBattlerAbility(battlerId) == ABILITY_GORILLA_TACTICS && *choicedMove != MOVE_NONE && *choicedMove != 0xFFFF && *choicedMove != gBattleMons[battlerId].moves[i])
                 unusableMoves |= gBitTable[i];
    [COLOR="PaleGreen"]+		//Physical move only battle
    +		else if(FlagGet(FLAG_PHYS_MOVE_BATTLE) && !IS_MOVE_PHYSICAL(gBattleMons[battlerId].moves[i]))
    +			unusableMoves |= gBitTable[i];[/COLOR]
         }
         return unusableMoves;
     }

    You might want to replace BattleScript_SelectingDisabledMove with a more fitting custom script.
     
    17
    Posts
    3
    Years
    • Seen Jul 8, 2022
    Spoiler:

    Ah you are the best! Seems I made a mistake in TrySetCantSelectMoveBattleScript, but it works now! Thank you very much for the help and the quick replies!
     
    Back
    Top