Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # Unlimited Terrain Tags Script by Nathmatt
- # Version: 1.00
- # Type: Add On
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- #
- # This work is protected by the following license:
- # #----------------------------------------------------------------------------
- # #
- # # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
- # # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
- # #
- # # You are free:
- # #
- # # to Share - to copy, distribute and transmit the work
- # # to Remix - to adapt the work
- # #
- # # Under the following conditions:
- # #
- # # Attribution. You must attribute the work in the manner specified by the
- # # author or licensor (but not in any way that suggests that they endorse you
- # # or your use of the work).
- # #
- # # Noncommercial. You may not use this work for commercial purposes.
- # #
- # # Share alike. If you alter, transform, or build upon this work, you may
- # # distribute the resulting work only under the same or similar license to
- # # this one.
- # #
- # # - For any reuse or distribution, you must make clear to others the license
- # # terms of this work. The best way to do this is with a link to this web
- # # page.
- # #
- # # - Any of the above conditions can be waived if you get permission from the
- # # copyright holder.
- # #
- # # - Nothing in this license impairs or restricts the author's moral rights.
- # #
- # #----------------------------------------------------------------------------
- #
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # Instrutions:
- # Scroll down to the config and add terrain_tags by adding these to the config
- # module (Unlimited_Terrain_Tags.add_terrains(tileset_id,x,y,terrain_tag))
- #
- # tileset_id - is the tilsets id
- # x,y - is the location on the tile set
- # terrain_tag - is the terrain_tag for that tile
- #
- # To get the x and y think of the tilset as the map and the x and y are each block
- # dont count the auto tiles.
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- module Unlimited_Terrain_Tags
- # dont touch any of this
- $terrains = []
- class Terrains
- attr_reader :tileset_id,:tile_id,:terrain_tag
- def initialize(tileset_id,tile_id,terrain_tag)
- @tileset_id,@tile_id,@terrain_tag = tileset_id,tile_id,terrain_tag
- end
- end
- def self.get_tile_id(x,y)
- return((y*8)+x)+384
- end
- def self.add_terrains(tileset_id,x,y,terrain_tag)
- $terrains.push(Terrains.new(tileset_id,self.get_tile_id(x,y),terrain_tag))
- end
- #============================================================================
- # MCES::Config
- #----------------------------------------------------------------------------
- # The configuration for Unlimited Terrain Tags
- #============================================================================
- module Config
- # add terrain tags here
- #Unlimited_Terrain_Tags.add_terrains(tileset_id,x,y,terrain_tag)
- end
- def self.get_terrain_tag(tileset_id,tile_id)
- $terrains.each {|terrain|
- if [tileset_id,tile_id] == [terrain.tileset_id,terrain.tile_id]
- return terrain.terrain_tag
- end}
- return 0
- end
- end
- class Game_Map
- def terrain_tag(x, y)
- if @map_id != 0
- [2, 1, 0].each{|i|
- tile_id = data[x, y, i]
- if tile_id == nil
- return 0
- else
- t = Unlimited_Terrain_Tags.get_terrain_tag(@map.tileset_id,tile_id)
- return t if t > 0
- return @terrain_tags[tile_id] if @terrain_tags[tile_id] > 0
- end}
- end
- return 0
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement