MilosGreenOrb_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

MilosGreenOrbRayquazaServant:
	faceplayer
	checkevent EVENT_MILOS_RAYQUAZA
	sif true
		jumptext .already_battled_text
	opentext
	checkitem GREEN_ORB
	sif false
		jumptext .describe_rayquaza_text
	takeitem GREEN_ORB
	writetext .took_green_orb_text
	special Special_BattleTowerFade
	playsound SFX_ENTER_DOOR
	waitsfx
	warpfacing UP, MILOS_RAYQUAZA, 4, 7
	opentext
	writetext .request_battle_text
	setevent EVENT_MILOS_RAYQUAZA
	cry RAYQUAZA
	waitsfx
	writetext .met_requirements_text
	cry RAYQUAZA
	waitsfx
	applymovement 3, .rayquaza_approaches
	writecode VAR_BATTLETYPE, BATTLETYPE_NORMAL
	loadwildmon RAYQUAZA, 50
	startbattle
	reloadmapafterbattle
	special Special_BattleTowerFade
	playsound SFX_ENTER_DOOR
	waitsfx
	warpfacing UP, MILOS_GREEN_ORB, 4, 3
	end

.rayquaza_approaches
	step_down
	step_down
	step_down
	step_down
	step_end

.describe_rayquaza_text
	db TX_COMPRESSED, $29, $26, $b3, $c5, $36, $03, $95, $f0
	db $91, $eb, $4e, $dc, $64, $f5, $07, $99, $69
	db $30, $15, $6a, $e2, $b3, $ba, $8c, $c9, $18, $4b, $0b, $59
	db $02, $f0, $49, $34, $99, $82, $60, $10, $79, $59

	db $f8, $01, $49, $1a, $22, $14, $81, $4e, $43, $98, $40
	db $d4, $f2, $cd, $03, $c9, $a2, $04, $92, $d2, $34
	db $2a, $b0, $d4, $6b

	db $f0, $07, $57, $06, $88, $0c, $6b
	db $04, $f6, $f3, $ca, $cd, $08, $18, $31, $fe, $69
	db $32, $02, $d2, $70, $24, $e8, $29, $56, $82, $98, $05
	db $6f, $0e, $e5, $86, $6f, $2b, $33, $96, $19
	db $a0, $15, $ed, $df, $4e, $0d, $12, $c3, $12, $1e
	db $e5, $eb, $49, $c6, $12, $cc, $c9, $1d, $ad, $5f
	db $a9, $a0

.took_green_orb_text
	db TX_COMPRESSED, $61, $04, $39, $fc, $11, $d3, $d4, $1c, $64, $2f
	db $9b, $d5, $0e, $d3, $1f, $3f
	db $53, $c4

.request_battle_text
	db TX_COMPRESSED, $15, $d4, $59, $af, $f3, $63, $29, $1f
	db $72, $f2, $75, $11, $66, $2c, $da, $34, $59, $e6
	db $6a, $a5, $7b, $77, $d3
	db $f5, $3c, $40

.met_requirements_text
	db TX_COMPRESSED, $29, $27, $19, $48, $fb, $98, $9d
	db $43, $db, $d4, $06, $3e, $77, $2d
	db $26, $a9, $66, $2c, $da, $1a, $cd, $f3, $25, $a3
	db $d4, $f1, $00

.already_battled_text
	db TX_COMPRESSED, $29, $27, $19, $4e, $f7, $a6, $4e, $4e, $27
	db $50, $f1, $93, $27, $9f
	db $53, $40

MilosGreenOrb_MapEventHeader ;filler
	db 0, 0

;warps
	db 2
	warp_def $f, $4, 1, MILOS_TOWERCLIMB
	warp_def $f, $5, 1, MILOS_TOWERCLIMB

	;xy triggers
	db 0

	;signposts
	db 0

	;people-events
	db 1
	person_event SPRITE_SAGE, 2, 4, SPRITEMOVEDATA_00, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_SCRIPT, 0, MilosGreenOrbRayquazaServant, EVENT_MILOS_GREEN_ORB_NPC_1

