Jump to content
AeghtyAteKees

Add barriers to fly script!

Recommended Posts

Hi, guys.

 

I'm using Galv's Superman Ability to allow my player to fly, though it has no movement restrictions whatsoever. The player is set to THROUGH and can move freely from corner to corner of the map.

 

Would it be possible to tweak "passable?" to check for a region ID I could use to draw some boundaries that block passability even when flying?

 

Thanks in advance!

Share this post


Link to post
Share on other sites

Hehe, I made a script once to allow characters (events or the player) to have different "pass types" so I could have some things that swim and some that fly over some kinds of terrain and some that just phase through everything. It's not quite the same thing, but I mostly did it through a character's "map_passable?" method, so yeah this is indeed possible. Maybe this would work for you?

 

class Game_Player < Game_Character

  NO_FLY_REGION = 8 # change to whatever you want.
  
  alias map_passable_vehicle_check? map_passable?
  def map_passable?(x, y, d)
    if @in_air
      return $game_map.region_id(x, y) != NO_FLY_REGION
    end
    map_passable_vehicle_check?(x, y, d)
  end
                                  
end

Personally I rather use terrain tags since they are set in the tilemap and I don't need to set up regions on every map, but regions work too! Besides, you might prefer to do it with regions depending on how your maps are designed anyway.

Edited by Kayzee

Share this post


Link to post
Share on other sites

Thanks for the help! Sadly, this snippet doesn't have any effect on the script I'm using to fly. I tested it in a black project, too, so something maybe conflicting between the two scripts?

Share this post


Link to post
Share on other sites

That's funny, it was made for the script you linked to, so it should work although I haven't tested it. Maybe try this?
 

class Game_Player < Game_Character

  NO_FLY_REGION = 8 # change to whatever you want.
  
  alias map_passable_vehicle_check? map_passable?
  def map_passable?(x, y, d)
    if self.altitude > 0
      return $game_map.region_id(x, y) != NO_FLY_REGION
    end
    map_passable_vehicle_check?(x, y, d)
  end
                                  
end

 

You sure you set the areas you want flying to be blocked to region 8?

Edited by Kayzee

Share this post


Link to post
Share on other sites

Got it working.

Do you mind adding on another script?

use this mod I made from yanfly's region restrict

https://forums.rpgmakerweb.com/index.php?threads/how-to-restrict-the-player-from-moving-to-a-region-but-allow-it-for-events.109456/

 

Then add on this below it

 

class Game_CharacterBase

  def player_block_forbid?(x, y, d)
    return false unless self.is_a?(Game_Player)
    return false if debug_through?
    region = 0
    case d
    when 1; region = $game_map.region_id(x-1, y+1)
    when 2; region = $game_map.region_id(x+0, y+1)
    when 3; region = $game_map.region_id(x+1, y+1)
    when 4; region = $game_map.region_id(x-1, y+0)
    when 5; region = $game_map.region_id(x+0, y+0)
    when 6; region = $game_map.region_id(x+1, y+0)
    when 7; region = $game_map.region_id(x-1, y-1)
    when 8; region = $game_map.region_id(x+0, y-1)
    when 9; region = $game_map.region_id(x+1, y-1)
    end
    return true if $game_map.all_restrict_regions.include?(region)
    return $game_map.player_block_regions.include?(region)
  end
end

 

Edited by roninator2

Share this post


Link to post
Share on other sites

You know, you have

return true if $game_map.all_restrict_regions.include?(region)

then follow it with

return true if $game_map.all_restrict_regions.include?(region) && @in_air

which is the same thing with an extra condition. Shouldn't you delete the first line?

 

That script seems like it would work well though!

Share this post


Link to post
Share on other sites

Quick question. I'm already using Neon Black's Terrain Tags Script. It provides functionality for a region ID to make a tile impassable. Would it be possible to add a region ID to accomplish the same thing if the player is flying?

 

It would be great to add on to this script rather than adding another similar one (Yanfly's). Just to reduce bulk. I think line 277 is of interest?

 

:D

Share this post


Link to post
Share on other sites
18 hours ago, Kayzee said:

Shouldn't you delete the first line

silly me. It works without the extra line. I just had to rewrite that section because I had to remove @through.

The script by itself without the addon will stop player movement because it return true if @through is on.

Since in Galv's script @through is on when flying, all player movement is blocked.

1 hour ago, AeghtyAteKees said:

add a region ID to accomplish the same thing if the player is flying?

You want an extra region that will block flying but not player movement?

Edited by roninator2

Share this post


Link to post
Share on other sites

It'd be nice to have a region that will block flying but not player movement, and also one to block both, since I can't have two regions at one coordinate. Just in case I'd ever need that.

Share this post


Link to post
Share on other sites

I think I know why mine doesn't work actually. Maybe try this? It would probobly be simpler then using yanfly's region restrict, unless you wanted to use that script for other things.

class Game_Player < Game_Character

  NO_FLY_REGION = 8 # change to whatever you want.
  
  alias map_passable_vehicle_check? map_passable?
  def map_passable?(x, y, d)
    if self.altitude > 0
      return $game_map.region_id($game_map.round_x_with_direction(x, d), $game_map.round_y_with_direction(y, d)) != NO_FLY_REGION
    end
    map_passable_vehicle_check?(x, y, d)
  end
                                  
end

I forgot you needed to round the x and y coords like that. Well, actually I didn't exactly forget, I just thought for a bit that it already rounded. I was going to post this before, but I thought roninator2 had a pretty good idea too!

 

Also this should actually work better with looping maps then yanfly's region restrict since yanfly's region restrict doesn't use round_x_with_direction and round_y_with_direction. That's a really really minor problem though. Also, this doesn't really work with 8 directional movement, but most people don't use that anyway and I sorta know how to fix that if needed (it depends on what 8 directional movement script is used).

Edited by Kayzee

Share this post


Link to post
Share on other sites
Spoiler

Galv Superman support for Yanfly Move Restrict Region


#==============================================================================
#
# ▼ Yanfly Engine Ace - Move Restrict Region v1.03c
# -- Last Updated: 2019.07.29
# -- Level: Normal
# -- Requires: n/a
# -- additions by Roninator2
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-MoveRestrictRegion"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2019.07.25 - Added Feature: <player fly: x> # roninator2 for Galv Superman
# 2019.05.27 - Added Feature: <player block: x> # roninator2
# 2018.10.14 - Added Feature: <vehicle restrict: x> # roninator2
# 2012.08.26 - Added Feature: <all restrict: x>
# 2011.12.26 - Bug Fixed: Player Restricted Regions.
# 2011.12.15 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Not everybody wants NPC's to travel all over the place. With this script, you
# can set NPC's to be unable to move pass tiles marked by a specified Region.
# Simply draw out the area you want to enclose NPC's in on and they'll be
# unable to move past it unless they have Through on. Likewise, there are
# regions that you can prevent the player from moving onto, too!
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Map Notetags - These notetags go in the map notebox in a map's properties.
# -----------------------------------------------------------------------------
# <all restrict: x>
# <all restrict: x, x>
# Players and NPC's on the map will be unable to move past region x even if
# they have the "through" flag set. The only thing that can go past is if the
# player is using the debug through flag. Draw out the area you want to close
# the player and NPC's in with the regions and both will be unable to move onto
# any of those tiles marked by region x. If you want to have more regions
# restrict NPC's, insert multiples of this tag.
#
# <npc restrict: x>
# <npc restrict: x, x>
# NPC's on that map will be unable to move past regions x unless they have a
# "Through" flag on. Draw out the area you want to close NPC's in with the
# regions and the NPC's will be unable to move onto any of those tiles marked
# by region x. If you want to have more regions restrict NPC's, insert
# multiples of this tag.
#
# <player restrict: x>
# <player restrict: x, x>
# Players will not be able to move on tiles marked by region x unless the
# player has a "Through" flag on. Draw out the area you want to close the
# player in with the regions and the player will be unable to move past any of
# those tiles marked by region x. If you want to have more regions restrict the
# player, insert multiples of this tag.
#
# <player block: x>
# <player block: x, x>
# Players will not be able to move on tiles marked by region x even if
# they have the "through" flag set. The only thing that can go past is if the
# player is using the debug through flag. Draw out the area you want to close the
# player in with the regions and the player will be unable to move past any of
# those tiles marked by region x. If you want to have more regions restrict the
# player, insert multiples of this tag.
#
# <player fly: x>
# <player fly: x, x>
# Players will not be able to move on tiles marked by region x even if
# they have the "through" flag set. The only thing that can go past is if the
# player is using the debug through flag. Draw out the area you want to close the
# player in with the regions and the player will be unable to move past any of
# those tiles marked by region x. If you want to have more regions restrict the
# player, insert multiples of this tag.
#
# <vehicle restrict: x>
# <vehicle restrict: x, x>
# Players will not be able to move on tiles marked by region x unless the
# player has a "Through" flag on. Draw out the area you want to close the
# player in with the regions and the player will be unable to move past any of
# those tiles marked by region x. If you want to have more regions restrict the
# player, insert multiples of this tag.
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================

module YEA
  module MOVE_RESTRICT
  
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Default Completely Restricted Regions -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # If you want there to always be a region ID that will forbid both the
    # player and NPC's from passing through, insert that region ID into the
    # array below. This effect will completely block out both players and NPC's
    # even if they have the "through" flag. However, it does not block the
    # debug_through flag for players.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    DEFAULT_ALL = [60]
  
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Default Player Restricted Regions -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # If you want there to always be a region ID that will forbid the player
    # from passing through, insert that region ID into the array below.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    DEFAULT_PLAYER = [61]
  
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Default Player Blocked Regions -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # If you want there to always be a region ID that will forbid the player
    # from passing through, insert that region ID into the array below.
    # Including if @through is set.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    PLAYER_BLOCK = [59]
  
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Default Player fly Regions -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # If you want there to always be a region ID that will forbid the player
    # from passing through, insert that region ID into the array below.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    PLAYER_FLY = [58]
    
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Default NPC Restricted Regions -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # If you want there to always be a region ID that will forbid NPC's from
    # passing through, insert that region ID into the array below.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    DEFAULT_NPC = [62]
  
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Default Player Restricted Regions -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # If you want there to always be a region ID that will forbid the player
    # from passing through, insert that region ID into the array below.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    DEFAULT_VEHICLE = [63]
  
  end # MOVE_RESTRICT
end # YEA

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

module YEA
  module REGEXP
  module MAP
  
    ALL_RESTRICT =
      /<(?:ALL_RESTRICT|all restrict):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
    NPC_RESTRICT =
      /<(?:NPC_RESTRICT|npc restrict):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
    PLAYER_RESTRICT =
      /<(?:PLAYER_RESTRICT|player restrict):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
    PLAYER_BLOCK =
      /<(?:PLAYER_BLOCK|player block):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
    PLAYER_FLY =
      /<(?:PLAYER_FLY|player fly):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
    VEHICLE_RESTRICT =
      /<(?:VEHICLE_RESTRICT|vehicle restrict):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  
  end # MAP
  end # REGEXP
end # YEA

#==============================================================================
# ■ RPG::Map
#==============================================================================

class RPG::Map
 
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :all_restrict_regions
  attr_accessor :npc_restrict_regions
  attr_accessor :player_restrict_regions
  attr_accessor :player_block_regions
  attr_accessor :player_fly_regions
  attr_accessor :vehicle_restrict_regions
 
  #--------------------------------------------------------------------------
  # common cache: load_notetags_mrr
  #--------------------------------------------------------------------------
  def load_notetags_mrr
    @all_restrict_regions = YEA::MOVE_RESTRICT::DEFAULT_ALL.clone
    @npc_restrict_regions = YEA::MOVE_RESTRICT::DEFAULT_NPC.clone
    @player_restrict_regions = YEA::MOVE_RESTRICT::DEFAULT_PLAYER.clone
    @player_block_regions = YEA::MOVE_RESTRICT::PLAYER_BLOCK.clone
    @player_fly_regions = YEA::MOVE_RESTRICT::PLAYER_FLY.clone
    @vehicle_restrict_regions = YEA::MOVE_RESTRICT::DEFAULT_VEHICLE.clone
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEA::REGEXP::MAP::ALL_RESTRICT
        $1.scan(/\d+/).each { |num|
        @all_restrict_regions.push(num.to_i) if num.to_i > 0 }
      when YEA::REGEXP::MAP::NPC_RESTRICT
        $1.scan(/\d+/).each { |num|
        @npc_restrict_regions.push(num.to_i) if num.to_i > 0 }
      when YEA::REGEXP::MAP::PLAYER_RESTRICT
        $1.scan(/\d+/).each { |num|
        @player_restrict_regions.push(num.to_i) if num.to_i > 0 }
      when YEA::REGEXP::MAP::PLAYER_BLOCK
        $1.scan(/\d+/).each { |num|
        @player_block_regions.push(num.to_i) if num.to_i > 0 }
      when YEA::REGEXP::MAP::PLAYER_FLY
        $1.scan(/\d+/).each { |num|
        @player_fly_regions.push(num.to_i) if num.to_i > 0 }
      when YEA::REGEXP::MAP::VEHICLE_RESTRICT
        $1.scan(/\d+/).each { |num|
        @vehicle_restrict_regions.push(num.to_i) if num.to_i > 0 }
      #---
      end
    } # self.note.split
    #---
  end
 
