RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

More terrain tags

Started by gerkrt, September 09, 2011, 08:35:05 AM

0 Members and 1 Guest are viewing this topic.

gerkrt

This script lets you have more terrains for each map making that each map or
tileset use a unique palette of terrain tags. 
It also add support for using codes and not numbers for scripters.

Code (text) Select
#=============================================================================
# More terrain tags
# By gerkrt/gerrtunk
# Version: 1
# Date: 09/09/2011
# IMPORTANT NOTE: to acces the more actualitzed or corrected version of this
# script check here: http://usuarios.multimania.es/kisap/english_list.html
# License: GPL, credits
#==============================================================================
=begin

------INTRODUCTION------

This script lets you have more terrains for each map making that each map or
tileset use a unique palette of terrain tags. 
It also add support for using codes and not numbers for scripters.

------MAP OR TILESET MODE------

This script can work in two ways: based on maps or in tilesets. If there
are a palette for all maps using a tileset and for that tileset, or if
exist a palette for each map.

The sense of the config number => changues with the mode you are using.

To use the tileset mode active this line:
Terrain_tileset_mode = true

You have to add new lines for each map or tileset
  Maps_indexs = {
    4 => [99,1,2,3,4,5,6,7],
    2 => [8,9,10,11,12,13,14,15],
    9 => [8,9,10,11,12,13,14,15]
  }

id de terr/map => [terr1, terr2, terr...]

Note that if you dont put a map or tileset here, it will use default ones(0-7)

------CODES------

You can use :codes for improving visual use of the tags. For this you need
set default codes, descoment the line and comnt the other set to false.

=end

module Wep
  Maps_indexs = {
    4 => [99,1,2,3,4,5,6,7],
    2 => [8,9,10,11,12,13,14,15]
  }
 
  #Default_codes = [:op, :wep, :nor, :ir, :lar, :set, :rat, :iku]
  Terrain_tileset_mode = false
  Default_codes = false
end


class Game_Map

  #--------------------------------------------------------------------------
  # * Get Terrain Tag
  #     x          : x-coordinate
  #     y          : y-coordinate
  #--------------------------------------------------------------------------
  def terrain_tag(x, y)

    if @map_id != 0
      for i in [2, 1, 0]
        tile_id = data[x, y, i]
        if tile_id == nil
          return 0
        else
          # If by terrain
          if Wep::Terrain_tileset_mode
            if Wep::Maps_indexs[@map.tileset_id] != nil
              return Wep::Maps_indexs[@map.tileset_id][@terrain_tags[tile_id]]
            else
              if Wep::Default_codes
                return Wep::Default_codes[@terrain_tags[tile_id]]
              else
                return @terrain_tags[tile_id]
              end
            end
           
          # By map
          else
            if Wep::Maps_indexs[@map_id] != nil
              return Wep::Maps_indexs[@map_id][@terrain_tags[tile_id]]
            else
              if Wep::Default_codes
                return Wep::Default_codes[@terrain_tags[tile_id]]
              else
                return @terrain_tags[tile_id]
              end
            end
          end 
        end
      end
    end

  end
 
 
end