HOW TO MAKE REGIONS PASSABLE/IMPASSABLE VIA SWITCHES, IS THERE A SCRIPT FOR THIS? RMVX ACE

Posts

Pages: 1
I'm making a VX Ace version of Final Fantasy VII and I'm trying to restrict the areas that the chocobos can go to. I can achieve this through switches and events, but I was wondering if there was a script out there which could check the following conditions.

  • SWITCH ON: Chocobo Mount
  • SWITCH ON: River Chocobo
  • Therefore allow region X etc, to be passable (For River Chocobo, shallow water)

I'm just concerned of the massive slowdown there might be when there's hundreds of these events all over the world map determining whether passage is permitted or not.
Marrend
Guardian of the Description Thread
21781
Regions, or maybe Terrain Tags, might be exactly what you're looking for.

Terrain Tags are defined on a per-tileset basis, while regions are defined on a per-map basis. Either one can be obtained via the Get Location Info Event-Command, and passed into a variable.

As I recall, Okiku, Star Apprentice had a modified script...
class Game_CharacterBase
  #--------------------------------------------------------------------------
  # * Determine if Passable
  #     d : Direction (2,4,6,8)
  #--------------------------------------------------------------------------
  def passable?(x, y, d)
    x2 = $game_map.round_x_with_direction(x, d)
    y2 = $game_map.round_y_with_direction(y, d)
    return false unless $game_map.valid?(x2, y2)
    return true if terrain_tag(x, y, d)
    return true if @through || debug_through?
    return false unless map_passable?(x, y, d)
    return false unless map_passable?(x2, y2, reverse_dir(d))
    return false if collide_with_characters?(x2, y2)
    return true
  end

  # Set tiles with a terrain tag not equal to 0 passable by an event with a
  # predefined ID.
  def terrain_tag(x, y, d)
    # First, we define which event ID we want to find.
    event_id = 1
    # We check against the parameters of the function to see if the specified
    # event is the one we're looking at.
    x2 = $game_map.events[event_id].x
    y2 = $game_map.events[event_id].y
    if x == x2 && y == y2
      # If the terrain tag is not 0, the bullet can move through it.
      if $game_map.terrain_tag(x, y) != 0
        return true
        # But wait. If the NEXT tile's terrain tag is not 0, the bullet should
        # still be able to move!
      else
        x2 = $game_map.round_x_with_direction(x, d)
        y2 = $game_map.round_y_with_direction(y, d)
        if $game_map.terrain_tag(x2, y2) != 0
          return true
        end
        # Should all that fail, treat the tile normally.
        return false
      end
    end    
  end
end
...to allow the bullet produced by the Wand of Blasting to move over water. Maybe this could be used for a base-line for what you're looking to do?
Thanks for the help Marrend, I didn't know about the "Get Location Info" command. I made it work through a couple of parallel events.
OzzyTheOne
Future Ruler of Gam Mak
4696
Oh shoot, this looks like quite the useful little bit of code! I'm glad you asked this question MoonWolfV and I'm glad Marrend gave you such a good response as well! :D
Pages: 1