# ------------------------------------------ ## Passability Snippet RPG Maker VX (NOT Ace) ## -------------------------------------------------------------------------- ## This is a simple mod to allow for tiles to be ignored or not ignored. ## Basically its untested, because I don't want to go find all the required ## tileset numbers. ## ## OVERWRITES: ## Game_Map.passable? ## ## Directions: ## 1. Place above main. ## 2. Populate tile arrays. ## 3. Test and send me bugs. ## ## Made By: ## FunplayerGGPO ## Use if you want. ## -------------------------------------------------------------------------- #module PASSABILITY #[tile_id,tile_id,tile_id] SHIP_ADD_PASSABILITY = [93,68] SHIP_BLOCK_PASSABILITY = [64] #[tile_id,tile_id,tile_id] BOAT_ADD_PASSABILITY = [87] BOAT_BLOCK_PASSABILITY = [88]endclass Game_Map # ------------------- # # OVERWRITES PASSABLE # #-------------------------------------------------------------------------- # * Determine if Passable # x : x coordinate # y : y coordinate # flag : The impassable bit to be looked up # (normally 0x01, only changed for vehicles) #-------------------------------------------------------------------------- def passable?(x, y, flag = 0x01) for event in events_xy(x, y) # events with matching coordinates next if event.tile_id == 0 # graphics are not tiled next if event.priority_type > 0 # not [Below characters] next if event.through # pass-through state pass = @passages[event.tile_id] # get passable attribute next if pass & 0x10 == 0x10 # *: Does not affect passage return true if pass & flag == 0x00 # o: Passable return false if pass & flag == flag # x: Impassable end for i in [2, 1, 0] # in order from on top of layer tile_id = @map.data[x, y, i] # get tile ID return false if tile_id == nil # failed to get tile: Impassable pass = @passages[tile_id] # get passable attribute # For ship, checks if the tile array includes the tile_id. spass = (PASSABILITY::SHIP_ADD_PASSABILITY.include?(tile_id/32) ) sblock = (PASSABILITY::SHIP_BLOCK_PASSABILITY.include?(tile_id/32)) bpass = (PASSABILITY::BOAT_ADD_PASSABILITY.include?(tile_id/32)) bblock = (PASSABILITY::BOAT_BLOCK_PASSABILITY.include?(tile_id/32)) next if pass & 0x10 == 0x10 # *: Does not affect passage return false if bblock and flag == 0x02 # x: BOAT NOT PASSABLE return true if (bpass) and flag == 0x02 # b: BOAT PASSABLE return false if sblock and flag == 0x04 # x: SHIP NOT PASSABLE return true if (spass) and flag == 0x04 # s: SHIP PASSABLE return true if pass & flag == 0x00 # o: Passable return false if pass & flag == flag # x: Impassable end return false # Impassable endend