end # RPG::Map

#==============================================================================
# ■ Game_Map
#==============================================================================

class Game_Map
 
  #--------------------------------------------------------------------------
  # alias method: setup
  #--------------------------------------------------------------------------
  alias game_map_setup_mrr setup
  def setup(map_id)
    game_map_setup_mrr(map_id)
    @map.load_notetags_mrr
  end
 
  #--------------------------------------------------------------------------
  # new method: all_restrict_regions
  #--------------------------------------------------------------------------
  def all_restrict_regions
    return @map.all_restrict_regions
  end
 
  #--------------------------------------------------------------------------
  # new method: npc_restrict_regions
  #--------------------------------------------------------------------------
  def npc_restrict_regions
    return @map.npc_restrict_regions
  end
 
  #--------------------------------------------------------------------------
  # new method: player_restrict_regions
  #--------------------------------------------------------------------------
  def player_restrict_regions
    return @map.player_restrict_regions
  end
 
  #--------------------------------------------------------------------------
  # new method: player_restrict_regions
  #--------------------------------------------------------------------------
  def player_block_regions
    return @map.player_block_regions
  end
 
  #--------------------------------------------------------------------------
  # new method: player_fly_regions    Galv Superman addon
  #--------------------------------------------------------------------------
  def player_fly_regions
    return @map.player_fly_regions
  end
  
  #--------------------------------------------------------------------------
  # new method: player_restrict_regions
  #--------------------------------------------------------------------------
  def vehicle_restrict_regions
    return @map.vehicle_restrict_regions
  end

