Terrain Tag Common Event Triggering
Version: 1.2
Author: albertfish
Date: December 13, 2009 (of most recent version)
Version History
- Version 1.2: December 13, 2009
- Changed over to Scene_Map to eliminate any problems with the spriteset being drawn when the player can't move - Version 1.1: December 13, 2009
- Added new control features
- Ability to repeat the common event call if needed
- Ability to set a pause between repeated event calls - Version 1.0: December 12, 2009
- Initial release
Description
This script triggers the common event equal to the terrain tag you are currently on. This script only calls the common event once until you move to another tile, unless you enter the repeat command.
Features- Call common events by terrain id number
- Customize how to call the events
ScreenshotsThis is a non-visual script, it is however a functional one. No screenshots can represent the features of this script.
InstructionsUsage instructions are contained within the initial comments of the script. To install, simply place above main.
Script
#==============================================================================
# ** Terrain Tag Common Event Triggering
#------------------------------------------------------------------------------
# * Created by: albertfish
# * Version: 1.2
# * Last edited: December 13, 2009
#------------------------------------------------------------------------------
# Version History:
# Version 1.2: December 13, 2009
# - Changed over to Scene_Map to eliminate any problems with the spriteset
# being drawn when the player can't move
# Version 1.1: December 13, 2009
# - Added new control features
# - Ability to repeat the common event call if needed
# - Ability to set a pause between repeated event calls
# Version 1.0: December 12, 2009
# - Initial release
#------------------------------------------------------------------------------
# Description:
# This script triggers the common event equal to the terrain tag you are
# currently on. This script only calls the common event once until you
# move to another tile, unless you enter the repeat command.
#------------------------------------------------------------------------------
# Usage Instructions:
# This script will call all common events from 1 to @final_tag. You may
# edit this value to it's max ammount (7).
# To set the common event to repeat, place a comment in the common event
# and type repeat. To set a pause for repeated event calls, type a comment
# as follows:
# wait #
# This will tell the script to wait for # of frames before repeating. For
# example, wait 40 should repeat the script 1 time per second. This
# depends on the refresh rate, which is by default 40.
#------------------------------------------------------------------------------
# Install Instructions:
# Place this script above the main script and below the default scripts.
#==============================================================================
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
alias af_ttcet_sm_main main
def main
@final_tag = 7
@repeat = false
@wait = 0
@prev_x = $game_player.x
@prev_y = $game_player.y
af_ttcet_sm_main
end
alias af_ttcet_sm_update update
def update
af_ttcet_sm_update
x = $game_player.x
y = $game_player.y
tag = $game_map.terrain_tag(x, y)
@repeat = false
if $data_common_events[tag] != nil
if tag > 0 && tag <= [7, @final_tag].min
list = $data_common_events[tag].list
for i in 0...list.size
if (list[i].code == 108 || list[i].code == 408) &&
list[i].parameters[0] == "repeat"
@repeat = true
elsif (list[i].code == 108 || list[i].code == 408) &&
list[i].parameters[0][0, 4] == "wait" && @wait == -1
@wait = list[i].parameters[0][5, list[i].parameters[0].size - 5].to_i
end
end
if @wait == 0 && (@repeat || x != @prev_x || y != @prev_y)
$game_temp.common_event_id = tag
@wait = -1
elsif @wait > 0
@wait -= 1
end
end
end
if x != @prev_x || y != @prev_y
@wait = 0
end
@prev_x = x
@prev_y = y
end
end
Credit
Thanks- gameface101 for the request.
Support
If you discover any bugs with this script, please send me a PM describing the problem and when it happens.
Known Compatibility IssuesMay be incompatible with scripts that terrain tags for specific functions.
Demo
No available demo.
Author's Notes
Enjoy, there are many uses for this script! Hopefully people have some creative uses for it.
RestrictionsYou may use this in your game commercial or non-commercial as long as proper credit is given.