.equ LOCALID_PROF_OAK,        4
.equ LOCALID_BULBASAUR_BALL,  5
.equ LOCALID_SQUIRTLE_BALL,   6
.equ LOCALID_CHARMANDER_BALL, 7
.equ LOCALID_RIVAL,           8
.equ LOCALID_POKEDEX_1,       9
.equ LOCALID_POKEDEX_2,       10

.equ PLAYER_STARTER_NUM,      VAR_TEMP_1
.equ PLAYER_STARTER_SPECIES,  VAR_TEMP_2
.equ RIVAL_STARTER_SPECIES,   VAR_TEMP_3
.equ RIVAL_STARTER_ID,        VAR_TEMP_4

.equ SHOWED_OAK_COMPLETE_DEX, FLAG_TEMP_2

PalletTown_ProfessorOaksLab_MapScripts:: @ 8168F7E
	map_script MAP_SCRIPT_ON_TRANSITION, PalletTown_ProfessorOaksLab_OnTransition
	map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, PalletTown_ProfessorOaksLab_OnWarp
	map_script MAP_SCRIPT_ON_FRAME_TABLE, PalletTown_ProfessorOaksLab_OnFrame
	.byte 0

PalletTown_ProfessorOaksLab_OnTransition:: @ 8168F8E
	setflag FLAG_VISITED_OAKS_LAB
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 1
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_ReadyOakForStarterScene
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 7
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_ReadyOakForNationalDexScene
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 8
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_SetNationalDexSceneFinished
	call_if_set FLAG_GOT_POKEBALLS_FROM_OAK_AFTER_22_RIVAL, PalletTown_ProfessorOaksLab_EventScript_SetSkipPokeBallCheck
	end

PalletTown_ProfessorOaksLab_EventScript_SetSkipPokeBallCheck:: @ 8168FBC
	setflag FLAG_OAK_SKIP_22_RIVAL_CHECK
	return

PalletTown_ProfessorOaksLab_EventScript_SetNationalDexSceneFinished:: @ 8168FC0
	setvar VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 9
	return

PalletTown_ProfessorOaksLab_EventScript_ReadyOakForStarterScene:: @ 8168FC6
	setobjectxyperm LOCALID_PROF_OAK, 6, 11
	setobjectmovementtype LOCALID_PROF_OAK, MOVEMENT_TYPE_FACE_UP
	savebgm MUS_OAK
	return

PalletTown_ProfessorOaksLab_EventScript_ReadyOakForNationalDexScene:: @ 8168FD5
	setobjectxyperm LOCALID_PROF_OAK, 6, 11
	setobjectmovementtype LOCALID_PROF_OAK, MOVEMENT_TYPE_FACE_UP
	return

PalletTown_ProfessorOaksLab_OnWarp:: @ 8168FE1
	map_script_2 VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 1, PalletTown_ProfessorOaksLab_EventScript_ReadyPlayerForStarterScene
	.2byte 0

PalletTown_ProfessorOaksLab_EventScript_ReadyPlayerForStarterScene:: @ 8168FEB
	turnobject OBJ_EVENT_ID_PLAYER, DIR_NORTH
	end

PalletTown_ProfessorOaksLab_OnFrame:: @ 8168FF0
	map_script_2 VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 1, PalletTown_ProfessorOaksLab_ChooseStarterScene
	map_script_2 VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 7, PalletTown_ProfessorOaksLab_EventScript_EnterForNationalDexScene
	.2byte 0

PalletTown_ProfessorOaksLab_EventScript_EnterForNationalDexScene:: @ 8169002 
	lockall
	setvar VAR_FACING, DIR_NORTH
	textcolor 0
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakEnter
	waitmovement 0
	removeobject LOCALID_PROF_OAK
	setobjectxyperm LOCALID_PROF_OAK, 6, 3
	setobjectmovementtype LOCALID_PROF_OAK, MOVEMENT_TYPE_FACE_DOWN
	clearflag FLAG_HIDE_OAK_IN_HIS_LAB
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_PlayerEnter
	waitmovement 0
	goto PalletTown_ProfessorOaksLab_EventScript_NationalDexScene
	end

PalletTown_ProfessorOaksLab_EventScript_NationalDexScene:: @ 8169035
	msgbox PalletTown_ProfessorOaksLab_Text_OakSightingsOfRareMons
	closemessage
	compare VAR_FACING, DIR_NORTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterNorth
	compare VAR_FACING, DIR_SOUTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterSouth
	compare VAR_FACING, DIR_EAST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterEastWest
	compare VAR_FACING, DIR_WEST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterEastWest
	msgbox PalletTown_ProfessorOaksLab_Text_RivalJustLetMeHandleEverything
	fadedefaultbgm
	msgbox PalletTown_ProfessorOaksLab_Text_OakNeedYourHelpTooNeedToSeePokedexes
	compare VAR_FACING, DIR_NORTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_PlayerFaceOakNorth
	compare VAR_FACING, DIR_WEST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_PlayerFaceOakWest
	textcolor 3
	msgbox PalletTown_ProfessorOaksLab_Text_OakTookBothPokedexUnits
	closemessage
	call EventScript_RestorePrevTextColor
	compare VAR_FACING, DIR_NORTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskNorth
	compare VAR_FACING, DIR_SOUTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskSouth
	compare VAR_FACING, DIR_EAST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskEast
	compare VAR_FACING, DIR_WEST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskWest
	addobject LOCALID_POKEDEX_1
	addobject LOCALID_POKEDEX_2
	delay 30
	msgbox PalletTown_ProfessorOaksLab_Text_OakNowTheseUnitsCanRecordMoreData
	closemessage
	removeobject LOCALID_POKEDEX_1
	removeobject LOCALID_POKEDEX_2
	delay 30
	compare VAR_FACING, DIR_NORTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverNorth
	compare VAR_FACING, DIR_SOUTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverSouth
	compare VAR_FACING, DIR_EAST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverEast
	compare VAR_FACING, DIR_WEST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverWest
	textcolor 3
	playfanfare MUS_OBTAIN_KEY_ITEM
	message PalletTown_ProfessorOaksLab_Text_PlayersPokedexWasUpgraded
	waitmessage
	waitfanfare
	call EventScript_RestorePrevTextColor
	special EnableNationalPokedex
	msgbox PalletTown_ProfessorOaksLab_Text_OakMustReallyWorkToFillPokedex
	msgbox PalletTown_ProfessorOaksLab_Text_RivalIllCompleteThePokedex
	closemessage
	playbgm MUS_RIVAL_EXIT, 0
	compare VAR_FACING, DIR_NORTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExitNorth
	compare VAR_FACING, DIR_SOUTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExit
	compare VAR_FACING, DIR_EAST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExit
	compare VAR_FACING, DIR_WEST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExit
	removeobject LOCALID_RIVAL
	fadedefaultbgm
	setvar VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 8
	releaseall
	end

PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterNorth:: @ 8169174
	setobjectxyperm LOCALID_RIVAL, 5, 10
	addobject LOCALID_RIVAL
	playbgm MUS_ENCOUNTER_RIVAL, 0
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_WatchRivalEnterNorth
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalEnter
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterEastWest:: @ 8169194
	setobjectxyperm LOCALID_RIVAL, 6, 10
	addobject LOCALID_RIVAL
	playbgm MUS_ENCOUNTER_RIVAL, 0
	applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_WatchRivalEnterEastWest
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalEnter
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterSouth:: @ 81691BB
	setobjectxyperm LOCALID_RIVAL, 6, 10
	addobject LOCALID_RIVAL
	playbgm MUS_ENCOUNTER_RIVAL, 0
	applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalEnter
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_PlayerFaceOakNorth:: @ 81691DB
	applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_PlayerFaceOakWest:: @ 81691E6
	applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskNorth:: @ 81691F1
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakBringDexesToDesk
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskSouth:: @ 81691FC
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakBringDexesToDeskSouth
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_WatchOakWalkToDesk
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_WatchOakWalkToDesk
	waitmovement LOCALID_PROF_OAK
	return

PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskEast:: @ 8169215
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakBringDexesToDesk
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_WatchOakWalkToDeskEast
	waitmovement LOCALID_PROF_OAK
	return

PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskWest:: @ 8169227
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakBringDexesToDesk
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_Movement_OakBringDexesToDesk:: @ 8169232
	walk_up
	walk_left
	walk_in_place_fastest_up
	delay_16
	delay_4
	step_end

PalletTown_ProfessorOaksLab_Movement_OakBringDexesToDeskSouth:: @ 8169238
	walk_left
	walk_left
	walk_up
	delay_16
	delay_4
	step_end

PalletTown_ProfessorOaksLab_ChooseStarterScene:: @ 816923E
	lockall
	textcolor 0
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakEnter
	waitmovement 0
	removeobject LOCALID_PROF_OAK
	setobjectxyperm LOCALID_PROF_OAK, 6, 3
	setobjectmovementtype LOCALID_PROF_OAK, MOVEMENT_TYPE_FACE_DOWN
	clearflag FLAG_HIDE_OAK_IN_HIS_LAB
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_PlayerEnter
	waitmovement 0
	applymovement LOCALID_RIVAL, Movement_WalkInPlaceFastestUp
	waitmovement 0
	clearflag FLAG_DONT_TRANSITION_MUSIC
	savebgm MUS_DUMMY
	fadedefaultbgm
	msgbox PalletTown_ProfessorOaksLab_Text_RivalFedUpWithWaiting
	closemessage
	delay 60
	msgbox PalletTown_ProfessorOaksLab_Text_OakThreeMonsChooseOne
	closemessage
	delay 30
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalReact
	waitmovement 0
	msgbox PalletTown_ProfessorOaksLab_Text_RivalNoFairWhatAboutMe
	msgbox PalletTown_ProfessorOaksLab_Text_OakBePatientRival
	setvar VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 2
	releaseall
	end

PalletTown_ProfessorOaksLab_Movement_OakEnter:: @ 81692B0
	walk_up
	walk_up
	walk_up
	walk_up
	walk_up
	walk_up
	step_end

PalletTown_ProfessorOaksLab_Movement_PlayerEnter:: @ 81692B7
	walk_up
	walk_up
	walk_up
	walk_up
	walk_up
	walk_up
	walk_up
	walk_up
	step_end

PalletTown_ProfessorOaksLab_Movement_RivalReact:: @ 81692C0
	walk_in_place_up
	walk_in_place_up
	step_end

PalletTown_ProfessorOaksLab_EventScript_LeaveStarterSceneTrigger:: @ 81692C3
	lockall
	textcolor 0
	applymovement LOCALID_PROF_OAK, Movement_FaceDown
	waitmovement 0
	msgbox PalletTown_ProfessorOaksLab_Text_OakHeyDontGoAwayYet
	closemessage
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_PlayerWalkUp
	waitmovement 0
	releaseall
	end

PalletTown_ProfessorOaksLab_Movement_PlayerWalkUp:: @ 81692E5
	walk_up
	step_end

PalletTown_ProfessorOaksLab_EventScript_RivalBattleTriggerLeft:: @ 81692E7
	lockall
	setvar VAR_TEMP_2, 1
	goto PalletTown_ProfessorOaksLab_EventScript_RivalBattle
	end

PalletTown_ProfessorOaksLab_EventScript_RivalBattleTriggerMid:: @ 81692F3
	lockall
	setvar VAR_TEMP_2, 2
	goto PalletTown_ProfessorOaksLab_EventScript_RivalBattle
	end

PalletTown_ProfessorOaksLab_EventScript_RivalBattleTriggerRight:: @ 81692FF
	lockall
	setvar VAR_TEMP_2, 3
	goto PalletTown_ProfessorOaksLab_EventScript_RivalBattle
	end

PalletTown_ProfessorOaksLab_EventScript_RivalBattle:: @ 816930B
	textcolor 0
	playbgm MUS_ENCOUNTER_RIVAL, 0
	applymovement LOCALID_RIVAL, Movement_WalkInPlaceFastestDown
	waitmovement 0
	applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp
	waitmovement 0
	msgbox PalletTown_ProfessorOaksLab_Text_RivalLetsCheckOutMons
	closemessage
	applymovement LOCALID_PROF_OAK, Movement_FaceDown
	waitmovement 0
	compare VAR_STARTER_MON, 0
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmander
	compare VAR_STARTER_MON, 1
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaur
	compare VAR_STARTER_MON, 2
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtle
	end

@ The scripts for the rival approaching the player for battle are a bit bloated because
@ both the player and rival can be in 3 different positions, so theres 9 different approaches
@ NOTE: Names below refer to the Rival's mon (e.g. for RivalBattleSquirtle, player has Charmander)

PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtle:: @ 816935A
	compare VAR_TEMP_2, 1
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtleLeft
	compare VAR_TEMP_2, 2
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtleMid
	compare VAR_TEMP_2, 3
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtleRight
	end

PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtleLeft:: @ 816937C
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalApproachForBattleSquirtleLeft
	waitmovement 0
	goto PalletTown_ProfessorOaksLab_EventScript_RivalBattleSquirtle
	end

PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtleMid:: @ 816938C
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalApproachForBattleSquirtleMid
	waitmovement 0
	goto PalletTown_ProfessorOaksLab_EventScript_RivalBattleSquirtle
	end

PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtleRight:: @ 816939C
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalApproachForBattleSquirtleRight
	waitmovement 0
	goto PalletTown_ProfessorOaksLab_EventScript_RivalBattleSquirtle
	end

PalletTown_ProfessorOaksLab_EventScript_RivalBattleSquirtle:: @ 81693AC
	trainerbattle_earlyrival TRAINER_RIVAL_OAKS_LAB_SQUIRTLE, RIVAL_BATTLE_TUTORIAL, PalletTown_ProfessorOaksLab_Text_RivalDefeat, Text_RivalVictory
	goto PalletTown_ProfessorOaksLab_EventScript_EndRivalBattle
	end

PalletTown_ProfessorOaksLab_Movement_RivalApproachForBattleSquirtleLeft:: @ 81693C0
	walk_left
	walk_left
	walk_left
	walk_left
	walk_down
	walk_down
	step_end

PalletTown_ProfessorOaksLab_Movement_RivalApproachForBattleSquirtleMid:: @ 81693C7
	walk_left
	walk_left
	walk_left
	walk_down
	walk_down
	step_end

PalletTown_ProfessorOaksLab_Movement_RivalApproachForBattleSquirtleRight:: @ 81693CD
	walk_left
	walk_left
	walk_down
	walk_down
	step_end

PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmander:: @ 81693D2
	compare VAR_TEMP_2, 1
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmanderLeft
	compare VAR_TEMP_2, 2
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmanderMid
	compare VAR_TEMP_2, 3
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmanderRight
	end

PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmanderLeft:: @ 81693F4
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_ApproachForBattleCharmanderLeft
	waitmovement 0
	goto PalletTown_ProfessorOaksLab_EventScript_RivalBattleCharmander
	end

PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmanderMid:: @ 8169404
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_ApproachForBattleCharmanderMid
	waitmovement 0
	goto PalletTown_ProfessorOaksLab_EventScript_RivalBattleCharmander
	end

PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmanderRight:: @ 8169414
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_ApproachForBattleCharmanderRight
	waitmovement 0
	goto PalletTown_ProfessorOaksLab_EventScript_RivalBattleCharmander
	end

PalletTown_ProfessorOaksLab_EventScript_RivalBattleCharmander:: @ 8169424
	trainerbattle_earlyrival TRAINER_RIVAL_OAKS_LAB_CHARMANDER, RIVAL_BATTLE_TUTORIAL, PalletTown_ProfessorOaksLab_Text_RivalDefeat, Text_RivalVictory
	goto PalletTown_ProfessorOaksLab_EventScript_EndRivalBattle
	end

PalletTown_ProfessorOaksLab_Movement_ApproachForBattleCharmanderLeft:: @ 8169438
	walk_left
	walk_left
	walk_left
	walk_left
	walk_left
	walk_down
	walk_down
	step_end

PalletTown_ProfessorOaksLab_Movement_ApproachForBattleCharmanderMid:: @ 8169440
	walk_left
	walk_left
	walk_left
	walk_left
	walk_down
	walk_down
	step_end

PalletTown_ProfessorOaksLab_Movement_ApproachForBattleCharmanderRight:: @ 8169447
	walk_left
	walk_left
	walk_left
	walk_down
	walk_down
	step_end

PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaur:: @ 816944D
	compare VAR_TEMP_2, 1
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaurLeft
	compare VAR_TEMP_2, 2
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaurMid
	compare VAR_TEMP_2, 3
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaurRight
	end

PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaurLeft:: @ 816946F
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalApproachForBattleBulbasaurLeft
	waitmovement 0
	goto PalletTown_ProfessorOaksLab_EventScript_RivalBattleBulbasaur
	end

PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaurMid:: @ 816947F
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalApproachForBattleBulbasaurMid
	waitmovement 0
	goto PalletTown_ProfessorOaksLab_EventScript_RivalBattleBulbasaur
	end

PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaurRight:: @ 816948F
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalApproachForBattleBulbasaurRight
	waitmovement 0
	goto PalletTown_ProfessorOaksLab_EventScript_RivalBattleBulbasaur
	end

PalletTown_ProfessorOaksLab_EventScript_RivalBattleBulbasaur:: @ 816949F
	trainerbattle_earlyrival TRAINER_RIVAL_OAKS_LAB_BULBASAUR, RIVAL_BATTLE_TUTORIAL, PalletTown_ProfessorOaksLab_Text_RivalDefeat, Text_RivalVictory
	goto PalletTown_ProfessorOaksLab_EventScript_EndRivalBattle
	end

PalletTown_ProfessorOaksLab_Movement_RivalApproachForBattleBulbasaurLeft:: @ 81694B3
	walk_left
	walk_left
	walk_left
	walk_down
	walk_down
	step_end

PalletTown_ProfessorOaksLab_Movement_RivalApproachForBattleBulbasaurMid:: @ 81694B9
	walk_left
	walk_left
	walk_down
	walk_down
	step_end

PalletTown_ProfessorOaksLab_Movement_RivalApproachForBattleBulbasaurRight:: @ 81694BE
	walk_left
	walk_down
	walk_down
	step_end

PalletTown_ProfessorOaksLab_EventScript_EndRivalBattle:: @ 81694C2
	special HealPlayerParty
	msgbox PalletTown_ProfessorOaksLab_Text_RivalGoToughenMyMon
	closemessage
	playbgm MUS_RIVAL_EXIT, 0
	compare VAR_TEMP_2, 1
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExitAfterBattleLeft
	compare VAR_TEMP_2, 2
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExitAfterBattleMid
	compare VAR_TEMP_2, 3
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExitAfterBattleRight
	removeobject LOCALID_RIVAL
	playse SE_EXIT
	fadedefaultbgm
	setvar VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 4
	setflag FLAG_BEAT_RIVAL_IN_OAKS_LAB
	releaseall
	end

