• 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!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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.

[Error] Player is automatically dismounting the bike every time he travels from one map to another. What's causing this?

  • 428
    Posts
    5
    Years
    The player character is automatically dismounting the bike every time he travels from one map to another while on a bike.

    Move from Pallet Town to Route 1? Bike dismount. Move back into Pallet? Bike dismount. Ride into or out of a building? Bike dismount.

    What's causing this? Why can't my player character stay on his bike?

    If it helps, I did this to the Bike Check code. This didn't fix the problem but at least it allowed me to use the bike in the first place.

    Code:
    def pbBikeCheck
      return true 
    #  if $PokemonGlobal.surfing || $PokemonGlobal.diving ||
    #     (!$PokemonGlobal.bicycle && $game_player.pbTerrainTag.must_walk)
    #    pbMessage(_INTL("Can't use that here."))
    #    return false
    #  end
    #  if !$game_player.can_ride_vehicle_with_follower?
    #    pbMessage(_INTL("It can't be used when you have someone with you."))
    #    return false
    #  end
    #  map_metadata = $game_map.metadata
    #  if $PokemonGlobal.bicycle
    #    if map_metadata&.always_bicycle
    #      pbMessage(_INTL("You can't dismount your Bike here."))
    #      return false
    #    end
    #    return true
    #  end
    #  if !map_metadata || (!map_metadata.can_bicycle && !map_metadata.outdoor_map)
    #    pbMessage(_INTL("Can't use that here."))
    #    return false
    #  end
    #  return true
    end
     
    Did you set the maps metadata to outdoors? Doing that should fix your bike issues. The Bike Check code works in base Essentials, but it only works on maps set to "Outdoor = true" in the map_metadata PBS. This is assuming v20.
     
    But I want the player to be able to bike anywhere, even indoors.

    Do I have to set every location as "Outdoors" in the Metadata? That will add light-based tinting to everywhere I mark as "Outdoors". What about indoor locations with their own lighting, like a bicycle park that's also a Pokemon Gym?
     
    I thought you were having issues with the bicycle in general, not trying to make it usable on every map.
    The script you should be editing is
    Code:
    def pbCanUseBike?(map_id)
      map_metadata = GameData::MapMetadata.try_get(map_id)
      return false if !map_metadata
      return map_metadata.always_bicycle || map_metadata.can_bicycle || map_metadata.outdoor_map
    end

    If you change it to this:
    Code:
    def pbCanUseBike?(map_id)
      map_metadata = GameData::MapMetadata.try_get(map_id)
      return true if map.metadata || !map_metadata
    end
    Then you will never be dismounted from your bike and can ride it anywhere. This is a janky way to write the script, and I'm sure somebody better or more interested in it could make it cleaner, but it works. If you want to make it so there are some places you can't use the bike, then you can readd the "return false if" line and add your exception.

    (Note that the code basically says "Can use bike if the map has a map.metadata or doesn't have a map.metadata", which may have unintended side effects. But it worked it base Essentials on both Outdoor and Indoor maps.)
     
    Thank you.

    Code:
    def pbCanUseBike?(map_id)
    return true
    end

    I had been using this as replacement "can use bike" code, but your version seems cooler.
     
    Back
    Top