• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

Debug Passibility Script - Find mapping mistakes yourself!

95
Posts
9
Years
  • hvmwvi3u.png

    © Gexeys for logo.


    What is the script actually doing?
    It shows you during the running game where you can go to and where not. In addition to that it is showing the events on the map and the terrain tags if you wish too.

    f7jmjcac.png


    Why is this useful?
    Everyone knows the situation. You are creating a fangame and look for bugs especially in mapping. without this script you would need to run against every wall to see if it might be passable or not
    and you will never fix all bugs, and maybe even beta testers skip some.
    so this is the solution. if you still don't know what it does, check this video at 1:25 https://www.youtube.com/watch?v=udH5-IHy2gg
    and i think you'll know what i am talking about.

    I even found two small mapping bugs in Pokémon Essentials while walking though the game.
    On the left picture you can see that if you would be inside the water tile before the bridge you could move one more step downwards. It doesn't really needs a fix because you can't go on the water
    so it will never happen. but if you use shift in debug mode to get there. you could still walk one more step without pressing shift.
    On the right picture you can see just a little priority bug. the character should be above the wall.

    mkay287n.png



    Here are some examples how obvious mapping errors are with the script:
    The left example is probably a little bit exaggerated but the right example is surely an example of how it may look for you.

    qbvdwy7v.png


    Current Version: V2

    Changelog:

    V2 Updates:
    - Fixed Water will not be registered as passable even when surfing.
    - Fixed Autotiles will not be registered as passable sometimes.
    - Added visible terrain tag's + options for it.
    qd7r5oui.png



    Known bugs:
    - Only the current map will be scanned.
    - Events will always be registered as passable.

    Settings:

    SHOW_EVENTS - If false the black-white squares for the events won't be visible. It can reduces lag to disable them if you have Events with move routes.
    SHOW_PASSIBILITY - If false the red squares for the passibility won't be visible. Disable them is not really the best idea because this is the core of the script... but yeaah :D
    SHOW_TERRAIN_TAGS - If false the terrain tags won't be visible. It can reduce lag to disable them.

    $passa_field_size - The field's square size in pixels. You can choose between 1 and 32 (full square). If you choose a unjustifiable value it will be 4 by default.
    $passa_event_size - The event's square size in pixels. You can choose between 1 and 32 (full square). If you choose a unjustifiable value it will be 16 by default.
    $passa_event_size_outline - The event's outline square size in pixels. You can choose between 1 and the value you choosed for $passa_event_size. If you choose a unjustifiable value it will be 2 by default.

    $passa_opacity - The opacity of all squares. If you want it more transparent use a higher value. If you want it less transparent choose a higher value. (Choose between 0 (transparent) and 255 (not transparent).
    $passa_field_color - The color of the field's square in RGB format. (red by default.)
    $passa_event_color - The color of the event's square in RGB format. (black by default.)
    $passa_event_color2 - The color of the event's outline square in RGB format. (white by default.)
    $passa_terrain_color - The color for the terrain tag's in RGB format. (white by default.)
    $passa_terrain_color2 - The color for the terrain tag's outline in RGB format. (black by default.)

    GET THE SCRIPT (GIVE CREDITS IF USED!) :
    Code:
    #===============================================================================
    # * Debug Passability Script for Pokémon Essentials by shiney570.
    #
    # Current Version: V2.0
    # 
    # 
    # * If you have any questions or found a bug let me know.
    # * Contact: Skype: imatrix.wt ;  DeviantArt: shiney570
    #===============================================================================
    
    # SETTINGS
    
    # When true, the event squares will be visible. (May reduce lag.)
    SHOW_EVENTS         = true
    # When true, the passability squares will be visible.
    SHOW_PASSIBILITY    = true
    # When true, the terrain tags will be visible.
    SHOW_TERRAIN_TAGS   = true
    
    # Size of the field square. (choose a number between 1 and 15.)
    $passa_field_size   = 4
    # Size of the event square. (choose a number between 1 and 32.)
    $passa_event_size   = 16
    $passa_event_size_outline = 2
    # Opacity of the squares.
    # (choose a number between 0 (invisible) and 255 (visible).)
    
    $passa_opacity        = 200 
    # Color of the field squares. (red by default.)
    $passa_field_color    = Color.new(255,0,0)
    # Color of the event squares. 
    $passa_event_color    = Color.new(0,0,0) # (black by default.)
    $passa_event_color2   = Color.new(255,255,255)# (white by default.)
    # Color of the terrain text.
    $passa_terrain_color  = Color.new(255,255,255) # (white by default.)
    $passa_terrain_color2  = Color.new(0,0,0) # (black by default.)
    #===============================================================================
    
    class Debug_Passability 
      def initialize
        # The next four lines were made for idiots.
        $passa_field_size=4 if ($passa_field_size>15 || $passa_field_size<1)
        $passa_event_size=16 if ($passa_event_size>32 || $passa_field_size<1)
        $passa_event_size_outline=2 if ($passa_event_size_outline>32 || $passa_event_size_outline<1)
        $passa_opacity=200 if ($passa_opacity>255 || $passa_opacity<1)
        # Creating bitmap and sprite.
        if $passa_bitmap
          $passa_bitmap.clear
          $passa_sprite.dispose
          $passa_terrain_bitmap.dispose if $passa_terrain_bitmap
        end
        $passa_bitmap=Bitmap.new($game_map.width*32,$game_map.height*32)
        $passa_sprite=Sprite.new
        $passa_sprite.bitmap=$passa_bitmap
        $passa_sprite.z=100
        $passa_sprite.opacity=$passa_opacity
        $passa_bitmap.clear 
        
        $passa_terrain_bitmap=BitmapSprite.new($game_map.width*32,$game_map.height*32)
        $passa_terrain_bitmap.z=$passa_sprite.z
        $passa_terrain_bitmap.bitmap.font.name="Arial"
        $passa_terrain_bitmap.bitmap.font.size=20
        $passa_terrain=[]
        # Filling the fields.
        for xval in 0..$game_map.width
          for yval in 0..$game_map.height
            x=16+xval*32
            y=16+yval*32
            if isEvent?(xval,yval) 
              $passa_bitmap.fill_rect(x+16-($passa_event_size/2),
              y+16-($passa_event_size/2),$passa_event_size,
              $passa_event_size,$passa_event_color)
              $passa_bitmap.fill_rect(x+16-($passa_event_size/2),
              y+16-($passa_event_size/2),$passa_event_size,
              $passa_event_size_outline,$passa_event_color2)
              $passa_bitmap.fill_rect(x+16-($passa_event_size/2),
              y+16-($passa_event_size/2)+$passa_event_size-$passa_event_size_outline,
              $passa_event_size,$passa_event_size_outline,$passa_event_color2)
              $passa_bitmap.fill_rect(x+16-($passa_event_size/2),
              y+16-($passa_event_size/2),$passa_event_size_outline,
              $passa_event_size,$passa_event_color2)
              $passa_bitmap.fill_rect(x+16-($passa_event_size/2)+$passa_event_size-$passa_event_size_outline,
              y+16-($passa_event_size/2),$passa_event_size_outline,$passa_event_size,
              $passa_event_color2)
            end
            if !playerPassable?(xval,yval,2) # DOWN
              $passa_bitmap.fill_rect(x,y+32-$passa_field_size,32,
              $passa_field_size,$passa_field_color)
            end
            if !playerPassable?(xval,yval,4) # LEFT
              $passa_bitmap.fill_rect(x,y,$passa_field_size,32,
              $passa_field_color)
            end
            if !playerPassable?(xval,yval,6) # RIGHT
              $passa_bitmap.fill_rect(x+32-$passa_field_size,y,
              $passa_field_size,32,$passa_field_color)
            end
            if !playerPassable?(xval,yval,8) # UP
              $passa_bitmap.fill_rect(x,y,32,$passa_field_size,
              $passa_field_color)
            end
            tileHasTerrainTag?(xval,yval) if SHOW_TERRAIN_TAGS
          end
        end
        pbDrawTextPositions($passa_terrain_bitmap.bitmap,$passa_terrain)
      end
      
       # Method which returns the passability of a field.
      def playerPassable?(x, y, d, self_event = nil)
        @passages=$passa_passages
        @priorities=$passa_priorities
        @terrain_tags=$passa_terrain_tags
        bit = (1 << (d / 2 - 1)) & 0x0f
        for i in [2, 1, 0]
          tile_id = $game_map.data[x, y, i]
          # Ignore bridge tiles if not on a bridge
          next if $PokemonMap && $PokemonMap.bridge==0 &&
             tile_id && @terrain_tags[tile_id]==PBTerrain::Bridge
          if tile_id == nil
            return false
          # Make water tiles passable if player is surfing
          elsif $PokemonGlobal.surfing &&
             pbIsPassableWaterTag?(@terrain_tags[tile_id])
            return true
          # Prevent cycling in really tall grass
          elsif $PokemonGlobal.bicycle &&
             @terrain_tags[tile_id]==PBTerrain::TallGrass
            return false
          # Prevent cycling on ice
          elsif $PokemonGlobal.bicycle &&
             @terrain_tags[tile_id]==PBTerrain::Ice
            return false
          # Depend on passability of bridge tile if on bridge
          elsif $PokemonMap && $PokemonMap.bridge>0 &&
             @terrain_tags[tile_id]==PBTerrain::Bridge
            if @passages[tile_id] & bit != 0 ||
               @passages[tile_id] & 0x0f == 0x0f
              return false
            else
              return true
            end
          # Regular passability checks
          elsif @passages[tile_id] & bit != 0
            return false
          elsif @passages[tile_id] & 0x0f == 0x0f
            return false
          elsif @priorities[tile_id] == 0
            return true
          end
        end
        return true
      end
      
      def valid?(x, y)
         return (x >= 0 and x < $game_map.width and y >= 0 and y < $game_map.height)
       end
       
      # Method which returns whether a square is an event or not.
      def isEvent?(x,y)
        return false if !SHOW_EVENTS
        for event in $game_map.events.values
          if ( (x==event.x) && (y==event.y) )
            return true
          end
        end
        return false
      end
    
    # Method which checks whether a tile has a terrain tag.
      def tileHasTerrainTag?(x,y)
        if $game_map.terrain_tag(x,y)>0
         # p "#{$game_map.terrain_tag(x,y)} #{x} #{y}"
          $passa_terrain.push([_INTL("{1}",$game_map.terrain_tag(x,y)),
          32+32*x,22+32*y,2,$passa_terrain_color,$passa_terrain_color2])
        end
      end
    end
    
    # Updating Game_Map so the passable method won't have undefined methods.
    class Game_Map
      alias old_setup_kodsn :setup
      def setup(map_id)
        old_setup_kodsn(map_id)
        $passa_passages=@passages 
        $passa_priorities=@priorities 
        $passa_terrain_tags=@terrain_tags 
      end
    end
    
    # Disposes the Passability stuff.
    def dispose_Debug_Passability 
      $passa_sprite.dispose
      $passa_bitmap.clear
      $passa_terrain_bitmap.dispose
      $passa_sprite=nil
      $passa_bitmap=nil
      $passa_terrain_bitmap=nil
    end
    
    # Weird method which checks whether the Debug Passability needs an update or not.
    def passability_needs_update?
      $passa_event_array="" if !$passa_event_array
      $passa_event_array2=""
      for event in $game_map.events.values
        $passa_event_array2.insert($passa_event_array2.length,"#{event.x}") if SHOW_EVENTS
        $passa_event_array2.insert($passa_event_array2.length,"#{event.y}") if SHOW_EVENTS
      end
      if $PokemonMap
        $passa_event_array2.insert($passa_event_array2.length,"#{$PokemonMap.bridge}") if SHOW_PASSIBILITY
        $passa_event_array2.insert($passa_event_array2.length,"#{$PokemonMap.movedEvents}") if SHOW_PASSIBILITY
        $passa_event_array2.insert($passa_event_array2.length,"#{$PokemonMap.erasedEvents}") if SHOW_PASSIBILITY
      end
      $passa_event_array2.insert($passa_event_array2.length,"#{$PokemonGlobal.bicycle}") if SHOW_PASSIBILITY
      $passa_event_array2.insert($passa_event_array2.length,"#{$PokemonGlobal.surfing}") if SHOW_PASSIBILITY
      $passa_event_array2.insert($passa_event_array2.length,"#{$PokemonGlobal.sliding}") if SHOW_PASSIBILITY
      $passa_event_array2.insert($passa_event_array2.length,"#{$game_map}") if SHOW_PASSIBILITY
      if $passa_event_array == $passa_event_array2
        return false
      else
        $passa_event_array=$passa_event_array2
        return true
      end
    end
    
    # Fixes Bug with jumping.
    class Game_Player < Game_Character
      alias old_update_shiney :update
      def update
        if $passa_sprite
          Debug_Passability.new if passability_needs_update?
          $passa_sprite.x= -($game_map.display_x/4)-16 
          $passa_sprite.y= -($game_map.display_y/4)-16
          if $passa_terrain_bitmap
            $passa_terrain_bitmap.x=$passa_sprite.x
            $passa_terrain_bitmap.y=$passa_sprite.y
          end
         end     
        old_update_shiney
      end
    end
    
    # Creating Input K.
    module Input  
      K = 42
      class << self
        alias old_self_button_to_key_shiney :buttonToKey
      end
      
      def self.buttonToKey(button)
        case button    
        when Input::K
          return [0x4B] # K
        end 
        self.old_self_button_to_key_shiney(button)
      end
    end
    
    # Updating Scene_Map
    class Scene_Map 
      def main
        createSpritesets
        Graphics.transition      
        loop do
          if $passa_sprite
            Debug_Passability.new if passability_needs_update?
            $passa_sprite.x= -($game_map.display_x/4)-16 
            $passa_sprite.y= -($game_map.display_y/4)-16
            if $passa_terrain_bitmap
              $passa_terrain_bitmap.x=$passa_sprite.x
              $passa_terrain_bitmap.y=$passa_sprite.y
            end
          end      
          Graphics.update
          Input.update
          update
          if Input.trigger?(Input::K) && $DEBUG
            if $passa_sprite
              dispose_Debug_Passability
            else
              Debug_Passability.new
            end
          end
          #if SAVESTATES
          #  update_savestates
          #end
          #if ($saveStateFrameCount && SAVESTATES )
          #  $saveStateFrameCount+=1
          #  if $saveStateFrameCount>=80
          #    $saveStateBitmap.bitmap.clear
          #    $saveStateFrameCount=nil
          #  end
          #end
          if $scene != self
            break
          end
        end
        Graphics.freeze
        disposeSpritesets
        if $game_temp.to_title
          Graphics.transition
          Graphics.freeze
        end
      end
    end

    To show the passability press K on your keyboard in Debug mode. To hide it press K again.

    don't tell me that it's called Passability i just noticed after posting the script -_-

    got inspired by: http://rpgmaker-vx-ace.de/board9-rpg-maker-vx-ace-lite/board18-scripts-rgss3-ace/board62-script-datenbank/2616-debug-passability-test/?763c44c9

    NOTE: If you are using this script feel free to send me some images of bugs you fixed with it!
     
    Last edited:
    32
    Posts
    10
    Years
    • Seen Nov 19, 2016
    Wow! This is quite stunning. Definitely will post back what it's caught for me, because, though I'm a very careful mapper, it's already got 3 loose tiles on of my most heavily edited maps! Thanks a whole bunch for such a life-saving safety net.

    Though... You might want to recheck if your "Quick Save" savestate script is even included in the user's game project or not (for those who have no intention of using your Quick Save script at all). Immediate error on uninitialized constant SAVESTATES because I wasn't using your savestates script. Cleared once I actually added it in or delete the related lines, of course.

    Bug message for posterity...
    Spoiler:
     
    Last edited:
    95
    Posts
    9
    Years
  • Wow! This is quite stunning. Definitely will post back what it's caught for me, because, though I'm a very careful mapper, it's already got 3 loose tiles on of my most heavily edited maps! Thanks a whole bunch for such a life-saving safety net.

    Though... You might want to recheck if your "Quick Save" savestate script is even included in the user's game project or not (for those who have no intention of using your Quick Save script at all). Immediate error on uninitialized constant SAVESTATES because I wasn't using your savestates script. Cleared once I actually added it in or delete the related lines, of course.

    Bug message for posterity...
    Spoiler:

    oh! i updated the script, should work now. if somebody is using my savestates script he should delete the #'s starting at if SAVESTATES
     
    824
    Posts
    8
    Years
  • Might want to note, most people can't see something that's 1/255th opaque. You might want to fix the "these four lines were written to counteract idiocy" lines accordingly.
     

    KillerMapper

    Helix Follower
    200
    Posts
    9
    Years
  • Got this error when I tried to surf with the script on:

    Exception: NameError

    Message: undefined local variable or method `tile_id' for #<Debug_Passability:0xb2c5f40>

    Passability:105:in `passable?'

    Passability:77:in `initialize'

    Passability:54:in `each'

    Passability:54:in `initialize'

    Passability:53:in `each'

    Passability:53:in `initialize'

    Passability:273:in `new'

    Passability:273:in `update'

    Scene_Map:85:in `miniupdate'

    Scene_Map:83:in `loop'

    I can surf with the grid disabled, but if I press K while surfing I'll have the same error.
     

    KillerMapper

    Helix Follower
    200
    Posts
    9
    Years
  • Thanks for the fix. And the terrain tag viewer is a nice addition. It helps to find things like surf tiles under other tiles where the player can use surf where he should not.
     
    9
    Posts
    9
    Years
    • Seen May 1, 2016
    Hi! i've a problem pressing the K key...
    Spoiler:


    How can i fix it?
     
    226
    Posts
    8
    Years
    • Seen Jul 19, 2023
    It looks great but sadly it doesn't work for me (15.1). Nothing happens when I press K or k in debug mode. (I got the script from printable version).
     

    Arkadious

    Developer of Fragmentum
    50
    Posts
    8
    Years
  • Doesn't work for me for some reason. Whenever I press the K key, I get this error:

    ---------------------------
    Pokemon Essentials
    ---------------------------
    Exception: NoMethodError

    Message: undefined method `bridge' for #<PokemonMapMetadata:0xd540430>

    Debug Passability:117:in `playerPassable?'

    Debug Passability:114:in `each'

    Debug Passability:114:in `playerPassable?'

    Debug Passability:86:in `initialize'

    Debug Passability:66:in `each'

    Debug Passability:66:in `initialize'

    Debug Passability:65:in `each'

    Debug Passability:65:in `initialize'

    Debug Passability:280:in `new'

    Debug Passability:280:in `main'



    This exception was logged in

    C:\Users\brand\Saved Games/Pokemon Essentials/errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK
    ---------------------------

    I got this from the print screen version.
     
    Last edited:
    68
    Posts
    8
    Years
    • Seen Dec 3, 2016
    Yeah I get the same error :( Works with Kleins Bw kit so maybe its because of the v16 update
     

    Aljen

    The Lost Boy...
    125
    Posts
    10
    Years
  • MT26Mr8.png

    Shiney, somehow it doesnt fill all my map, it always left a part on the right edge of the map. Can I ask if there is a way to modify this?
     
    61
    Posts
    7
    Years
  • Thanks for the great script Shiney! At first I had the same problem but thanks to the change I made to the Pokemonglobal.bridge part it works wonderful now :)
     
    14
    Posts
    9
    Years
    • Seen Jan 27, 2022
    Fix for v17.2 version:

    #===============================================================================
    # * Debug Passability Script for Pokémon Essentials by shiney570.
    #
    # Current Version: V2.0
    #
    #
    # * If you have any questions or found a bug let me know.
    # * Contact: Skype: imatrix.wt ; DeviantArt: shiney570
    #===============================================================================

    # SETTINGS

    # When true, the event squares will be visible. (May reduce lag.)
    SHOW_EVENTS = true
    # When true, the passability squares will be visible.
    SHOW_PASSIBILITY = true
    # When true, the terrain tags will be visible.
    SHOW_TERRAIN_TAGS = true

    # Size of the field square. (choose a number between 1 and 15.)
    $passa_field_size = 4
    # Size of the event square. (choose a number between 1 and 32.)
    $passa_event_size = 16
    $passa_event_size_outline = 2
    # Opacity of the squares.
    # (choose a number between 0 (invisible) and 255 (visible).)

    $passa_opacity = 200
    # Color of the field squares. (red by default.)
    $passa_field_color = Color.new(255,0,0)
    # Color of the event squares.
    $passa_event_color = Color.new(0,0,0) # (black by default.)
    $passa_event_color2 = Color.new(255,255,255)# (white by default.)
    # Color of the terrain text.
    $passa_terrain_color = Color.new(255,255,255) # (white by default.)
    $passa_terrain_color2 = Color.new(0,0,0) # (black by default.)
    #===============================================================================

    class Debug_Passability
    def initialize
    # The next four lines were made for idiots.
    $passa_field_size=4 if ($passa_field_size>15 || $passa_field_size<1)
    $passa_event_size=16 if ($passa_event_size>32 || $passa_field_size<1)
    $passa_event_size_outline=2 if ($passa_event_size_outline>32 || $passa_event_size_outline<1)
    $passa_opacity=200 if ($passa_opacity>255 || $passa_opacity<1)
    # Creating bitmap and sprite.
    if $passa_bitmap
    $passa_bitmap.clear
    $passa_sprite.dispose
    $passa_terrain_bitmap.dispose if $passa_terrain_bitmap
    end
    $passa_bitmap=Bitmap.new($game_map.width*32,$game_map.height*32)
    $passa_sprite=Sprite.new
    $passa_sprite.bitmap=$passa_bitmap
    $passa_sprite.z=100
    $passa_sprite.opacity=$passa_opacity
    $passa_bitmap.clear

    $passa_terrain_bitmap=BitmapSprite.new($game_map.width*32,$game_map.height*32)
    $passa_terrain_bitmap.z=$passa_sprite.z
    $passa_terrain_bitmap.bitmap.font.name="Arial"
    $passa_terrain_bitmap.bitmap.font.size=20
    $passa_terrain=[]
    # Filling the fields.
    for xval in 0..$game_map.width
    for yval in 0..$game_map.height
    x=16+xval*32
    y=16+yval*32
    if isEvent?(xval,yval)
    $passa_bitmap.fill_rect(x+16-($passa_event_size/2),
    y+16-($passa_event_size/2),$passa_event_size,
    $passa_event_size,$passa_event_color)
    $passa_bitmap.fill_rect(x+16-($passa_event_size/2),
    y+16-($passa_event_size/2),$passa_event_size,
    $passa_event_size_outline,$passa_event_color2)
    $passa_bitmap.fill_rect(x+16-($passa_event_size/2),
    y+16-($passa_event_size/2)+$passa_event_size-$passa_event_size_outline,
    $passa_event_size,$passa_event_size_outline,$passa_event_color2)
    $passa_bitmap.fill_rect(x+16-($passa_event_size/2),
    y+16-($passa_event_size/2),$passa_event_size_outline,
    $passa_event_size,$passa_event_color2)
    $passa_bitmap.fill_rect(x+16-($passa_event_size/2)+$passa_event_size-$passa_event_size_outline,
    y+16-($passa_event_size/2),$passa_event_size_outline,$passa_event_size,
    $passa_event_color2)
    end
    if !playerPassable?(xval,yval,2) # DOWN
    $passa_bitmap.fill_rect(x,y+32-$passa_field_size,32,
    $passa_field_size,$passa_field_color)
    end
    if !playerPassable?(xval,yval,4) # LEFT
    $passa_bitmap.fill_rect(x,y,$passa_field_size,32,
    $passa_field_color)
    end
    if !playerPassable?(xval,yval,6) # RIGHT
    $passa_bitmap.fill_rect(x+32-$passa_field_size,y,
    $passa_field_size,32,$passa_field_color)
    end
    if !playerPassable?(xval,yval,8) # UP
    $passa_bitmap.fill_rect(x,y,32,$passa_field_size,
    $passa_field_color)
    end
    tileHasTerrainTag?(xval,yval) if SHOW_TERRAIN_TAGS
    end
    end
    pbDrawTextPositions($passa_terrain_bitmap.bitmap,$passa_terrain)
    end

    # Method which returns the passability of a field.
    def playerPassable?(x, y, d, self_event = nil)
    @passages=$passa_passages
    @priorities=$passa_priorities
    @terrain_tags=$passa_terrain_tags
    bit = (1 << (d / 2 - 1)) & 0x0f
    for i in [2, 1, 0]
    tile_id = $game_map.data[x, y, i]
    # Ignore bridge tiles if not on a bridge
    next if $PokemonMap && $PokemonGlobal.bridge==0 &&
    tile_id && @terrain_tags[tile_id]==PBTerrain::Bridge
    if tile_id == nil
    return false
    # Make water tiles passable if player is surfing
    elsif $PokemonGlobal.surfing &&
    pbIsPassableWaterTag?(@terrain_tags[tile_id])
    return true
    # Prevent cycling in really tall grass
    elsif $PokemonGlobal.bicycle &&
    @terrain_tags[tile_id]==PBTerrain::TallGrass
    return false
    # Prevent cycling on ice
    elsif $PokemonGlobal.bicycle &&
    @terrain_tags[tile_id]==PBTerrain::Ice
    return false
    # Depend on passability of bridge tile if on bridge
    elsif $PokemonMap && $PokemonGlobal.bridge>0 &&
    @terrain_tags[tile_id]==PBTerrain::Bridge
    if @passages[tile_id] & bit != 0 ||
    @passages[tile_id] & 0x0f == 0x0f
    return false
    else
    return true
    end
    # Regular passability checks
    elsif @passages[tile_id] & bit != 0
    return false
    elsif @passages[tile_id] & 0x0f == 0x0f
    return false
    elsif @priorities[tile_id] == 0
    return true
    end
    end
    return true
    end

    def valid?(x, y)
    return (x >= 0 and x < $game_map.width and y >= 0 and y < $game_map.height)
    end

    # Method which returns whether a square is an event or not.
    def isEvent?(x,y)
    return false if !SHOW_EVENTS
    for event in $game_map.events.values
    if ( (x==event.x) && (y==event.y) )
    return true
    end
    end
    return false
    end

    # Method which checks whether a tile has a terrain tag.
    def tileHasTerrainTag?(x,y)
    if $game_map.terrain_tag(x,y)>0
    # p "#{$game_map.terrain_tag(x,y)} #{x} #{y}"
    $passa_terrain.push([_INTL("{1}",$game_map.terrain_tag(x,y)),
    32+32*x,22+32*y,2,$passa_terrain_color,$passa_terrain_color2])
    end
    end
    end

    # Updating Game_Map so the passable method won't have undefined methods.
    class Game_Map
    alias old_setup_kodsn :setup
    def setup(map_id)
    old_setup_kodsn(map_id)
    $passa_passages=@passages
    $passa_priorities=@priorities
    $passa_terrain_tags=@terrain_tags
    end
    end

    # Disposes the Passability stuff.
    def dispose_Debug_Passability
    $passa_sprite.dispose
    $passa_bitmap.clear
    $passa_terrain_bitmap.dispose
    $passa_sprite=nil
    $passa_bitmap=nil
    $passa_terrain_bitmap=nil
    end

    # Weird method which checks whether the Debug Passability needs an update or not.
    def passability_needs_update?
    $passa_event_array="" if !$passa_event_array
    $passa_event_array2=""
    for event in $game_map.events.values
    $passa_event_array2.insert($passa_event_array2.length,"#{event.x}") if SHOW_EVENTS
    $passa_event_array2.insert($passa_event_array2.length,"#{event.y}") if SHOW_EVENTS
    end
    if $PokemonMap
    $passa_event_array2.insert($passa_event_array2.length,"#{$PokemonGlobal.bridge}") if SHOW_PASSIBILITY
    $passa_event_array2.insert($passa_event_array2.length,"#{$PokemonMap.movedEvents}") if SHOW_PASSIBILITY
    $passa_event_array2.insert($passa_event_array2.length,"#{$PokemonMap.erasedEvents}") if SHOW_PASSIBILITY
    end
    $passa_event_array2.insert($passa_event_array2.length,"#{$PokemonGlobal.bicycle}") if SHOW_PASSIBILITY
    $passa_event_array2.insert($passa_event_array2.length,"#{$PokemonGlobal.surfing}") if SHOW_PASSIBILITY
    $passa_event_array2.insert($passa_event_array2.length,"#{$PokemonGlobal.sliding}") if SHOW_PASSIBILITY
    $passa_event_array2.insert($passa_event_array2.length,"#{$game_map}") if SHOW_PASSIBILITY
    if $passa_event_array == $passa_event_array2
    return false
    else
    $passa_event_array=$passa_event_array2
    return true
    end
    end

    # Fixes Bug with jumping.
    class Game_Player < Game_Character
    alias old_update_shiney :update
    def update
    if $passa_sprite
    Debug_Passability.new if passability_needs_update?
    $passa_sprite.x= -($game_map.display_x/4)-16
    $passa_sprite.y= -($game_map.display_y/4)-16
    if $passa_terrain_bitmap
    $passa_terrain_bitmap.x=$passa_sprite.x
    $passa_terrain_bitmap.y=$passa_sprite.y
    end
    end
    old_update_shiney
    end
    end

    # Creating Input K.
    module Input
    K = 42
    class << self
    alias old_self_button_to_key_shiney :buttonToKey
    end

    def self.buttonToKey(button)
    case button
    when Input::K
    return [0x4B] # K
    end
    self.old_self_button_to_key_shiney(button)
    end
    end

    # Updating Scene_Map
    class Scene_Map
    def main
    createSpritesets
    Graphics.transition
    loop do
    if $passa_sprite
    Debug_Passability.new if passability_needs_update?
    $passa_sprite.x= -($game_map.display_x/4)-16
    $passa_sprite.y= -($game_map.display_y/4)-16
    if $passa_terrain_bitmap
    $passa_terrain_bitmap.x=$passa_sprite.x
    $passa_terrain_bitmap.y=$passa_sprite.y
    end
    end
    Graphics.update
    Input.update
    update
    if Input.trigger?(Input::K) && $DEBUG
    if $passa_sprite
    dispose_Debug_Passability
    else
    Debug_Passability.new
    end
    end
    #if SAVESTATES
    # update_savestates
    #end
    #if ($saveStateFrameCount && SAVESTATES )
    # $saveStateFrameCount+=1
    # if $saveStateFrameCount>=80
    # $saveStateBitmap.bitmap.clear
    # $saveStateFrameCount=nil
    # end
    #end
    if $scene != self
    break
    end
    end
    Graphics.freeze
    disposeSpritesets
    if $game_temp.to_title
    Graphics.transition
    Graphics.freeze
    end
    end
    end
     

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Fix for v17.2 version:
    Spoiler:

    Please use spoiler inside [] put your phrase and close usin spoiler inside [/] to hide your big text, and inside, add code inside [] and put all script, then close usin code inside [/] to make like script code. Example:
    Spoiler:
     
    Last edited:

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • EDIT: is 'PBTerrain.isPassableWater?', not 'isPassableWater?'. Fixed.
    Changed 'pbIsPassableWaterTag?' to 'PBTerrain.isPassableWater?' and works perfectly into v17.2:

    Spoiler:
     
    Last edited:
    Back
    Top