tumbledemerald-legacy/data/maps/DesertRuins/scripts.inc
2022-05-19 17:14:13 +00:00

87 lines
2.5 KiB
PHP

DesertRuins_MapScripts::
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:
call_if_set FLAG_SYS_CTRL_OBJ_DELETE, DesertRuins_EventScript_TryRemoveRegirock
end
DesertRuins_EventScript_TryRemoveRegirock::
specialvar VAR_RESULT, GetBattleOutcome
goto_if_ne VAR_RESULT, B_OUTCOME_CAUGHT, Common_EventScript_NopReturn
removeobject VAR_LAST_TALKED
return
DesertRuins_OnLoad:
call_if_unset FLAG_SYS_REGIROCK_PUZZLE_COMPLETED, DesertRuins_EventScript_HideRegiEntrance
end
DesertRuins_EventScript_HideRegiEntrance::
setmetatile 7, 19, METATILE_Cave_EntranceCover, TRUE
setmetatile 8, 19, METATILE_Cave_EntranceCover, TRUE
setmetatile 9, 19, METATILE_Cave_EntranceCover, TRUE
setmetatile 7, 20, METATILE_Cave_SealedChamberBraille_Mid, TRUE
setmetatile 8, 20, METATILE_Cave_SealedChamberBraille_Mid, TRUE
setmetatile 9, 20, METATILE_Cave_SealedChamberBraille_Mid, TRUE
return
DesertRuins_OnTransition:
setflag FLAG_LANDMARK_DESERT_RUINS
call_if_unset FLAG_DEFEATED_REGIROCK, DesertRuins_EventScript_ShowRegirock
end
DesertRuins_EventScript_ShowRegirock::
clearflag FLAG_HIDE_REGIROCK
return
DesertRuins_EventScript_CaveEntranceMiddle::
lockall
goto_if_set FLAG_SYS_REGIROCK_PUZZLE_COMPLETED, DesertRuins_EventScript_BigHoleInWall
braillemsgbox DesertRuins_Braille_UseRockSmash
releaseall
end
DesertRuins_EventScript_BigHoleInWall::
msgbox gText_BigHoleInTheWall, MSGBOX_DEFAULT
releaseall
end
DesertRuins_EventScript_CaveEntranceSide::
lockall
braillemsgbox DesertRuins_Braille_UseRockSmash
releaseall
end
DesertRuins_EventScript_Regirock::
lock
faceplayer
waitse
playmoncry SPECIES_REGIROCK, CRY_MODE_ENCOUNTER
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
goto_if_eq VAR_RESULT, B_OUTCOME_WON, DesertRuins_EventScript_DefeatedRegirock
goto_if_eq VAR_RESULT, B_OUTCOME_RAN, DesertRuins_EventScript_RanFromRegirock
goto_if_eq VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED, DesertRuins_EventScript_RanFromRegirock
setflag FLAG_DEFEATED_REGIROCK
release
end
DesertRuins_EventScript_DefeatedRegirock::
setflag FLAG_DEFEATED_REGIROCK
goto Common_EventScript_RemoveStaticPokemon
end
DesertRuins_EventScript_RanFromRegirock::
setvar VAR_0x8004, SPECIES_REGIROCK
goto Common_EventScript_LegendaryFlewAway
end