PalletTown_ProfessorOaksLab_EventScript_RivalExitAfterBattleLeft:: @ 8169504
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalExitAfterBattleLeft
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_PlayerWatchRivalExitAfterBattle
	waitmovement LOCALID_RIVAL
	return

PalletTown_ProfessorOaksLab_EventScript_RivalExitAfterBattleMid:: @ 8169516
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalExitAfterBattleMid
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_PlayerWatchRivalExitAfterBattle
	waitmovement LOCALID_RIVAL
	return

PalletTown_ProfessorOaksLab_EventScript_RivalExitAfterBattleRight:: @ 8169528
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalExitAfterBattleRight
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_PlayerWatchRivalExitAfterBattleRight
	waitmovement LOCALID_RIVAL
	return

PalletTown_ProfessorOaksLab_Movement_RivalExitAfterBattleLeft:: @ 816953A
	walk_right
	walk_down
	walk_down
	walk_down
	walk_down
	walk_down
	delay_8
	step_end

PalletTown_ProfessorOaksLab_Movement_RivalExitAfterBattleRight:: @ 8169542
	walk_left
	walk_down
	walk_down
	walk_down
	walk_down
	walk_down
	delay_8
	step_end

PalletTown_ProfessorOaksLab_Movement_RivalExitAfterBattleMid:: @ 816954A
	walk_right
	walk_down
	walk_down
	walk_down
	walk_left
	walk_down
	walk_down
	delay_8
	step_end

PalletTown_ProfessorOaksLab_Movement_PlayerWatchRivalExitAfterBattle:: @ 8169553
	delay_16
	delay_8
	walk_in_place_fastest_right
	delay_16
	walk_in_place_fastest_down
	step_end

PalletTown_ProfessorOaksLab_Movement_PlayerWatchRivalExitAfterBattleRight:: @ 8169559
	delay_16
	delay_8
	walk_in_place_fastest_left
	delay_16
	walk_in_place_fastest_down
	step_end

PalletTown_ProfessorOaksLab_EventScript_Rival:: @ 816955F
	lock
	faceplayer
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalChoseStarter
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 2
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalWaitingForStarter
	msgbox PalletTown_ProfessorOaksLab_Text_RivalGrampsIsntAround
	release
	end

PalletTown_ProfessorOaksLab_EventScript_RivalWaitingForStarter:: @ 8169581
	msgbox PalletTown_ProfessorOaksLab_Text_RivalGoChoosePlayer
	release
	end

PalletTown_ProfessorOaksLab_EventScript_RivalChoseStarter:: @ 816958B
	msgbox PalletTown_ProfessorOaksLab_Text_RivalMyMonLooksTougher
	release
	end

PalletTown_ProfessorOaksLab_EventScript_ProfOak:: @ 8169595
	lock
	faceplayer
	goto_if_set SHOWED_OAK_COMPLETE_DEX, PalletTown_ProfessorOaksLab_EventScript_OakJustShownCompleteDex
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 9
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RatePokedex
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 8
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_MonsAroundWorldWait
	goto_if_set FLAG_SYS_GAME_CLEAR, PalletTown_ProfessorOaksLab_EventScript_TryStartNationalDexScene
	compare VAR_MAP_SCENE_CERULEAN_CITY_RIVAL, 1
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RatePokedex
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 6
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RatePokedexOrTryGiveBalls
	compare VAR_MAP_SCENE_VIRIDIAN_CITY_MART, 1
	goto_if_ge PalletTown_ProfessorOaksLab_EventScript_ReceiveDexScene
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 4
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBattleMonForItToGrow
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_OakCanReachNextTownWithMon
	msgbox PalletTown_ProfessorOaksLab_Text_OakWhichOneWillYouChoose
	release
	end

PalletTown_ProfessorOaksLab_EventScript_OakJustShownCompleteDex:: @ 8169600
	msgbox PokedexRating_Text_ThankYouMadeDreamReality
	release
	end

PalletTown_ProfessorOaksLab_EventScript_OakCanReachNextTownWithMon:: @ 816960A
	msgbox PalletTown_ProfessorOaksLab_Text_OakCanReachNextTownWithMon
	release
	end

PalletTown_ProfessorOaksLab_EventScript_OakBattleMonForItToGrow:: @ 8169614
	msgbox PalletTown_ProfessorOaksLab_Text_OakBattleMonForItToGrow
	release
	end

