Skip to content

Commit

Permalink
Reset all battler IDs at battle start (#3111)
Browse files Browse the repository at this point in the history
* reset battler IDs before BattleScript_OverworldTerrain and BattleScript_OverworldWeatherStarts to prevent playanimation from executing on invalid battler ids

* replace BS_SCRIPTING with BS_BATTLER_0 in BattleScript_OverworldTerrain and BattleScript_OverworldWeatherStarts

---------

Co-authored-by: ghoulslash <pokevoyager0@gmail.com>
  • Loading branch information
ghoulslash and ghoulslash authored Aug 4, 2023
1 parent 7d8bcce commit 4ae6ae4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -6793,14 +6793,14 @@ BattleScript_SunlightFaded::
BattleScript_OverworldWeatherStarts::
printfromtable gWeatherStartsStringIds
waitmessage B_WAIT_TIME_LONG
playanimation_var BS_ATTACKER, sB_ANIM_ARG1
playanimation_var BS_BATTLER_0, sB_ANIM_ARG1
call BattleScript_ActivateWeatherAbilities
end3

BattleScript_OverworldTerrain::
printfromtable gTerrainStringIds
waitmessage B_WAIT_TIME_LONG
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG
playanimation BS_BATTLER_0, B_ANIM_RESTORE_BG
call BattleScript_ActivateTerrainEffects
end3

Expand Down
3 changes: 3 additions & 0 deletions src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3129,6 +3129,9 @@ static void BattleStartClearSetData(void)

gBattlerAttacker = 0;
gBattlerTarget = 0;
gEffectBattler = 0;
gBattleScripting.battler = 0;
gBattlerAbility = 0;
gBattleWeather = 0;
gHitMarker = 0;

Expand Down

0 comments on commit 4ae6ae4

Please sign in to comment.