Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
  • entries
    7
  • comments
    2
  • views
    3,666

What does this script do? :3

Sign in to follow this  
Zeriab

298 views

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.

 

So who can guess what it does? It's obviously for XP since it does something with terrain tags, but what?

I may update this post with the answer some time later :3

 

*hugs*

 

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

Sign in to follow this  


2 Comments


Recommended Comments

I did indeed post this on my site a while ago.

My mistake was that you couldn't really write comments there >_<

 

It's not the best code and the naming could be better. But then it would have been easier to figure out.

 

Your guess is not correct.

There is already a way of getting an event's terrain tag.

No, it does something else. It is related to terrain tags.

Share this comment


Link to comment

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...