#===============================================================================
#
# HERETIC'S HOTFOOT TILES [XP]
# Version 1.0
# Tuesday, October 21st, 2014
#
#===============================================================================
#
# --- Requirements and Installation ---
#
# *** REQUIRES HERETICS MODULAR PASSABLE SCRIPT ***
#
# Place this Script below Heretic's Modular Passable Script and above Main.
#
#
# ----- Overview -----
#
# Makes any Character have a Step Animation about when they stand on a
# tile flagged as a Hotfoot Tile!
#
# This was actually intended for testing but turned in to a fun little
# thing to play with. It might be useful to suggest to Players that
# there is a HIDDEN SECRET, or perhaps standing on LAVA or other
# types of DAMAGE TILES.
#
# ----- Features -----
#
# - Animation Enhancement
# - Uses Simplified Tile IDs
# - Useful for Visually Communicating with the Player something is amiss
# - Can be altered on the fly
# - Allows for Static and Dynamic Hotfoot Tiles
# - Allows for Priority Tiles (ones with Stars) over Hotfoot Tiles
# - Can be either a Terrain Tag or Simplified Tile ID
# - Compatible with Heretic's Caterpillar ver 2.0+
# - Compatible with other Modular Passable scripts I wrote
# - Highly detailed Hotfoot Tile Info with a script call (VERY Useful)
#
#
# ----- Setup -----
#
# Add a \hotfoot Comment to make a Character step while they stand on
# a specific Simplified Tile ID or Terrain Tag!
#
# - \hotfoot : Causes a Character to step while on Hotfoot Tile
# - \hotfoot_tiles[N, N] : Specify what Tiles a Character reacts to
#
# You can also turn Hotfoot ON and OFF with Script Calls. Access to
# the Hotfoot property is unrestricted.
#
# Move Route -> Script: @hotfoot = true / false
# Move Route -> Script: self.hotfoot = true / false
# Script: $game_map.events[12].hotfoot = true / false
# Script: $game_player.hotfoot = true / false
#
# Configure which Tiles are Static Hotfoot Tiles under OPTIONS.
#
# Just add a \hotfoot Comment in the first 10 or so Lines per Event Page
#
# When a Character steps on a Hotfoot Tile, they will Step Quickly!
#
# Enable or Disable Hotfoot with a Script Call
# - $>Set Move Route -> Script: @hotfoot = true / false
# - @>Script: $game_player.hotfoot = true / false
# - @>Script: $game_map.events[43].hotfoot = true / false
#
# Enable Hotfoot with a Script Call for the Player if you just installed
# this Script and Load a Save Game. Once set, Save Games will store
# your assigned value.
#
# @>Script: $game_player.hotfoot = true
#
# Priority Tiles (Tiles that go on Top) still allow for a Hotfoot reaction.
#
# Normally, All Map Layers will be checked for Hotfoot Tiles. You can
# change this during gameplay so any Hotfoot Tiles that are covered by
# another Tile won't cause a Hotfoot reaction. Sometimes this doesn't
# look quite right, sometimes it is expected, so enable and disable
# it with a Script:
#
# @>Script: $game_system.hotfoot_all_layers = true / false
#
#
# ----- Character Specific Hotfoot Tiles -----
#
# You can create Character Specific Hotfoot Tiles with a Comment by adding
# a \hotfoot_tiles[N,N] Comment. This is useful for Character Specific
# conditions, such as an Allergy, Thief detecting Secrets, etc, which
# makes Characters more unique. They should have Hotfoot enabled already.
#
# @>Comment: \hotfoot
# @>Comment: \hotfoot_tiles[simple_id, simple_id]
#
# NOTE: Specifying Hotfoot Tiles will not do anything unless the character
# also has Hotfoot enabled (by comment or script).
#
# You can set ONE or SEVERAL ID's for \hotfoot_tiles[N,N]. It is just a
# list (Array) of Simplified Tile IDs that cause a Hotfoot reaction.
#
# They can be added or removed for either the Player or an Event with a Script.
#
# - $game_player.add_hotfoot_tile(simplified_tile_id)
# - $game_map.events[12].add_hotfoot_tile(simplified_tile_id)
# - Set Move Route -> Script: remove_hotfoot_tile(simplified_tile_id)
#
# NOTE: Add Hotfoot Tile for "$game_map" will apply to ALL Hotfoot Characters
# while "$game_player" and "$game_map.events" will change Hotfoot Tiles
# that are specific to that Character.
#
#
# ----- Adding or Removing Hotfoot Tiles -----
#
# You can Add or Remove a Hotfoot Tile during gameplay! The Options at the
# end of this documentation are intended for Static Hotfoot Tiles, things
# like Lava or Damage Tiles, etc.
#
# NOTE: Static Hotfoot Tile IDs can not be removed during gameplay.
#
# Adding a Hotfoot Tile is useful for SECRETS that, once found, can
# disable the Hotfoot Tile. Although you can not put a Hotfoot Tile into
# an Event, or move a Tile from outside the editor, you can turn on and
# off any effects related to that tile with these script calls!
#
# $game_map.add_hotfoot_tile(simplified_tile_id)
# $game_map.rem_hotfoot_tile(simplified_tile_id)
#
# To get a Simplified Tile ID, use another script: hotfoot_tile_info which
# is explained later in this documentation. It is HIGHLY recommended to use.
#
# NOTE: If you use Hotfoot Tiles for Secrets, you may want to edit your
# Tileset Graphic and give yourself several Hotfoot Tiles to have
# at your disposal. Once a Secret is found, you can remove the
# tile from Hotfoot while leaving others enabled, until their
# related Secrets are also found. It may also be useful to
# make these new Tiles have no Graphic and give them a Priority
# so they do not interfere with any other Passages. The same way
# a Tree Tile does not interfere with a Fence or Rock.
#
#
# --- CONDITIONAL BRANCHES ---
#
# You can run a Script to see if a Character is suffering a Hotfoot reaction
# in a Conditional Branch -> Script window like this:
#
# $game_map.events[12].has_hotfoot?
#
# There are multiple internal checks that are made in that Script call and
# this is the easy way to do it in the Editor.
#
#
# --- VERSION HISTORY ---
#
# Version 1.0 - Tuesday, October 21st, 2014 - Initial Release
#
#
# ----- MODULAR PASSABLE -----
#
# Modular Passable makes adding a Property based on a Comment much easier
# to assign new properties to Events Per Page, and much more efficient.
# It also allows for Comments that are used to configure events to not
# have any requirements to be on the first line of the Event Page, but
# within the first several lines, which allows multiple scripts to add
# multiple properties very efficiently. It is intended for Scripters.
#
# There is a Limit on how many Lines will be checked for Configuration
# Comments. It is set in the Modular Passable Script under COMMENT_LIMIT.
# By default it is set to 10, so the first 10 Lines of each Event Page
# will be checked for Comment configurations. This helps performance
# when your Events have lots of Event Commands, such as Cutscenes. You
# should ONLY increase that number if you have a LOT of scripts that
# add more than 10 properties total. Increasing the number will
# cause the script to check more lines for Comments, which in turn
# will decrease performance. It should be such a minimal decrease
# that it will not be noticable by players at all, unless you just
# go insane and set it into the thousands, then have a bunch of events
# with thousands of Event Commands. I have added about 30 properties
# that can be added with Comments and have not yet found a need to
# have this setting any higher than 10.
#
#
# ----- SIMPLIFIED TILE IDS -----
#
# The real Tile IDs for Tiles are kind of a pain to work with, so I took out
# all the pain with all the gain! Simplified Tile IDs start in the upper
# left hand corner of your Tileset Palette Window and read left to right
# like a Book. Your Eraser Tile will return as Tile ID 0. Autotiles
# will read as Tile ID 1 - 7 from Left to Right. Non Animated Tiles will
# start at 8 and increment from there.
#
# ** Simplified Tileset Map **
#
# 0 1 2 3 4 5 6 7 - Eraser and Autotiles
# 8 9 10 11 12 13 14 15 - Tileset Tiles (Tileset Graphic File)
# 16 17 18 19 20 21 22 23
# etc...
#
#
# ----- HOTFOOT TILE INFO (Highly Useful Script Call) -----
#
# If you have a Large Tileset, don't bother counting to find the Tile ID and
# save yourself some work. It just requires a Script Call to find out what
# Tile IDs an Event is standing on. Create an Event on the Tile you want
# to get the Tile ID for and just run "hotfoot_tile_info". The information
# that pops up will tell you about ALL the Tile Layers, Priorities, Counter,
# Terrain Tags, and Hotfoot Tiles at that Location. This will also tell you
# if you have any Conflicting Terrain Tags, such as Layer 1 has a Terrain
# Tag of 2 and Layer 2 has a Terrain Tag of 6. A location can only have
# one Terrain Tag, so this helps you find Conflicts also.
#
# @>Script: hotfoot_tile_info (Highly Useful!)
#
# NOTE: Simplified Tile IDs are NOT the actual Tile IDs! Don't mix them
# up! The value is adjusted for human simplicity and WILL give you
# the WRONG real Tile ID for Scripting. If you are a Scripter, you
# will want to stay away from the Simple ID to get the real Tile ID
# for your scripts! Or just look at how I converted Tile IDs.
#
# NOTE: Some of the information provided by hotfoot_tile_info may not be
# correct. Warnings of Terrain Tag Conflict may not actually be
# conflicts if you intend to cover one Terrain Tag with another.
# Information is provided, but it doesn't mean you have to get
# rid of all the Warnings. The only one to be concerned with is
# if your Eraser Tile doesnt have a Priority of 5.
#
#
# ----- CONFIGURATION -----
#
# You can use either TERRAIN TAGS or TILE IDS. Both has advantages and
# disadvantages depending on your situation.
#
# If you don't want to use a TERRAIN_TAG, set it to nil. TERRAIN_TAG
# is just the Terrain Tag assigned to a Tile from the Tileset Page
# in the Database.
#
# If you don't use simplified Tile ID's, set both TILESET_IDS and TILES
# to an Empty Array with [].
#
# Tileset IDs can be used on multiple Maps.
#
# NOTE: The total Number of Tileset IDs MUST MATCH the Number of
# HOTFOOT_TILES Arrays you have. If you have 3 Tileset IDs,
# then Tiles will need 3 Arrays, even if empty.
#
#
# NOTE: You can and are encouraged to use Priority Tiles as Hotfoot Tiles.
# All Priority Tiles are IGNORED in order to allow you to place Trees
# and other Priority Decorations on top of Hotfoot tiles, which allows
# for both functionality and decoration of your Map. This is often
# very useful as Passable Priority Tiles do not affect Passages of
# Non Priority Tiles. The way that works is the same as placing
# a fence under a tree. Priority Hotfoot Tiles, when specified by
# a Simplified Tile ID do not cause any Conflicts with Terrain Tags.
#
#
# ----- LIMITATIONS -----
#
# You can NOT use Events to cover up a Hotfoot Tile, or use an Event
# to cause a Hotfoot effect. It is no different than using Events
# to cause Bush effects, it simply doesn't work, and I haven't
# come up with a solution to do it efficiently. Sorry.
#
#
# ----- COMPATABILITY -----
#
# This script is pretty unique and should be highly compatible with other
# scripts. If another script is compatible with Modular Passable, then
# this one should be compatible as well. I can't make any Guarantees on
# scripts that other people write, but the ones I've created, I took a
# lot of extra time to make sure they are all 100% compatible with each
# other.
#
#
# ----- LEGAL -----
#
# You are allowed to use this Script in commercial projects and redistribute
# via other websites, packages, or other meands if distribution as long
# as I am given credit for the creation of this script. You may NOT
# sell this script.
#
#
#
# ----- HOTFOOT OPTIONS -----
# (You can set your Hotfoot Options HERE)
#
# These are intended as STATIC HOTFOOT TILES and can NOT be edited during
# gameplay. Lava, Damage Tiles, etc. These are NOT intended to be used
# as a SECRET indicator. Use $game_map.add_hotfoot_tile(simple_id) for
# any Hotfoot Tiles you wish to use temporarily, such as for Secrets in
# your game. Alternatively, for character specific hotfoot tiles, just
# use $game_player.add_hotfoot_tile(simple_id) or $game_map.events[x]
# to cause a Hotfoot reaction unique to those Characters.
# ----- CHANGE THIS STUFF TO SUIT YOUR NEEDS -----
# Set to nil to Disable or 1 - 7 to match your Database Tileset Terrain Tags.
HOTFOOT_TERRAIN_TAG = nil
# Array of Tileset IDs with Hotfoot Tags (NOTE: Not Maps, Tilesets)
HOTFOOT_TILESET_IDS = [1,4]
# Simplified Tile IDs for Hotfoot Tiles (make an Array for each Tileset ID)
HOTFOOT_TILES = [9,10,11], # Tileset 1 Hotfootd Tile IDs, NOTE the Comma
[9,10,11] # Tileset 4 Hotfootd Tile IDs, note NO COMMA
# Default value for New Games
HOTFOOT_ALL_LAYERS = false
# Caterpillar Dead Effects that should not cause Stepping Animations
DEAD_CAT_ACTOR_EFFECTS = ['DONT_WALK','GHOST']
# ---- DONT EDIT STUFF BELOW HERE -----
# Check for Modular Passable Script - REQUIRED - DO NOT EDIT
unless $Modular_Passable
# Explain Problem
print "Fatal Error: Heretics HOTFOOT Tiles Script\n",
"requires Heretics Modular Passable Script!\n\n",
"Modular Passable is Not Available or is below this script.\n",
"Modular Passable MUST be above this script.\n\n",
"The Game will now Exit"
exit
end
# Check for Configuration Problems
if HOTFOOT_TILESET_IDS.size != HOTFOOT_TILES.size and $DEBUG
# Explain Problem and how to fix it
print "Warning: Configuration ERROR in Heretics HOTFOOT Tiles Script\n\n",
"The Number of Tileset IDs MUST be the same as your Hotfoot Tiles\n",
"on Line 306.\n\n",
"You can have a different number of Hotfoot Tiles for each Tileset\n",
"but for each Tileset ID, you need to have at least ONE Array\n",
"of Hotfoot Tiles, even if that Array is Empty. []\n\n",
"Example:\n",
"HOTFOOT_TILESET_IDS = [1, 2, 3]\n",
"- A total of Three HOTFOOT_TILESET_IDS\n\n",
"HOTFOOT_TILES = [9], [9,10,11], [13, 62]\n",
"- A total of Three HOTFOOT TILES"
end
#==============================================================================
# ** Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables - Game_System
#--------------------------------------------------------------------------
attr_accessor :hotfoot # Hotfoot Tiles Enable / Disable
attr_accessor :hotfoot_all_layers # Search ALL Tile Layers or Top
attr_accessor :hotfoot_tiles # Hotfoot Tiles for current Tileset
attr_accessor :hotfoot_map_id # Used by Game Map
#--------------------------------------------------------------------------
# * Initialize - Game_System
#--------------------------------------------------------------------------
alias hotfoot_system_initialize initialize unless $@
def initialize
# Call Original or other Aliases
hotfoot_system_initialize
# Hotfoot
@hotfoot = true
# Search ALL Map Layers for Hotfoot Tile if true or first Non Priority
@hotfoot_all_layers = HOTFOOT_ALL_LAYERS
@hotfoot_tiles = []
@hotfoot_map_id = nil
end
#--------------------------------------------------------------------------
# * Load Hotfoot Tiles - Game_System
# tileset_id : Map Data of Tileset ID
# - Game_Map does not save additional values without additional scripts
# so use Game_System as it does save the Hotfoot Data
# - Commands related to Hotfoot Tiles are in Game_Map, not Game_System
#--------------------------------------------------------------------------
def load_hotfoot_tiles(tileset_id, map_id)
# If Static Tileset IDs has this Tileset
if HOTFOOT_TILESET_IDS.include?(tileset_id)
# Load Static Hotfoot Tiles (Lava, Damage Tile, but not Temporary)
@hotfoot_tiles = HOTFOOT_TILES[HOTFOOT_TILESET_IDS.index(tileset_id)]
else
# Empty Array for this Map (which can be altered after load)
@hotfoot_tiles = []
end
# Save the Map ID to prevent destroying Added Hotfoot Tiles
@hotfoot_map_id = map_id
end
end
#==============================================================================
# ** Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Setup - Game_Map
# map_id : map ID
#--------------------------------------------------------------------------
alias hotfoot_map_setup setup unless $@
def setup(map_id)
# If Map Change
if not @map or @map_id != map_id
# Set the Temporary Flag
map_change = true
end
# Call Original or other Aliases
hotfoot_map_setup(map_id)
# Prevent destroying any Added Hotfoot Tiles from Savegames
unless $game_system.hotfoot_map_id == map_id
# Load Hotfoot Tiles into Game System if Map Change Temporary Flag
$game_system.load_hotfoot_tiles(tileset_id, map_id) if map_change
end
end
#--------------------------------------------------------------------------
# * Tileset ID - Game_Map
# - Returns Map Data of Tileset ID
#--------------------------------------------------------------------------
def tileset_id
return @map.tileset_id
end
#--------------------------------------------------------------------------
# * Hotfoot Tiles - Game_Map
# - Returns Hotfoot Tiles Array stored in Game_System
# - Save Games do not store Map Data so store in Game_System
#--------------------------------------------------------------------------
def hotfoot_tiles
return $game_system.hotfoot_tiles
end
#--------------------------------------------------------------------------
# * Simplify Tile ID - Game_Map
# tile_id : Tile ID Data
# - Returns 0 as Eraser Tile
# - Returns 1 - 7 for Autotiles
# - Returns Tile IDs that start at 8 for Non Autotile Tileset Data
#--------------------------------------------------------------------------
def simplify_tile_id(tile_id)
# Convert Autotiles to 1 - 7 and subtract 376 so Tile IDs start at 8
return (tile_id < 384 ? tile_id / 48 : tile_id - 376)
end
#--------------------------------------------------------------------------
# * Hotfoot Tile? - Game_Map
# x : x-coordinate
# y : y-coordinate
# - Returns true if a Simplified Hotfoot Tile is found
#--------------------------------------------------------------------------
def hotfoot_tile?(x, y)
if @map_id != 0
# Loop searches in order from top of layer
for i in [2, 1, 0]
# Get tile ID
tile_id = data[x, y, i]
# If Invalid Tile from Data (Off Map, not drawn, etc)
if tile_id == nil
return false
# If the Simplified Tile ID is a Hotfoot Tile
elsif hotfoot_tiles.include?(simplify_tile_id(tile_id))
# Hotfoot Tile Found
return true
# Non Priority Tile and searching All Layers Option is Disabled
elsif not $game_system.hotfoot_all_layers and @priorities[tile_id] == 0
return false
end
end
end
# Default - For Loops cause a Return when loop exited prematurely
return false
end
#--------------------------------------------------------------------------
# * Hotfoot Tile Match? - Game_Map
# x : x-coordinate
# y : y-coordinate
# simple_id : Simplified Tile ID
# - Returns true if simple_id matches any Tile IDs from Layers
#--------------------------------------------------------------------------
def hotfoot_tile_match?(x, y, simple_id)
# If not Title Screen
if @map_id != 0
# Loop searches in order from top of layer
for i in [2, 1, 0]
# Get tile ID
tile_id = data[x, y, i]
# If Invalid Tile from Data (Off Map, not drawn, etc)
if tile_id == nil
# No Tile Match on Nil Tiles
return false
# Elsif Argument Tile ID matches Tile ID of this Layer
elsif simple_id == simplify_tile_id(tile_id)
# Hotfoot Tile Match Found
return true
# Non Priority Tile and searching All Layers Option is Disabled
elsif not $game_system.hotfoot_all_layers and @priorities[tile_id] == 0
return false
end
end
end
# Default - For Loops cause a Return when loop exited prematurely
return false
end
#--------------------------------------------------------------------------
# * Add Hotfoot Tile - Game_Map
# tile_id : Simplified Tile ID for User (see simplified Tile IDs)
# - Adds a Hotfoot Tile ID to the current Map
# - Applies to ALL \hotfoot Characters, not just one
#--------------------------------------------------------------------------
def add_hotfoot_tile(tile_id)
# If the Tile ID is not already in the Hotfoot Tile Array
unless hotfoot_tiles.include?(tile_id) or not tile_id.is_a?(Numeric) or
(not HOTFOOT_TILESET_IDS.index(tileset_id).nil? and
HOTFOOT_TILES[HOTFOOT_TILESET_IDS.index(tileset_id)].include?(tile_id))
# Add the Tile ID to Array of Hotfoot Tiles
hotfoot_tiles.unshift(tile_id)
end
end
#--------------------------------------------------------------------------
# * Remove Hotfoot Tile - Game_Map
# tile_id : Simplified Tile ID for User (see simplified Tile IDs)
# - Remove a Hotfoot Tile ID from the current Map
# - Applies to ALL \hotfoot Characters, not just one
#--------------------------------------------------------------------------
def rem_hotfoot_tile(tile_id)
# Return if Not a Number
return if not tile_id.is_a?(Numeric)
# If the Tile ID to be removed is not a Static Hotfoot Tile
if HOTFOOT_TILESET_IDS.index(tileset_id).nil? or
not HOTFOOT_TILES[HOTFOOT_TILESET_IDS.index(tileset_id)].include?(tile_id)
# Removes Hotfoot Tile ID from the Hotfoot Tile Array
hotfoot_tiles.delete(tile_id)
end
end
#--------------------------------------------------------------------------
# * Hotfoot Tile Info - Game_Map
# x : x-coordinate
# y : y-coordinate
# event : Map Event
# - Development Tool
# - Called by Interpreter Script in a Map Event, not used otherwise
# - Displays Simple Tile ID, Terrain Tag, Bush, Counter and Hotfoot
# settings for All Layers
# - Checks for possible Terrain Tag Conflicts and other useful Data
#--------------------------------------------------------------------------
def hotfoot_tile_info(x, y, event)
# Check for Debug
return unless $DEBUG
# Tile Information
info = []
# Loop searches in order from top of layer
for i in [2, 1, 0]
# Get tile ID
tile_id = data[x, y, i]
# Store Tile Information in Array and check for nil
info[i] = (tile_id) ? tile_id : 0
end
# Message to be displayed
tile_msg = "Tile Information for Event ", event.id,
" at X: ", event.x, " Y: ", event.y,
"\nEvent Hotfoot Enabled: "
tile_msg = tile_msg, (event.hotfoot ? true : false).to_s.upcase
tile_msg = tile_msg, " (\\hotfoot Comment or Script)"
# If Event has Hotfoot Tiles specified
if event.hotfoot_tiles and event.hotfoot_tiles.size > 0
tile_msg = tile_msg, "\nEvent Hotfoot Tiles: ",
event.hotfoot_tiles.inspect
tile_msg = tile_msg, " (\\hotfoot_tiles[N, N] Comment or Script)"
end
# Find any Indeces for Static Hotfoot Tiles
hotfoot_index = HOTFOOT_TILESET_IDS.index(tileset_id)
# If Tileset Specified Static Hotfoot Tiles (Lava)
if hotfoot_index
tile_msg = tile_msg, "\nTileset ", tileset_id, " Static Hotfoot Tiles:",
HOTFOOT_TILES[hotfoot_index].inspect
else
tile_msg = tile_msg, "\nTileset ",tileset_id,": No Static Hotfoot Tiles"
end
# Scan All Layers
tile_msg = tile_msg, "\nGame System - Hotfoot All Layers: ",
($game_system.hotfoot_all_layers ? true : false).to_s.upcase
tile_msg = tile_msg, "\n - (Setting causes hotfoot to be determined "
# If Scan All Layers - Explain it
if $game_system.hotfoot_all_layers
tile_msg = tile_msg, "if ANY tile is a Hotfoot Tile)"
else
tile_msg = tile_msg,"at first Non Priority Tile)"
end
# Text Formatting
tile_msg = tile_msg, "\n\n"
# Terrain Tag Conflict Checker (Default)
tt = false
# Last Non Priority Layer (Placeholder)
lnpl = 0
# Generate Message to be Printed for User
for i in [3, 2, 1]
# Non Priority Tile Found (Placeholder)
np_found = nil
# Recorded Tile in Layer Data
tile_id = info[i - 1]
# Setup Text and Simplified Tile ID
simple_id = simplify_tile_id(tile_id)
auto_msg = (simple_id < 8) ? " (Autotile)" : ""
hotfoot_msg = hotfoot_tiles.include?(simplify_tile_id(tile_id))
# If Tile is a Static Hotfoot Tile
if hotfoot_index and HOTFOOT_TILES[hotfoot_index].include?(tile_id)
# Add Static Text to Hotfoot Message
h = " (Static in HOTFOOT_TILES for Tileset ", tileset_id, ")"
ht = true
# If Hotfoot because of matching Terrain Tag
elsif not HOTFOOT_TERRAIN_TAG.nil? and
HOTFOOT_TERRAIN_TAG == @terrain_tags[tile_id]
# Add Hotfoot Terrain Tag to Hotfoot Message
h = " (Hotfoot Terrain Tag of ", @terrain_tags[tile_id], ")"
ht = true
# Added by User Script
elsif hotfoot_tiles.include?(simple_id)
# Add Hotfoot "Added by User Script" to Hotfoot Message
h = " (Added by \\hotfoot_tiles[",simple_id,"] Comment\n",
"\t\tor Script: ","add_hotfoot_tile(", simple_id, ") )"
ht = true
# Default
else
# No Hotfoot Text
h = ""
ht = false
end
# Add this Text to the Message
tile_msg = tile_msg, "LAYER ", i
# If Tile Exists
if tile_id > 0
# Grab existing Terrain Tags to check for Terrain Tag Conflict
ttc = true if @terrain_tags[tile_id] > 0 and tt
# Store if a Terrain Tag is already set
tt = true if @terrain_tags[tile_id] > 0
# Add the following as Text to the Message
tile_msg = tile_msg, "\n- Simple Tile ID: ", simple_id, auto_msg
tile_msg = tile_msg, "\n- Priority: ", @priorities[tile_id]
tile_msg = tile_msg, "\n- Terrain Tag: ", @terrain_tags[tile_id]
tile_msg = tile_msg, "\n- Bush: ", @passages[tile_id] & 0x40 == 0x40
tile_msg = tile_msg, "\n- Counter: ", @passages[tile_id] & 0x80 == 0x80
tile_msg = tile_msg, "\n- Hotfoot: ", hotfoot_msg, h
# If not Top Layer and Non Priority Tile has sett Passable Flags
if i < 3 and lnpl > i and not $game_system.hotfoot_all_layers and ht
tile_msg = tile_msg, "\nNOTE: Tile on Layer ", lnpl,
" will Override Hotfoot for this Tile"
np_found = true
end
# Text Formatting
tile_msg = tile_msg, "\n\n" if i > 0
# Store Layer a Non Priority Tile is found
lnpl = i if @priorities[tile_id] == 0 and np_found.nil?
else
# Add the following as Text to the Message
tile_msg = tile_msg, "\n- Erased (Tile ID 0 - No Data)\n\n"
end
end
# Add Terrain Tag Conflict Message if Terrain Tag Conflict Detected
if ttc
tile_msg = tile_msg, "NOTICE: Terrain Tag Conflict Detected!\n",
"- Only ONE Terrain Tag can be processed at a time!\n",
"- Terrain Tags on Lower Layers are unable to be used.\n",
"- You can cover Terrain Tags with Non Priority Tiles, just\n",
" not another Terrain Tag Tile, including Priority Tiles.\n",
" (Non Fatal Information)"
else
tile_msg = tile_msg, "No Terrain Tag Conflicts Detected at ",
"Map X:", x, " Map Y:", y
end
# Check for Eraser Tile with an Incorrect Priority (should ALWAYS be 5)
if @priorities[0] != 5
tile_msg = tile_msg,"\n\nWARNING: Eraser Tile has Incorrect Priority!\n",
"- your Eraser Tile (the Tile in the upper left corner of\n",
" Tileset Palette Window) should have a Priority of 5"
end
# Print the Generated Information Message
print tile_msg
# Return No Print Msg
return "Just call hotfoot_tile_info without print."
end
end
#==============================================================================
# ** Interpreter
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Hotfoot Tile Info - Interpreter
# - Script Call intended to be Printed during Development
#--------------------------------------------------------------------------
def hotfoot_tile_info
# If run from Editor
return unless $DEBUG
# Event executing this Script Call
event = $game_map.events[@event_id]
# If Location is Valid for the Map
if not $game_map.valid?(event.x, event.y)
# Generate Message for User about Tile
return "Tile Information for Event ", @event_id,
" at X:", event.x, " Y:", event.y,
"\n\nNo Info Available\n",
"- Location is not on the Current Map"
end
# Print Map Data formatted for Humans
$game_map.hotfoot_tile_info(event.x, event.y, event)
# Return Msg about Printing twice
return "just run \"hotfoot_tile_info\" without print\n",
"(no quotes either)"
end
end
#==============================================================================
# ** Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables - Game_Character
# - hotfoot_tiles returned with method for error checking and works same
#--------------------------------------------------------------------------
attr_accessor :hotfoot # Causes Characters to 'Dance' when on Tile
#--------------------------------------------------------------------------
# * Object Initialization - Game_Character
# - Assigns Hotfoot on Game Start
# - Run a script $game_player.hotfoot = true for Save Games
# - Running the script is necessary when loading a Save Game when Script
# is just installed because the property won't be set.
#--------------------------------------------------------------------------
alias hotfoot_initialize initialize
def initialize
# Add these properties to the Player on Initialize
if self.is_a?(Game_Player)
# Hotfoot when standing on Hotfoot Tiles
@hotfoot = true
@hotfoot_tiles = []
end
# Call Original or other Aliases
hotfoot_initialize
end
#--------------------------------------------------------------------------
# * Hotfoot Update - Game_Character (Main Update Method)
#--------------------------------------------------------------------------
alias hotfoot_update update unless $@
def update
# Update Hotfoot Animations
hotfoot_update_animation
# Call Original or other Aliases
hotfoot_update
end
#--------------------------------------------------------------------------
# * Has Hotfoot? - Game_Character
# - Not used by this Script, intended for calls by Users
# - Useful for Conditional Branches: $game_map.events[12].has_hotfoot?
#--------------------------------------------------------------------------
def has_hotfoot?
# Conditions to check if a Character has a Hotfoot
if hotfoot_update_conditions? and hotfoot? and @step_anime and
not @last_hotfoot_step_anime.nil?
# Character has a Hotfoot
return true
end
# Default
return false
end
#--------------------------------------------------------------------------
# * Hotfoot Update Animation - Game_Character
# - Updates Animations while on a Hotfoot Tile and resets when not
#--------------------------------------------------------------------------
def hotfoot_update_animation
# If Conditions met for Hotfoot
if hotfoot_update_conditions?
# If Standing on a Hotfoot Tile
if hotfoot?
# If Last Step Anime Flag not set
if @last_hotfoot_step_anime.nil? and not @step_anime
# Store Current Value
@last_hotfoot_step_anime = @step_anime
# Set Step Anime to ON temporarily
@step_anime = true
end
# Increase animation count by 1.5 for Walking, Stepping, or Moving
@anime_count += 1.5
# If Hotfoot enabled Step Animation
elsif not @last_hotfoot_step_anime.nil?
# Restore previous Step Anime setting
@step_anime = @last_hotfoot_step_anime
# Clear the Temporary Variable
@last_hotfoot_step_anime = nil
end
end
end
#--------------------------------------------------------------------------
# * Hotfoot Update Conditions? - Game_Character
# - Returns true for Characters with Valid Properties
#--------------------------------------------------------------------------
def hotfoot_update_conditions?
# If Character has a Walk Anime property or Flag set by Hotfoot
if @character_name != "" and (@walk_anime or
not @last_hotfoot_step_anime.nil?)
# Valid Properties Found
return true
end
end
#--------------------------------------------------------------------------
# * Hotfoot Tiles - Game_Character
# - Returns Hotfoot Tiles specific to this Character
# - hotfoot? needs to return true for this to be checked
# - Alias of hotfoot? for other conditions is possible
# - Useful for Unique Character Reactions, such as an Allergy or
# a Magic Sensitive Character, or a Thief discovering Hidden stuff
#--------------------------------------------------------------------------
def hotfoot_tiles
return @hotfoot_tiles ||= []
end
#--------------------------------------------------------------------------
# * Hotfoot Tile? - Game_Character
# - Returns true Character is on a Map Hotfoot Tile
# - Returns true if on a Tile flagged as Hotfoot for this Character only
# - \hotfoot Comment checks Map Hotfoot Tiles
# - \hotfoot_tiles[N,N] Comment specific to this Character
#--------------------------------------------------------------------------
def hotfoot_tile?
# If Character is on a Hotfoot Tile
if $game_map.hotfoot_tile?(@x, @y) or (not HOTFOOT_TERRAIN_TAG.nil? and
$game_map.terrain_tag(@x, @y) == HOTFOOT_TERRAIN_TAG)
# Hotfoot Tile from Map
return true
# Elsif Character has Tiles flagged as Hotfoot specific to this Character
elsif self.hotfoot_tiles.size > 0
# Check Hotfoot Tiles specific to this Character
for simple_id in self.hotfoot_tiles
# Hotfoot Tile if Character specific Tile found in any Map Layer
return true if $game_map.hotfoot_tile_match?(@x, @y, simple_id)
end
end
# Default - For Loops cause a Return when loop exited prematurely
return false
end
#--------------------------------------------------------------------------
# * Hotfoot? - Game_Character
# - Returns true when Hotfoot Character and System Conditions are met
#--------------------------------------------------------------------------
def hotfoot?
# If System Option Enabled, Character has \hotfoot and not Jumping
if $game_system.hotfoot and @hotfoot and @jump_count == 0
# If Character is on a Hotfoot Tile (Map or Character Specific)
return true if hotfoot_tile?
end
end
#--------------------------------------------------------------------------
# * Add Hotfoot Tile - Game_Character
# simple_id : Simplified Tile ID for User (see simplified Tile IDs)
# - Tile ID should already be Simplified
# - Adds a Hotfoot Tile ID to this Character ONLY
# - Applies to THIS Character's \hotfoot_tiles[N] ONLY, not ALL
# - Prevents adding Tiles that are Static in Options or existing
#--------------------------------------------------------------------------
def add_hotfoot_tile(simple_id)
# Static Hotfoot Tile Index
tileset_index = HOTFOOT_TILESET_IDS.index($game_map.tileset_id)
# If the Tile ID is not already in this Character's Hotfoot Tile Array
unless self.hotfoot_tiles.include?(simple_id) or (tileset_index and
HOTFOOT_TILES[tileset_index].include?(simple_id)) or
not simple_id.is_a?(Numeric)
# Add the Tile ID to Array of Character Hotfoot Tiles
self.hotfoot_tiles.unshift(simple_id)
end
end
#--------------------------------------------------------------------------
# * Remove Hotfoot Tile - Game_Character
# simple_id : Simplified Tile ID for User (see simplified Tile IDs)
# - Tile ID should already be Simplified
# - Remove a Hotfoot Tile ID for this Character ONLY
# - Applies to THIS Character's \hotfoot_tiles[N] ONLY, not ALL
#--------------------------------------------------------------------------
def rem_hotfoot_tile(simple_id)
# Return if Not a Number
return if not simple_id.is_a?(Numeric)
# Removes Hotfoot Tile ID from this Character's Hotfoot Tile Array
self.hotfoot_tiles.delete(simple_id)
end
end
#==============================================================================
# ** Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Reset Page Comment Config - Game_Event
# - Resets Instance Variables on Page Change
# - Called when Events are Initialized (Load Save Game included)
#--------------------------------------------------------------------------
alias hotfoot_reset_page_comment_config reset_page_comment_config unless $@
def reset_page_comment_config
# Reset to set again by Comment Conditions
@hotfoot = nil
@hotfoot_tiles = []
@last_hotfoot_step_anime = nil
# Runs Original or Other Aliases of this method
hotfoot_reset_page_comment_config
end
#--------------------------------------------------------------------------
# * Hotfoot Check Comment Page Config - Game_Event
# comment : the Comment to be checked to adjust Page Properties
# count : integer of which List of Event Commands is checked
# - Checks for \hotfoot Comments
# - Checks for \hotfoot_tiles[N,N] Comments specific to this Character
# - Returns count when a Comment is found to prevent checks by other Aliases
#
# Note: When aliasing, please return the value of count, especially
# if your script adjusted this value.
#--------------------------------------------------------------------------
alias hotfoot_check_page_comment_config check_page_comment_config unless $@
def check_page_comment_config(comment, count)
# Looks for "\hotfoot" in the Comments with Regular Expressions
comment.gsub(/^\\hotfoot\z/i){@hotfoot = true; return count}
# Looks for "\hotfoot_tiles[N,N]" in the Comments with Regular Expressions
comment.gsub(/^\\hotfoot_tiles\[([0-9, ]+)\]\z/i){@hotfoot_tiles = $1;
@hotfoot_tiles = @hotfoot_tiles.split(",").map { |s| s.to_i };
return count}
# Return counter for other Aliases when no Comments are found
return hotfoot_check_page_comment_config(comment, count)
end
end
#============================================================================
# *** --- Heretic's Caterpillar Compatability --- ***
#
# Everything below here will be used with Heretic's Caterpillar 2.0 It
# will not work with Heretic's Caterpillar version 1.99.5 and below due
# to the Modular Passable Compatability Requirement.
#
# This section is used ONLY when Dead Actors are set to DONT_WALK.
#============================================================================
if defined?(Game_Caterpillar) and
Game_Character.method_defined?('cat_moves_list_other_passable?')
# Constant if not defined
CAT_DEAD_DONT_WALK = false
# Check if Effects include an Effect to prevent Stepping Anim on Hotfoot Tile
for effect in DEAD_CAT_ACTOR_EFFECTS
if Game_Caterpillar::DEAD_EFFECT.include?(effect)
# Constant
CAT_DEAD_DONT_WALK = true
# Exit Loop prematurely
break
end
end
#==========================================================================
# ** Game_Character
#==========================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Cat Hotfoot Update Conditions? - Game_Character
# - Active Caterpillar Actors are automatically Hotfoot Valid
# when Caterpillar is Active and not Paused
#--------------------------------------------------------------------------
alias cat_hotfoot_update_conditions? hotfoot_update_conditions? unless $@
def hotfoot_update_conditions?
# If Cat Actor (Followers Ignored, no corresponding Battler)
if (self == $game_player or ( (@caterpillar_actor or @cat_follower) and
$game_system.caterpillar.actors.include?(self))) and
$game_system.hotfoot and @character_name != "" and
$game_switches[Game_Caterpillar::CATERPILLAR_ACTIVE_SWITCH] and
not $game_switches[Game_Caterpillar::CATERPILLAR_PAUSE_SWITCH]
# Active Caterpillar Actors and Player are Included in Conditions
return true
end
# Call Original or other Aliases
cat_hotfoot_update_conditions?
end
#--------------------------------------------------------------------------
# * Cat Hotfoot Update Conditions? - Game_Character
# - Active Caterpillar Actors are automatically Hotfoot Valid
# when Caterpillar is Active and not Paused
# - Caterpillar Actors and Followers can still be given
# a \hotfoot Comment for the same behavior when they
# are not a part of the Caterpillar
#--------------------------------------------------------------------------
alias cat_dead_hotfoot? hotfoot? unless $@
def hotfoot?
# If Event is an active Caterpillar Actor and Dead Actor Effects enabled
if (self == $game_player or ((@caterpillar_actor or @cat_follower) and
$game_system.caterpillar.actors.include?(self))) and
$game_switches[Game_Caterpillar::DEAD_ACTOR_EFFECTS] and
$game_system.hotfoot and @jump_count == 0
# Index of corresponding Battler of Cat Actor or Player
ix = (@caterpillar_actor) ? $game_actors[@caterpillar_actor].index : 0
# Cat Followers don't participate in Battle so no Batler, exclude
unless @cat_follower or not CAT_DEAD_DONT_WALK
# Loop through the States of each Character's corresponding Battler
for state_id in $game_party.actors[ix].states
# Battler that corresponds to Cat Actor Dead or Can't Move
return false if $data_states[state_id].restriction == 4
end
end
# If Character is on a Hotfoot Tile (Map or Character Specific)
return true if hotfoot_tile?
end
# Call Original or other Aliases for Non Caterpillar / Player
cat_dead_hotfoot?
end
end
end