end # Game_Map

#==============================================================================
# ■ Game_CharacterBase
#==============================================================================

class Game_CharacterBase
 
  #--------------------------------------------------------------------------
  # alias method: passable?
  #--------------------------------------------------------------------------
  alias game_characterbase_passable_mrr passable?
  def passable?(x, y, d)
    return false if npc_region_forbid?(x, y, d)
    return false if player_region_forbid?(x, y, d)
    return false if player_block_forbid?(x, y, d)
    return false if player_fly_forbid?(x, y, d) unless !@in_air
    return false if vehicle_region_forbid?(x, y, d)
    return game_characterbase_passable_mrr(x, y, d)
  end
 
  #--------------------------------------------------------------------------
  # new method: npc_forbid?
  #--------------------------------------------------------------------------
  def npc_region_forbid?(x, y, d)
    return false unless self.is_a?(Game_Event)
    region = 0
    case d
    when 1; region = $game_map.region_id(x-1, y+1)
    when 2; region = $game_map.region_id(x+0, y+1)
    when 3; region = $game_map.region_id(x+1, y+1)
    when 4; region = $game_map.region_id(x-1, y+0)
    when 5; region = $game_map.region_id(x+0, y+0)
    when 6; region = $game_map.region_id(x+1, y+0)
    when 7; region = $game_map.region_id(x-1, y-1)
    when 8; region = $game_map.region_id(x+0, y-1)
    when 9; region = $game_map.region_id(x+1, y-1)
    end
    return true if $game_map.all_restrict_regions.include?(region)
    return false if @through
    return $game_map.npc_restrict_regions.include?(region)
  end
 
  #--------------------------------------------------------------------------
  # new method: player_region_forbid?
  #--------------------------------------------------------------------------
  def player_region_forbid?(x, y, d)
    return false unless self.is_a?(Game_Player)
    return false if debug_through?
    region = 0
    case d
    when 1; region = $game_map.region_id(x-1, y+1)
    when 2; region = $game_map.region_id(x+0, y+1)
    when 3; region = $game_map.region_id(x+1, y+1)
    when 4; region = $game_map.region_id(x-1, y+0)
    when 5; region = $game_map.region_id(x+0, y+0)
    when 6; region = $game_map.region_id(x+1, y+0)
    when 7; region = $game_map.region_id(x-1, y-1)
    when 8; region = $game_map.region_id(x+0, y-1)
    when 9; region = $game_map.region_id(x+1, y-1)
    end
    return true if $game_map.all_restrict_regions.include?(region)
    return false if @through
    return $game_map.player_restrict_regions.include?(region)
  end
 
  #--------------------------------------------------------------------------
  # new method: player_region_forbid?
  #--------------------------------------------------------------------------
  def player_block_forbid?(x, y, d)
    return false unless self.is_a?(Game_Player)
    return false if debug_through?
    region = 0
    case d
    when 1; region = $game_map.region_id(x-1, y+1)
    when 2; region = $game_map.region_id(x+0, y+1)
    when 3; region = $game_map.region_id(x+1, y+1)
    when 4; region = $game_map.region_id(x-1, y+0)
    when 5; region = $game_map.region_id(x+0, y+0)
    when 6; region = $game_map.region_id(x+1, y+0)
    when 7; region = $game_map.region_id(x-1, y-1)
    when 8; region = $game_map.region_id(x+0, y-1)
    when 9; region = $game_map.region_id(x+1, y-1)
    end
    return true if $game_map.all_restrict_regions.include?(region)
    return true if $game_map.all_restrict_regions.include?(region) && @through unless @in_air
    return true if $game_map.all_restrict_regions.include?(region) && @in_air
    return $game_map.player_block_regions.include?(region)
  end
 
  #--------------------------------------------------------------------------
  # new method: player_region_forbid?
  #--------------------------------------------------------------------------
  def vehicle_region_forbid?(x, y, d)
    return false unless self.is_a?(Game_Vehicle)
    return false if debug_through?
    region = 0
    case d
    when 1; region = $game_map.region_id(x-1, y+1)
    when 2; region = $game_map.region_id(x+0, y+1)
    when 3; region = $game_map.region_id(x+1, y+1)
    when 4; region = $game_map.region_id(x-1, y+0)
    when 5; region = $game_map.region_id(x+0, y+0)
    when 6; region = $game_map.region_id(x+1, y+0)
    when 7; region = $game_map.region_id(x-1, y-1)
    when 8; region = $game_map.region_id(x+0, y-1)
    when 9; region = $game_map.region_id(x+1, y-1)
    end
    return true if $game_map.all_restrict_regions.include?(region)
    return false if @through
    return $game_map.vehicle_restrict_regions.include?(region)
  end
  
  #--------------------------------------------------------------------------
  # new method: player_fly_forbid? - Galv superman addon
  #--------------------------------------------------------------------------
  def player_fly_forbid?(x, y, d)
    return false unless self.is_a?(Game_Player)
    return false if debug_through?
    region = 0
    case d
    when 1; region = $game_map.region_id(x-1, y+1)
    when 2; region = $game_map.region_id(x+0, y+1)
    when 3; region = $game_map.region_id(x+1, y+1)
    when 4; region = $game_map.region_id(x-1, y+0)
    when 5; region = $game_map.region_id(x+0, y+0)
    when 6; region = $game_map.region_id(x+1, y+0)
    when 7; region = $game_map.region_id(x-1, y-1)
    when 8; region = $game_map.region_id(x+0, y-1)
    when 9; region = $game_map.region_id(x+1, y-1)
    end
    return true if $game_map.all_restrict_regions.include?(region) unless @in_air
    return true if $game_map.player_fly_regions.include?(region) && @in_air
    return $game_map.player_fly_regions.include?(region)
  end
 
end # Game_CharacterBase

#==============================================================================
#
# ▼ End of File
#
#==============================================================================

 

 

Edited by roninator2
updated code

Share this post


Link to post
Share on other sites

I'll check it out later. I'm away from home at the moment. Back Wednesday

 

had some free time. remoted into my computer Checked it out.

I mixed block all with player block. Checked the code again and I made a change.

Should work now.

@AeghtyAteKees

 

EDIT* another change. Issue with the script causing the player to not move if @through is set to on, even if no region is encountered.

 

Edited by roninator2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×