# Pulling up the Fly Map in an event

#### MarcStuts08

##### Novice
Member
I want to create a Flight service that allows the player to pay $500 at a depot to fly to any city they've been to before. I figure the event should be fairly simple, branch yes or no, yes has the player pay$500 then pulls up the Fly Map for the player to select the place they wish to fly too.

What's snagging my plan is I don't know how to pull up the Fly Map in an event, or if it's even something you can do.

Is it possible to have the event transition into the Fly sequence? Or am I better off using a different method?

#### Mr. Gela

##### Discord: theo#7722
Member
Look up the code from the party screen script and the field move handler

#### aiyinsi

##### A wild Minun appeared!
Member
This is the code you would run in the event: I would recommend to actually condense all of that into one function in the scripts and just calling that.
Ruby:
def myCustomFlyThingy
scene = PokemonRegionMap_Scene.new(-1,false)
screen = PokemonRegionMapScreen.new(scene)
ret = screen.pbStartFlyScreen
if ret
$PokemonTemp.flydata = ret pbFadeOutIn {$game_temp.player_new_map_id    = $PokemonTemp.flydata[0]$game_temp.player_new_x         = $PokemonTemp.flydata[1]$game_temp.player_new_y         = $PokemonTemp.flydata[2]$game_temp.player_new_direction = 2
$PokemonTemp.flydata = nil$scene.transfer_player
$game_map.autoplay$game_map.refresh
}
return true
end
return false
end

also sorry for the weird indenting ... I hate this editor ...

EDIT: made it into a function that you can throw into your scripts. Also introduced a return value that tells you whether the player actually used fly or not. If they didn't you can use this in an if-statement to not have the player pay.

#### Samdeman123124

##### Novice
Member
This is the code you would run in the event: I would recommend to actually condense all of that into one function in the scripts and just calling that.
Ruby:
def myCustomFlyThingy
scene = PokemonRegionMap_Scene.new(-1,false)
screen = PokemonRegionMapScreen.new(scene)
ret = screen.pbStartFlyScreen
if ret
$PokemonTemp.flydata = ret pbFadeOutIn {$game_temp.player_new_map_id    = $PokemonTemp.flydata[0]$game_temp.player_new_x         = $PokemonTemp.flydata[1]$game_temp.player_new_y         = $PokemonTemp.flydata[2]$game_temp.player_new_direction = 2
$PokemonTemp.flydata = nil$scene.transfer_player
$game_map.autoplay$game_map.refresh
}
return true
end
return false
end

also sorry for the weird indenting ... I hate this editor ...

EDIT: made it into a function that you can throw into your scripts. Also introduced a return value that tells you whether the player actually used fly or not. If they didn't you can use this in an if-statement to not have the player pay.
Hey, I have been looking how to implement this type of script into my game, and found this! Just curious, where do I put this script? In a pre-made section, or in a new section above main? Sorry if it is painfully obvious.

#### aiyinsi

##### A wild Minun appeared!
Member
Hey, I have been looking how to implement this type of script into my game, and found this! Just curious, where do I put this script? In a pre-made section, or in a new section above main? Sorry if it is painfully obvious.
I'd make it a new section above main ... just because it's easier to keep track of your changes that way