DesertRuins_MapScripts:: @ 822D95B map_script MAP_SCRIPT_ON_RESUME, DesertRuins_OnResume map_script MAP_SCRIPT_ON_LOAD, DesertRuins_OnLoad map_script MAP_SCRIPT_ON_TRANSITION, DesertRuins_OnTransition .byte 0 DesertRuins_OnResume: @ 822D96B call_if_set FLAG_SYS_CTRL_OBJ_DELETE, DesertRuins_EventScript_TryRemoveRegirock end DesertRuins_EventScript_TryRemoveRegirock:: @ 822D975 specialvar VAR_RESULT, GetBattleOutcome compare VAR_RESULT, B_OUTCOME_CAUGHT goto_if_ne Common_EventScript_NopReturn removeobject VAR_LAST_TALKED return DesertRuins_OnLoad: @ 822D989 call_if_unset FLAG_SYS_REGIROCK_PUZZLE_COMPLETED, DesertRuins_EventScript_HideRegiEntrance end DesertRuins_EventScript_HideRegiEntrance:: @ 822D993 setmetatile 7, 19, METATILE_Cave_EntranceCover, 1 setmetatile 8, 19, METATILE_Cave_EntranceCover, 1 setmetatile 9, 19, METATILE_Cave_EntranceCover, 1 setmetatile 7, 20, METATILE_Cave_SealedChamberBraille_Mid, 1 setmetatile 8, 20, METATILE_Cave_SealedChamberBraille_Mid, 1 setmetatile 9, 20, METATILE_Cave_SealedChamberBraille_Mid, 1 return DesertRuins_OnTransition: @ 822D9CA setflag FLAG_LANDMARK_DESERT_RUINS call_if_unset FLAG_DEFEATED_REGIROCK, DesertRuins_EventScript_ShowRegirock end DesertRuins_EventScript_ShowRegirock:: @ 822D9D7 clearflag FLAG_HIDE_REGIROCK return DesertRuins_EventScript_CaveEntranceMiddle:: @ 822D9DB lockall goto_if_set FLAG_SYS_REGIROCK_PUZZLE_COMPLETED, DesertRuins_EventScript_BigHoleInWall braillemessage DesertRuins_Braille_UseRockSmash waitbuttonpress closebraillemessage releaseall end DesertRuins_EventScript_BigHoleInWall:: @ 822D9EE msgbox gText_BigHoleInTheWall, MSGBOX_DEFAULT releaseall end DesertRuins_EventScript_CaveEntranceSide:: @ 822D9F8 lockall braillemessage DesertRuins_Braille_UseRockSmash waitbuttonpress closebraillemessage releaseall end DesertRuins_EventScript_Regirock:: @ 822DA02 lock faceplayer waitse playmoncry SPECIES_REGIROCK, 2 delay 40 waitmoncry setwildbattle SPECIES_REGIROCK, 40, ITEM_NONE setflag FLAG_SYS_CTRL_OBJ_DELETE special StartRegiBattle waitstate clearflag FLAG_SYS_CTRL_OBJ_DELETE specialvar VAR_RESULT, GetBattleOutcome compare VAR_RESULT, B_OUTCOME_WON goto_if_eq DesertRuins_EventScript_DefeatedRegirock compare VAR_RESULT, B_OUTCOME_RAN goto_if_eq DesertRuins_EventScript_RanFromRegirock compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED goto_if_eq DesertRuins_EventScript_RanFromRegirock setflag FLAG_DEFEATED_REGIROCK release end DesertRuins_EventScript_DefeatedRegirock:: @ 822DA49 setflag FLAG_DEFEATED_REGIROCK goto Common_EventScript_RemoveStaticPokemon end DesertRuins_EventScript_RanFromRegirock:: @ 822DA52 setvar VAR_0x8004, SPECIES_REGIROCK goto Common_EventScript_LegendaryFlewAway end