Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # http://thiagodd.blogspot.com.br
- # [TSDA] Terrain Tags
- # --> Version 1.1
- # by thiago_d_d
- #
- # -----------------------------------------------------------------------------
- # * Features
- # -----------------------------------------------------------------------------
- # This script changes one variable value or executes a code based on the terrain
- # the player steps. This is nearly identical with the RPG Maker XP terrain tags.
- # -----------------------------------------------------------------------------
- # * Install
- # -----------------------------------------------------------------------------
- # Paste the script in the aditional scripts section.
- # -----------------------------------------------------------------------------
- # * Configuration
- # -----------------------------------------------------------------------------
- # Para implementar uma ação que irá acontecer num tile, é necessário
- # Seguir os seguintes passos:
- # ----------------------
- # ===> If the tile is contained in the Tileset - A
- # ----------------------
- # Go to TILES_A_VALUE and add an code in this format
- # [x,y] => k
- # In x place, put the x position of tile tile in the Tileset A.
- # In y place, put the y position of tile tile in the Tileset A
- # In place of k, put an value to atribute to the variable, or put an code to execute.
- #----------------------
- # ===> If the tile is not contained in the Tileset - A
- # ----------------------
- # You have to discover the index. First, put that tile on any map.
- # After that, create an event with that script code:
- # p $game_map.data[x,y,2]
- # Test the game, activate the event, and the tile index will be printed.
- # Use the tile index and go to TILES_OTHER_VALUE, and add an line like this:
- # Found_index => action
- # in place of action, put an value to atribute to the variable,
- # or put an code to execute.
- #
- # If you have any question, see the examples below.
- #===============================================================================
- module TSDA
- #Id of the variable that will be changed
- TILES_VAR_ID = 1
- TILES_A_VALUE =
- {
- [0,0] => 1,
- [0,1] => 2
- }
- TILES_OTHER_VALUE =
- {
- 7 => 1
- }
- end
- class Game_Player
- include TSDA
- def var_change
- @changed = 0
- tile_id = $game_map.data[@x,@y,0]
- tile_id2 = $game_map.data[@x,@y,2]
- x = (tile_id / 128 % 2 * 8 + tile_id % 8)
- y = tile_id % 256 / 8 % 16
- pos = [x,y]
- if !TILES_A_VALUE[pos].nil?
- value = TILES_A_VALUE[pos]
- if value.is_a?(Integer)
- $game_variables[TILES_VAR_ID] = value
- elsif value != nil
- eval(value)
- end
- end
- if !TILES_OTHER_VALUE[tile_id2].nil?
- value = TILES_OTHER_VALUE[tile_id2]
- if value.is_a?(Integer)
- $game_variables[TILES_VAR_ID] = value
- else
- eval(value)
- end
- end
- end
- alias tiles_th_updt update
- def update
- if !@changed.nil? & !moving?
- @changed = nil
- end
- var_change if (moving? and @changed.nil?)
- tiles_th_updt
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement