Geomancy [VXA]
Version: 1.0a
Author: modern algebra
Date: April 28, 2012
Version History
- <Version 1.0a> 2012.04.28 - Fixed an error with Battle Test
- <Version 1.0> 2011.12.01- Original Release
Description
This script allows you to set it so that specified skills can only be used on particular types of terrain.
Features
- Allows you to prevent actors from using certain skills depending on the terrain they are at. This allows you to, for instance, only allow the use of air spells while above ground, or only allow earth spells when not in the water, etc...
- Very easy to configure
Instructions
To install this script in the demo, see
this tutorial. If you wish, you can download a copy of the
Scripts.rvdata2 with this script included and test it out.
For instructions on setting the terrains on which skills can be used, see the header of the script.
Script
#==============================================================================
# Geomancy [VXA]
# Version: 1.0a
# Author: modern algebra (rmrk.net)
# Date: April 28, 2012
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# This script allows you to set it so that certain skills can only be used
# on particular types of terrain.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# To set it so that a skill can only be used on particular terrain tags,
# simply put the following code in the notebox of the skill:
#
# \Terrains[x, y, ..., z]
#
# where x, y, ..., z are the terrain tags you want to enable it for. If you
# don't set this code at all, then the skill can be used on any non-excluded
# terrains.
#
# You can also do it backwards - if you want the skill to be usable on all
# terrains EXCEPT specified terrains, then you use the following code:
#
# \!Terrains[x, y, ..., z]
#
# where x, y, ..., z are this time the tags you DON'T want to be able to use
# the skill on.
#==============================================================================
#==============================================================================
# ** RPG::Skill
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - valid_terrain?
#==============================================================================
class RPG::Skill
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Valid Terrain?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def valid_terrain?(terrain_tag)
if !@valid_terrains
@valid_terrains, @invalid_terrains = [], []
self.note.scan (/\\(!?)TERRAINS\[(.+?)\]/i) { |match|
match[1].scan (/\d+/) { |tag|
if match[0].empty?
@valid_terrains.push (tag.to_i)
else
@invalid_terrains.push (tag.to_i)
end
}
}
end
return false if @invalid_terrains.include?(terrain_tag)
return true if @valid_terrains.empty? || @valid_terrains.include?(terrain_tag)
false
end
end
#==============================================================================
# ** Game_BattlerBase
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - skill_conditions_met?
#==============================================================================
class Game_BattlerBase
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Skill Available?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mal_vxageo_sklconds_6gc1 skill_conditions_met?
def skill_conditions_met?(skill, *args, &block)
return false if (!$BTEST && !skill.nil? && !skill.valid_terrain?($game_player.terrain_tag))
mal_vxageo_sklconds_6gc1(skill, *args, &block) # Run Original Method
end
end
Credit
Thanks
Support
Please post in this topic at RMRK for support.