Main‎ > ‎

I found a script in my archives =o

posted Oct 9, 2009, 1:42 PM by Zeriab NA   [ updated Oct 9, 2009, 2:42 PM ]
Hey all!
I stumbled upon project which contained a script I made who knows how long ago.
I admit I had completely forgotten about it.

class Game_Character
  attr_accessor :terrain_tag
  alias_method(:zeriab_terrain_tag_passable, :passable?)
  def passable?(x, y, d)
    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    if terrain_tag
      if (terrain_tag > 0 && $game_map.terrain_tag(new_x,new_y) != terrain_tag) ||
         (terrain_tag < 0 && $game_map.terrain_tag(new_x,new_y) == -terrain_tag)
        return false
      end
    end
    return zeriab_terrain_tag_passable(x, y, d)
  end
end
 
class Game_Event < Game_Character
  alias_method(:zeriab_terrain_tag_init, :initialize)
 
  def initialize(map_id, event)
    zeriab_terrain_tag_init(map_id, event)
    if event.name.include?('<t>')
      self.terrain_tag = $game_map.terrain_tag(x, y)
    elsif /<t=(\d+)>/ =~ event.name
      self.terrain_tag = $1.to_i
    elsif /<t=-(\d+)>/ =~ event.name
      self.terrain_tag = -($1.to_i)
    end
  end
end

So who can guess what it does? It's obviously for XP since it does something with terrain tags, but what?
I will update this post with the answer some time later :3

*hugs*
Comments