• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Fly to different versions of the same town

  • 41
    Posts
    4
    Years
    • Seen Sep 19, 2023
    So, I've run into some difficulty. I want to add a "town building" element to my starting game. A section of the town that has nothing in it but as you slowly donate money a Pokemart, Pokemon Center and two other buildings appear. I tried doing this with events but the rendering distance causes the player to briefly see the building in question before the event graphic activates. I tried doing this with a TON of events covering the area to reveal the building but that lagged my game so hard because there were about 50 events within the same screen. Obviously that's not going to be good for anyone.

    So i thought about having multiple instances of that town on the same map grid. One with no buildings, 1 building, 2 buildings, 3, buildings, and all buildings. I figured having gateways surrounding the town so that the map transfer could be dependent on the switch or variable that controls the buildings.

    However that brings me to fly. How can I ensure that when you use fly (or in this case I'm using HM items to replace HMs) you arrive at the appropriate instance of the town? Where can i put the conditional branch that if X switch or variable is whatever that i fly to this spot on the map instead of this spot?

    Please explain this to me like i'm 5 because I have difficulty with knowing what to do with scripts.
     
    For version 18.1, you can try this code (located in PField_FieldMoves):
    Code:
    HiddenMoveHandlers::UseMove.add(:FLY,proc { |move,pokemon|
      if !$PokemonTemp.flydata
        pbMessage(_INTL("Can't use that here."))
        next false
      end
      if !pbHiddenMoveAnimation(pokemon)
        pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
      end
      pbFadeOutIn {
        $game_temp.player_new_map_id    = $PokemonTemp.flydata[0]
        [COLOR="Red"]if $game_temp.player_new_map_id == <"default map ID of the town as defined in the file townmap.txt"> && $game_variables[<"whichever number you're using for the donation variable">] >= 0
            case $game_variables[<"whichever number you're using for the donation variable">]
            when 0..<"upgrade amount - 1">
                $game_temp.player_new_map_id = <"map ID for upgraded town">
                $game_temp.player_new_x = <"new x position"> [COLOR="Green"]# in case you have a different landing site[/COLOR]
                $game_temp.player_new_y = <"new y position">
            [COLOR="Green"]# repeat when statement blocks for other upgraded town maps[/COLOR]
            end
        else[/COLOR]
            $game_temp.player_new_x         = $PokemonTemp.flydata[1]
            $game_temp.player_new_y         = $PokemonTemp.flydata[2]
        [COLOR="Red"]end[/COLOR]
        $game_temp.player_new_direction = 2
        $PokemonTemp.flydata = nil
        $scene.transfer_player
        $game_map.autoplay
        $game_map.refresh
      }
      pbEraseEscapePoint
      next true
    })
    The code in red is the code to add. Note that this is for the move Fly called outside of battle and the code has not been tested.
     
    Last edited:
    Back
    Top