Route34Gate_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 1
	dbw MAPCALLBACK_NEWMAP, .set_bike_off

.set_bike_off
	clearflag ENGINE_ALWAYS_ON_BIKE
	return

Route34GateHiddenItem:
	dw EVENT_ROUTE_34_GATE_HIDDENITEM_GOLD_TOKEN
	db GOLD_TOKEN

Route34Gate_CyclingRoadBikeCheck1:
	writehalfword Route34Gate_CyclingRoadBikeCheck_PlayerWalksToGuard1
	jump Route34Gate_CyclingRoadBikeCheck

Route34Gate_CyclingRoadBikeCheck2:
	writehalfword Route34Gate_CyclingRoadBikeCheck_PlayerWalksToGuard2

Route34Gate_CyclingRoadBikeCheck:
	checkitem BICYCLE
	sif true
		end
	opentext
	writetext .Route34GateHaltText
	closetext
	applymovement PLAYER, -1
	scall Route34Gate_CyclingRoadBikeCheck_EntryPoint
	applymovement PLAYER, Route34GateNoBikeLeave
	end
	
.Route34GateHaltText:
	db TX_COMPRESSED, $63, $bd, $be
	db $34, $f1, $00

Route34Gate_CyclingRoadBikeCheck_PlayerWalksToGuard2:
	step_up
Route34Gate_CyclingRoadBikeCheck_PlayerWalksToGuard1:
	step_end

Route34GateCyclingRoadGuard:
	checkitem BICYCLE
	sif true, then
		faceplayer
		farjumptext Route49BikeText
	sendif

Route34Gate_CyclingRoadBikeCheck_EntryPoint:
	faceplayer
	faceperson PLAYER, 4
	opentext
	farwritetext Route49NoBikeText
	closetext
	end

Route34GateNoBikeLeave:
	step_right
	step_end

Route34GateNPC:
	faceplayer
	opentext
	checkevent EVENT_TM88
	sif true
		jumptext .after_giving_TM_text
	writetext .give_TM_text
	givetm 88 + RECEIVED_TM
	setevent EVENT_TM88
	closetext
	end

.give_TM_text
	db TX_COMPRESSED, $76, $9f, $c4, $84, $86, $0b, $d1, $ca, $16, $8b
	db $8d, $e2, $06, $e6, $0b, $0b, $f0, $4c, $85, $36, $1a

	db $50, $0e, $a2, $74, $18, $e6, $c2, $85, $65, $a7
	db $6d, $e0, $41, $6a, $33, $a4, $97, $aa, $47, $35
	db $0a, $b6, $54, $7d, $64, $2f, $9c, $e4, $78, $5f
	db $a9, $e2

.after_giving_TM_text
	db TX_COMPRESSED, $28, $56, $9f, $53, $e8, $34, $45, $03, $e4, $9b
	db $d7, $84, $8f, $5f, $fc, $7c
	db $12, $a1, $26, $ae, $cd, $78, $2c, $cf
	db $12, $ac, $34, $18, $2b, $1d, $9c, $7c, $20, $c7
	db $c6, $9a

Route34GateButterfree:
	faceplayer
	opentext
	writetext Route34GateButterfree_Text_32302a
	cry BUTTERFREE
	waitsfx
	endtext

Route34GateButterfree_Text_32302a:
	db TX_COMPRESSED, $12, $6a, $ec, $d7, $82, $cc, $dc
	db $5e, $53, $59, $9a, $78
	db $d3, $40

Route34Gate_MapEventHeader ;filler
	db 0, 0

;warps
	db 6
	warp_def $4, $0, 1, ROUTE_47
	warp_def $5, $0, 1, ROUTE_47
	warp_def $0, $e, 1, ROUTE_34
	warp_def $0, $f, 2, ROUTE_34
	warp_def $7, $e, 1, ILEX_FOREST
	warp_def $7, $f, 1, ILEX_FOREST

	;xy triggers
	db 2
	xy_trigger 0, 4, 3, $0, Route34Gate_CyclingRoadBikeCheck1, $0, $0
	xy_trigger 0, 5, 3, $0, Route34Gate_CyclingRoadBikeCheck2, $0, $0

	;signposts
	db 1
	signpost 1, 19, SIGNPOST_ITEM, Route34GateHiddenItem

	;people-events
	db 3
	person_event SPRITE_TEACHER, 3, 19, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_SCRIPT, 0, Route34GateNPC, -1
	person_event SPRITE_BUTTERFREE, 4, 19, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_OW_PURPLE, PERSONTYPE_SCRIPT, 0, Route34GateButterfree, -1
	person_event SPRITE_OFFICER, 3, 3, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, Route34GateCyclingRoadGuard, -1