PalletTown_ProfessorOaksLab_EventScript_ReceiveDexScene:: @ 816961E
	msgbox PalletTown_ProfessorOaksLab_Text_OakHaveSomethingForMe
	textcolor 3
	playfanfare MUS_OBTAIN_TMHM
	message PalletTown_ProfessorOaksLab_Text_DeliveredOaksParcel
	waitmessage
	waitfanfare
	call EventScript_RestorePrevTextColor
	removeitem ITEM_OAKS_PARCEL, 1
	msgbox PalletTown_ProfessorOaksLab_Text_OakCustomBallIOrdered
	playbgm MUS_ENCOUNTER_RIVAL, 0
	msgbox PalletTown_ProfessorOaksLab_Text_RivalGramps
	closemessage
	compare VAR_FACING, DIR_NORTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterNorth
	compare VAR_FACING, DIR_SOUTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterSouth
	compare VAR_FACING, DIR_EAST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterEastWest
	compare VAR_FACING, DIR_WEST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterEastWest
	fadedefaultbgm
	msgbox PalletTown_ProfessorOaksLab_Text_RivalWhatDidYouCallMeFor
	closemessage
	delay 30
	playse SE_PIN
	applymovement LOCALID_PROF_OAK, Movement_ExclamationMark
	waitmovement 0
	applymovement LOCALID_PROF_OAK, Movement_Delay48
	waitmovement 0
	compare VAR_FACING, DIR_SOUTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalSouth
	compare VAR_FACING, DIR_EAST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalEast
	compare VAR_FACING, DIR_WEST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalWest
	compare VAR_FACING, DIR_NORTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalNorth
	msgbox PalletTown_ProfessorOaksLab_Text_OakHaveRequestForYouTwo
	closemessage
	compare VAR_FACING, DIR_NORTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskNorth
	compare VAR_FACING, DIR_SOUTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskSouth
	compare VAR_FACING, DIR_EAST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskEast
	compare VAR_FACING, DIR_WEST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskWest
	msgbox PalletTown_ProfessorOaksLab_Text_OakPokedexOnDesk
	closemessage
	delay 40
	msgbox PalletTown_ProfessorOaksLab_Text_OakTakeTheseWithYou
	closemessage
	applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestUp
	waitmovement 0
	removeobject LOCALID_POKEDEX_1
	delay 10
	removeobject LOCALID_POKEDEX_2
	delay 25
	compare VAR_FACING, DIR_NORTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverNorth
	compare VAR_FACING, DIR_SOUTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverSouth
	compare VAR_FACING, DIR_EAST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverEast
	compare VAR_FACING, DIR_WEST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverWest
	delay 10
	textcolor 3
	playfanfare MUS_OBTAIN_KEY_ITEM
	message PalletTown_ProfessorOaksLab_Text_ReceivedPokedexFromOak
	waitmessage
	waitfanfare
	call EventScript_RestorePrevTextColor
	setflag FLAG_SYS_POKEDEX_GET
	special SetUnlockedPokedexFlags
	setvar VAR_MAP_SCENE_POKEMON_CENTER_TEALA, 1
	msgbox PalletTown_ProfessorOaksLab_Text_OakCatchMonsForDataTakeThese
	giveitem_msg PalletTown_ProfessorOaksLab_Text_ReceivedFivePokeBalls, ITEM_POKE_BALL, 5
	msgbox PalletTown_ProfessorOaksLab_Text_OakExplainCatching
	famechecker FAMECHECKER_OAK, 1
	msgbox PalletTown_ProfessorOaksLab_Text_OakCompleteMonGuideWasMyDream
	msgbox PalletTown_ProfessorOaksLab_Text_RivalLeaveItToMeGramps
	compare VAR_FACING, DIR_NORTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerNorth
	compare VAR_FACING, DIR_SOUTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerSouth
	compare VAR_FACING, DIR_EAST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerEastWest
	compare VAR_FACING, DIR_WEST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerEastWest
	msgbox PalletTown_ProfessorOaksLab_Text_RivalTellSisNotToGiveYouMap
	closemessage
	playbgm MUS_RIVAL_EXIT, 0
	compare VAR_FACING, DIR_NORTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExitNorth
	compare VAR_FACING, DIR_SOUTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExit
	compare VAR_FACING, DIR_EAST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExit
	compare VAR_FACING, DIR_WEST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExit
	removeobject LOCALID_RIVAL
	fadedefaultbgm
	setvar VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 6
	setvar VAR_MAP_SCENE_VIRIDIAN_CITY_MART, 2
	setvar VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 1
	setvar VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 1
	setvar VAR_MAP_SCENE_ROUTE22, 1
	release
	end

PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverNorth:: @ 8169845
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakBringDexesOver
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverSouth:: @ 8169850
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakBringDexesOverSouth
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverEast:: @ 816985B
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakBringDexesOver
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_PlayerFaceOakForDexEast
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverWest:: @ 816986D
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakBringDexesOver
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_Movement_PlayerFaceOakForDexEast:: @ 8169878
	delay_16
	delay_8
	walk_in_place_fastest_right
	step_end

PalletTown_ProfessorOaksLab_Movement_OakBringDexesOver:: @ 816987C
	walk_right
	walk_down
	step_end

PalletTown_ProfessorOaksLab_Movement_OakBringDexesOverSouth:: @ 816987F
	walk_down
	walk_right
	step_end

PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskNorth:: @ 8169882
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakWalkToDesk
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskSouth:: @ 816988D
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakWalkToDeskSouth
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_WatchOakWalkToDesk
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_WatchOakWalkToDesk
	waitmovement LOCALID_PROF_OAK
	return

PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskEast:: @ 81698A6
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakWalkToDesk
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_WatchOakWalkToDeskEast
	waitmovement LOCALID_PROF_OAK
	return

PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskWest:: @ 81698B8
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakWalkToDesk
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_Movement_WatchOakWalkToDeskEast:: @ 81698C3
	delay_16
	delay_8
	walk_in_place_fastest_up
	step_end

PalletTown_ProfessorOaksLab_Movement_WatchOakWalkToDesk:: @ 81698C7
	delay_16
	delay_8
	walk_in_place_fastest_left
	step_end

PalletTown_ProfessorOaksLab_Movement_OakWalkToDesk:: @ 81698CB
	walk_up
	walk_left
	delay_16
	walk_in_place_fastest_down
	step_end

PalletTown_ProfessorOaksLab_Movement_OakWalkToDeskSouth:: @ 81698D0
	walk_left
	walk_left
	walk_up
	delay_16
	walk_in_place_fastest_right
	step_end

PalletTown_ProfessorOaksLab_EventScript_RatePokedexOrTryGiveBalls:: @ 81698D6
	setvar VAR_0x8004, 0
	specialvar VAR_RESULT, GetPokedexCount
	copyvar VAR_0x8008, VAR_0x8005
	copyvar VAR_0x8009, VAR_0x8006
	getnumberstring 0, VAR_0x8008
	getnumberstring 1, VAR_0x8009
	compare VAR_0x8009, 1  @ Player only has starter
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_CheckIfPlayerNeedsBalls
	goto PalletTown_ProfessorOaksLab_EventScript_RatePokedex
	end

PalletTown_ProfessorOaksLab_EventScript_RatePokedex:: @ 8169903
	call PokedexRating_EventScript_RateInPerson
	goto_if_set FLAG_OAK_SAW_DEX_COMPLETION, PalletTown_ProfessorOaksLab_EventScript_DexCompleted
	release
	end

PalletTown_ProfessorOaksLab_EventScript_DexCompleted:: @ 8169913
	closemessage
	delay 40
	message PokedexRating_Text_Wroooaaarrr
	waitmessage
	compare VAR_FACING, DIR_NORTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakExcitedNorth
	compare VAR_FACING, DIR_SOUTH
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakExcitedSouth
	compare VAR_FACING, DIR_EAST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakExcitedEast
	compare VAR_FACING, DIR_WEST
	call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakExcitedWest
	applymovement LOCALID_PROF_OAK, Movement_FacePlayer
	waitmovement 0
	closemessage
	delay 70
	msgbox PokedexRating_Text_ThankYouMadeDreamReality
	setflag SHOWED_OAK_COMPLETE_DEX
	release
	end

PalletTown_ProfessorOaksLab_EventScript_OakExcitedNorth:: @ 8169964
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakExcitedNorth
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_OakExcitedSouth:: @ 816996F
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakExcitedSouth
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_OakExcitedEast:: @ 816997A
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakExcitedEast
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_OakExcitedWest:: @ 8169985
	applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakExcitedWest
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_Movement_OakExcitedNorth:: @ 8169990
	walk_in_place_down
	walk_in_place_fast_down
	walk_in_place_down
	walk_in_place_down
	walk_in_place_fast_down
	walk_in_place_down
	step_end

PalletTown_ProfessorOaksLab_Movement_OakExcitedSouth:: @ 8169997
	walk_in_place_up
	walk_in_place_fast_up
	walk_in_place_up
	walk_in_place_up
	walk_in_place_fast_up
	walk_in_place_up
	step_end

PalletTown_ProfessorOaksLab_Movement_OakExcitedEast:: @ 816999E
	walk_in_place_left
	walk_in_place_fast_left
	walk_in_place_left
	walk_in_place_left
	walk_in_place_fast_left
	walk_in_place_left
	step_end

PalletTown_ProfessorOaksLab_Movement_OakExcitedWest:: @ 81699A5
	walk_in_place_right
	walk_in_place_fast_right
	walk_in_place_right
	walk_in_place_right
	walk_in_place_fast_right
	walk_in_place_right
	step_end

@ Unused
Movement_1699AC:: @ 81699AC
	walk_left
	walk_in_place_fastest_down
	delay_8
	walk_in_place_fastest_right
	delay_8
	walk_in_place_fastest_up
	delay_8
	walk_in_place_fastest_left
	delay_8
	walk_in_place_fastest_down
	delay_8
	walk_right
	walk_right
	walk_in_place_fastest_up
	delay_8
	walk_in_place_fastest_left
	delay_8
	walk_in_place_fastest_down
	delay_8
	walk_in_place_fastest_right
	delay_8
	walk_in_place_fastest_up
	delay_8
	walk_left
	step_end

@ Unused
Movement_1699C5:
	walk_up
	walk_down
	walk_down
	walk_in_place_down
	walk_up
	delay_16
	delay_16
	delay_16
	step_end

PalletTown_ProfessorOaksLab_EventScript_TryStartNationalDexScene:: @ 81699CE
	call PokedexRating_EventScript_RateInPerson
	closemessage
	compare VAR_0x8009, 60
	goto_if_lt PalletTown_ProfessorOaksLab_EventScript_DontStartNationalDexScene
	goto_if_unset FLAG_WORLD_MAP_ONE_ISLAND, PalletTown_ProfessorOaksLab_EventScript_DontStartNationalDexScene
	delay 30
	msgbox PalletTown_ProfessorOaksLab_Text_OakFavorToAskYouPlayer
	goto PalletTown_ProfessorOaksLab_EventScript_NationalDexScene
	end

PalletTown_ProfessorOaksLab_EventScript_DontStartNationalDexScene:: @ 81699F9
	release
	end

PalletTown_ProfessorOaksLab_EventScript_CheckIfPlayerNeedsBalls:: @ 81699FB
	goto_if_questlog EventScript_ReleaseEnd
	special QuestLog_CutRecording
	goto_if_set FLAG_OAK_SKIP_22_RIVAL_CHECK, PalletTown_ProfessorOaksLab_EventScript_MonsAroundWorldWait
	goto_if_set FLAG_GOT_POKEBALLS_FROM_OAK_AFTER_22_RIVAL, PalletTown_ProfessorOaksLab_EventScript_PlayerAlreadyGotBalls
	checkitem ITEM_POKE_BALL, 1
	compare VAR_RESULT, FALSE
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_PlayerOutOfBalls
	goto PalletTown_ProfessorOaksLab_EventScript_MonsAroundWorldWait
	end

PalletTown_ProfessorOaksLab_EventScript_PlayerOutOfBalls:: @ 8169A34
	compare VAR_MAP_SCENE_ROUTE22, 2
	goto_if_ge PalletTown_ProfessorOaksLab_EventScript_GivePlayerMoreBalls
	goto PalletTown_ProfessorOaksLab_EventScript_MonsAroundWorldWait
	end

PalletTown_ProfessorOaksLab_EventScript_GivePlayerMoreBalls:: @ 8169A45
	msgbox PalletTown_ProfessorOaksLab_Text_OakAddedNothingToPokedex
	giveitem_msg PalletTown_ProfessorOaksLab_Text_ReceivedFivePokeBalls, ITEM_POKE_BALL, 5
	setflag FLAG_GOT_POKEBALLS_FROM_OAK_AFTER_22_RIVAL
	release
	end

PalletTown_ProfessorOaksLab_EventScript_MonsAroundWorldWait:: @ 8169A6E
	msgbox PalletTown_ProfessorOaksLab_Text_OakMonsAroundWorldWait
	release
	end

PalletTown_ProfessorOaksLab_EventScript_PlayerAlreadyGotBalls:: @ 8169A78
	msgbox PalletTown_ProfessorOaksLab_Text_OakComeSeeMeSometime
	release
	end

PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterNorth:: @ 8169A82
	setobjectxyperm LOCALID_RIVAL, 5, 10
	addobject LOCALID_RIVAL
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_WatchRivalEnterNorth
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalEnter
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterEastWest:: @ 8169A9E
	setobjectxyperm LOCALID_RIVAL, 6, 10
	addobject LOCALID_RIVAL
	applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_WatchRivalEnterEastWest
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalEnter
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterSouth:: @ 8169AC1
	setobjectxyperm LOCALID_RIVAL, 6, 10
	addobject LOCALID_RIVAL
	applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalEnter
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalSouth:: @ 8169ADD
	applymovement LOCALID_PROF_OAK, Movement_FacePlayer
	waitmovement 0
	delay 15
	applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalWest:: @ 8169AF5
	applymovement LOCALID_PROF_OAK, Movement_FacePlayer
	waitmovement 0
	delay 15
	applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft
	applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalEast:: @ 8169B14
	applymovement LOCALID_PROF_OAK, Movement_FacePlayer
	waitmovement 0
	delay 15
	applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight
	applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerNorth:: @ 8169B33
	applymovement LOCALID_RIVAL, Movement_FacePlayer
	applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerSouth:: @ 8169B45
	applymovement LOCALID_RIVAL, Movement_WalkInPlaceFastestUp
	applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerEastWest:: @ 8169B57
	applymovement LOCALID_RIVAL, Movement_FacePlayer
	applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_RivalExitNorth:: @ 8169B69
	applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_WatchRivalEnterEastWest
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalExit
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_RivalExit:: @ 8169B7B
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalExit
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalNorth:: @ 8169B86
	applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp
	waitmovement 0
	return

PalletTown_ProfessorOaksLab_Movement_WatchRivalEnterEastWest:: @ 8169B91
	delay_4
	walk_in_place_fastest_down
	step_end

PalletTown_ProfessorOaksLab_Movement_WatchRivalEnterNorth:: @ 8169B94
	walk_in_place_fastest_down
	delay_16
	delay_16
	delay_16
	delay_16
	delay_16
	delay_8
	walk_in_place_fastest_left
	step_end

PalletTown_ProfessorOaksLab_Movement_RivalEnter:: @ 8169B9D
	walk_up
	walk_up
	walk_up
	walk_up
	walk_up
	walk_up
	step_end

PalletTown_ProfessorOaksLab_Movement_RivalExit:: @ 8169BA4
	walk_down
	walk_down
	walk_down
	walk_down
	walk_down
	walk_down
	step_end

PalletTown_ProfessorOaksLab_EventScript_BulbasaurBall:: @ 8169BAB
	lock
	faceplayer
	setvar PLAYER_STARTER_NUM, 0
	setvar PLAYER_STARTER_SPECIES, SPECIES_BULBASAUR
	setvar RIVAL_STARTER_SPECIES, SPECIES_CHARMANDER
	setvar RIVAL_STARTER_ID, LOCALID_CHARMANDER_BALL
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3
	goto_if_ge PalletTown_ProfessorOaksLab_EventScript_LastPokeBall
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 2
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ConfirmStarterChoice
	msgbox PalletTown_ProfessorOaksLab_Text_ThoseArePokeBalls
	release
	end

PalletTown_ProfessorOaksLab_EventScript_ConfirmStarterChoice:: @ 8169BE1
	applymovement LOCALID_PROF_OAK, Movement_FaceRight
	waitmovement 0
	drawmonpic PLAYER_STARTER_SPECIES, 10, 3
	textcolor 0
	compare PLAYER_STARTER_NUM, 0
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ConfirmBulbasaur
	compare PLAYER_STARTER_NUM, 1
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ConfirmSquirtle
	compare PLAYER_STARTER_NUM, 2
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ConfirmCharmander
	end

PalletTown_ProfessorOaksLab_EventScript_ConfirmBulbasaur:: @ 8169C14
	msgbox PalletTown_ProfessorOaksLab_Text_OakChoosingBulbasaur, MSGBOX_YESNO
	compare VAR_RESULT, YES
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ChoseStarter
	compare VAR_RESULT, NO
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_DeclinedStarter
	end

PalletTown_ProfessorOaksLab_EventScript_ConfirmSquirtle:: @ 8169C33
	msgbox PalletTown_ProfessorOaksLab_Text_OakChoosingSquirtle, MSGBOX_YESNO
	compare VAR_RESULT, YES
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ChoseStarter
	compare VAR_RESULT, NO
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_DeclinedStarter
	end

PalletTown_ProfessorOaksLab_EventScript_ConfirmCharmander:: @ 8169C52
	msgbox PalletTown_ProfessorOaksLab_Text_OakChoosingCharmander, MSGBOX_YESNO
	compare VAR_RESULT, YES
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ChoseStarter
	compare VAR_RESULT, NO
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_DeclinedStarter
	end

PalletTown_ProfessorOaksLab_EventScript_DeclinedStarter:: @ 8169C71
	erasemonpic
	release
	end

PalletTown_ProfessorOaksLab_EventScript_ChoseStarter:: @ 8169C74
	erasemonpic
	removeobject VAR_LAST_TALKED
	msgbox PalletTown_ProfessorOaksLab_Text_OakThisMonIsEnergetic
	call EventScript_RestorePrevTextColor
	setflag FLAG_SYS_POKEMON_GET
	setflag FLAG_PALLET_LADY_NOT_BLOCKING_SIGN
	givemon PLAYER_STARTER_SPECIES, 5, ITEM_NONE
	copyvar VAR_STARTER_MON, PLAYER_STARTER_NUM
	getspeciesname 0, PLAYER_STARTER_SPECIES
	message PalletTown_ProfessorOaksLab_Text_ReceivedMonFromOak
	waitmessage
	playfanfare MUS_OBTAIN_KEY_ITEM
	waitfanfare
	msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO
	compare VAR_RESULT, YES
	goto_if_eq EventScript_GiveNicknameToStarter
	compare VAR_RESULT, NO
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalPicksStarter
	end

EventScript_GiveNicknameToStarter:: @ 8169CCC
	setvar VAR_0x8004, 0
	call EventScript_ChangePokemonNickname
	goto PalletTown_ProfessorOaksLab_EventScript_RivalPicksStarter
	end

PalletTown_ProfessorOaksLab_EventScript_RivalPicksStarter:: @ 8169CDC
	closemessage
	compare PLAYER_STARTER_NUM, 0
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalWalksToCharmander
	compare PLAYER_STARTER_NUM, 1
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalWalksToBulbasaur
	compare PLAYER_STARTER_NUM, 2
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalWalksToSquirtle
	end

PalletTown_ProfessorOaksLab_EventScript_RivalWalksToCharmander:: @ 8169CFF
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalWalksToCharmander
	waitmovement 0
	goto PalletTown_ProfessorOaksLab_EventScript_RivalTakesStarter
	end

PalletTown_ProfessorOaksLab_EventScript_RivalWalksToSquirtle:: @ 8169D0F
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalWalksToSquirtle
	waitmovement 0
	goto PalletTown_ProfessorOaksLab_EventScript_RivalTakesStarter
	end

PalletTown_ProfessorOaksLab_EventScript_RivalWalksToBulbasaur:: @ 8169D1F
	applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalWalksToBulbasaur
	waitmovement 0
	goto PalletTown_ProfessorOaksLab_EventScript_RivalTakesStarter
	end

PalletTown_ProfessorOaksLab_EventScript_RivalTakesStarter:: @ 8169D2F
	textcolor 0
	msgbox PalletTown_ProfessorOaksLab_Text_RivalIllTakeThisOneThen
	removeobject RIVAL_STARTER_ID
	textcolor 3
	getspeciesname 0, RIVAL_STARTER_SPECIES
	message PalletTown_ProfessorOaksLab_Text_RivalReceivedMonFromOak
	waitmessage
	playfanfare MUS_OBTAIN_KEY_ITEM
	waitfanfare
	setvar VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3
	call_if_set FLAG_OPENED_START_MENU, PalletTown_ProfessorOaksLab_EventScript_ReadyEndSignLadyScene
	release
	end

PalletTown_ProfessorOaksLab_EventScript_ReadyEndSignLadyScene:: @ 8169D5C
	setvar VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 1
	return

PalletTown_ProfessorOaksLab_Movement_RivalWalksToCharmander:: @ 8169D62
	walk_down
	walk_down
	walk_right
	walk_right
	walk_right
	walk_right
	walk_right
	walk_up
	step_end

PalletTown_ProfessorOaksLab_Movement_RivalWalksToSquirtle:: @ 8169D6B
	walk_down
	walk_right
	walk_right
	walk_right
	walk_right
	walk_in_place_fastest_up
	step_end

PalletTown_ProfessorOaksLab_Movement_RivalWalksToBulbasaur:: @ 8169D72
	walk_down
	walk_right
	walk_right
	walk_right
	walk_in_place_fastest_up
	step_end

PalletTown_ProfessorOaksLab_EventScript_SquirtleBall:: @ 8169D78
	lock
	faceplayer
	setvar PLAYER_STARTER_NUM, 1
	setvar PLAYER_STARTER_SPECIES, SPECIES_SQUIRTLE
	setvar RIVAL_STARTER_SPECIES, SPECIES_BULBASAUR
	setvar RIVAL_STARTER_ID, LOCALID_BULBASAUR_BALL
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3
	goto_if_ge PalletTown_ProfessorOaksLab_EventScript_LastPokeBall
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 2
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ConfirmStarterChoice
	msgbox PalletTown_ProfessorOaksLab_Text_ThoseArePokeBalls
	release
	end

PalletTown_ProfessorOaksLab_EventScript_CharmanderBall:: @ 8169DAE
	lock
	faceplayer
	setvar PLAYER_STARTER_NUM, 2
	setvar PLAYER_STARTER_SPECIES, SPECIES_CHARMANDER
	setvar RIVAL_STARTER_SPECIES, SPECIES_SQUIRTLE
	setvar RIVAL_STARTER_ID, LOCALID_SQUIRTLE_BALL
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3
	goto_if_ge PalletTown_ProfessorOaksLab_EventScript_LastPokeBall
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 2
	goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ConfirmStarterChoice
	msgbox PalletTown_ProfessorOaksLab_Text_ThoseArePokeBalls
	release
	end

PalletTown_ProfessorOaksLab_EventScript_LastPokeBall:: @ 8169DE4
	msgbox PalletTown_ProfessorOaksLab_Text_OaksLastMon
	release
	end

PalletTown_ProfessorOaksLab_EventScript_Aide1:: @ 8169DEE
	lock
	faceplayer
	goto_if_set FLAG_SYS_GAME_CLEAR, PalletTown_ProfessorOaksLab_EventScript_Aide1GameClear
	msgbox PalletTown_ProfessorOaksLab_Text_StudyAsOaksAide
	release
	end

PalletTown_ProfessorOaksLab_EventScript_Aide1GameClear:: @ 8169E03
	famechecker FAMECHECKER_OAK, 5
	msgbox PalletTown_ProfessorOaksLab_Text_OakIsGoingToHaveRadioShow
	release
	end

PalletTown_ProfessorOaksLab_EventScript_Aide2:: @ 8169E1A
	lock
	faceplayer
	goto_if_set FLAG_SYS_GAME_CLEAR, PalletTown_ProfessorOaksLab_EventScript_Aide2GameClear
	msgbox PalletTown_ProfessorOaksLab_Text_StudyAsOaksAide
	release
	end

PalletTown_ProfessorOaksLab_EventScript_Aide2GameClear:: @ 8169E2F
	famechecker FAMECHECKER_DAISY, 0
	msgbox PalletTown_ProfessorOaksLab_Text_DaisyWillGroomMons
	release
	end

PalletTown_ProfessorOaksLab_EventScript_Aide3:: @ 8169E46
	lock
	faceplayer
	famechecker FAMECHECKER_OAK, 2
	msgbox PalletTown_ProfessorOaksLab_Text_OakIsAuthorityOnMons
	release
	end

PalletTown_ProfessorOaksLab_EventScript_Pokedex:: @ 8169E5F
	msgbox PalletTown_ProfessorOaksLab_Text_BlankEncyclopedia, MSGBOX_NPC
	end

PalletTown_ProfessorOaksLab_EventScript_Computer:: @ 8169E68
	msgbox PalletTown_ProfessorOaksLab_Text_EmailMessage, MSGBOX_SIGN
	end

PalletTown_ProfessorOaksLab_EventScript_LeftSign:: @ 8169E71
	msgbox PalletTown_ProfessorOaksLab_Text_PressStartToOpenMenu, MSGBOX_SIGN
	end

PalletTown_ProfessorOaksLab_EventScript_RightSign:: @ 8169E7A
	lockall
	compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 6
	goto_if_ge PalletTown_ProfessorOaksLab_EventScript_RightSignAlt
	msgbox PalletTown_ProfessorOaksLab_Text_SaveOptionInMenu
	releaseall
	end

PalletTown_ProfessorOaksLab_EventScript_RightSignAlt:: @ 8169E90
	msgbox PalletTown_ProfessorOaksLab_Text_AllMonTypesHaveStrongAndWeakPoints
	releaseall
	end
