Simple Sort Skill Inventory
Version: 1.1
Author: cozziekuns
Date: June 26, 2010
Version History
- <Version 1.0> 06.26.2010 - Original Release
- <Version 1.1> 10.17.2010 - Added the virutally infinite commands function, and cleaned up the script.
Planned Future Versions
- None! Please suggest something.
Description
This skill inventory allows you to sort your items in the categories: All, Damage, Healing and Status. You can even make your own categories, if that's how you roll.
Features
- A whole lot more customisable than the original.
- Gives the ability to create your own categories with ease!
- Sort's your skill inventory quickly and cleanly.
- The ability to set regular categories to "prime categories".
- New in 1.1! Virtually infinite categories.
Screenshots Instructions
See header.
Script
#===============================================================================
#
# Cozziekuns Simple Skill Sort Inventory
# Last Date Updated: 6/01/2010
#
# This skill inventory allows you to sort your items in the categories: All,
# Damage, Healing and Status. You can even make your own categories, if that's
# how you roll.
#
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 06/26/10 - Created Script.
# o 10/17/10 - Added the virutally infinite commands function, and cleaned up
# the script.
#===============================================================================
# What's to come?
# -----------------------------------------------------------------------------
# o Nothing! Suggest something.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# Change the modules to your liking. The "hard" parts have instructions of their
# own.
#===============================================================================
$imported = {} if $imported == nil
$imported["CozSimplSortSkillInvent"] = true
module COZZIEKUNS
module SSSI
CATEGORY_TEXT = "Category:"
#===============================================================================
# Extra Skill Categories
# ------------------------------------------------------------------------------
# Each item in the hash represents a certain category. For example, the first
# hash we see here is:
#
# 0 => [21, "All", false],
#
# The syntax of this is:
#
# Category ID => [Icon Number, Text, Prime],
#
# Probably the most important part, the category ID is the number you want to
# put into the notebox that the item contains. For example, if you wanted to
# make the skill "Teleport" into the category 4, you would put:
#
# \skill_category[4]
#
# into the notebox. Note that numbers 0, 1, 2, and 3 are special. They're prime
# categories. Sound special right? Not really, this just means you have to have
# them in the inventory for this script to work. I could've gotten rid of them,
# but that would've just given more work on your part (and mine), so bear with
# them, please. Icon Numbers and Text are pretty self explanatory.
#
# Last, but not least, is the "Prime" function. Setting this to "true" means
# that anything in the prime category will not show up in the item, weapon or
# armour categories. You can set if you want it to show up in all.
#===============================================================================
SKILL_CATEGORIES = {
0 => [21, "All", false],
1 => [132, "Damage", false],
2 => [128, "Healing", false],
3 => [113, "Status", false],
4 => [80, "Special", true],
5 => [90, "Specialer", true],
6 => [100, "Specialest", true],
}
SKILL_CATEGORY_WIDTH = 220 # How wide you want your text window.
ALL_CATEOGRY_PRIME = false # If you want prime key items to show up in the all window.
MAX_NUMBER = (544 - SKILL_CATEGORY_WIDTH) / 54 # The maximum number of icons that will fit.
end
end
#==============================================================================
# ** RPG::Skill
#------------------------------------------------------------------------------
# The superclass of all skills.
#==============================================================================
class RPG::Skill
#--------------------------------------------------------------------------
# * Cozziekuns Category Index
#--------------------------------------------------------------------------
def coz_kyriaki_category_index
@coz_kyriaki_category_index = 0
if self.note[/\\skill_category\[(\d+)]/i] != nil
@coz_kyriaki_category_index = $1.to_i
end
return @coz_kyriaki_category_index
end
end
#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
# This window displays a list of usable skills on the skill screen, etc.
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(sort_index = 0)
@sort_index = sort_index
@data = []
for skill in @actor.skills
next unless include?(skill)
@data.push(skill)
if skill.id == @actor.last_skill_id
self.index = @data.size - 1
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Whether or not to include in skill list
# skill : skill
#--------------------------------------------------------------------------
def include?(skill)
return case @sort_index
when 0
unless COZZIEKUNS::SSSI::ALL_CATEOGRY_PRIME
if COZZIEKUNS::SSSI::SKILL_CATEGORIES[skill.coz_kyriaki_category_index][2]
return false
else
return true
end
else
return true
end
when 1
if COZZIEKUNS::SSSI::SKILL_CATEGORIES[skill.coz_kyriaki_category_index][2]
return false
else
return skill.base_damage > 0
end
when 2
if COZZIEKUNS::SSSI::SKILL_CATEGORIES[skill.coz_kyriaki_category_index][2]
return false
else
return skill.base_damage < 0
end
when 3
if COZZIEKUNS::SSSI::SKILL_CATEGORIES[skill.coz_kyriaki_category_index][2]
return false
elsif skill.plus_state_set.size != 0
return true
else
return skill.minus_state_set.size != 0
end
when 4..999
return skill.coz_kyriaki_category_index == @sort_index
end
end
end
#==============================================================================
# ** Window_SkillCategory
#------------------------------------------------------------------------------
# This window displays what type of skill is being displayed.
#==============================================================================
class Window_SkillCategory < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y, width)
super(x, y, width, WLH + 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(sort_index = 0)
@sort_index = sort_index
@skill_categories = COZZIEKUNS::SSSI::SKILL_CATEGORIES
@skill_categories_width = COZZIEKUNS::SSSI::SKILL_CATEGORY_WIDTH
@category_string = COZZIEKUNS::SSSI::CATEGORY_TEXT
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, @skill_categories_width - 40, WLH, @category_string, 0)
self.contents.font.color = normal_color
for i in 0...@skill_categories.size
if @sort_index == i
self.contents.draw_text(4, 0, @skill_categories_width - 40, WLH, @skill_categories[i][1], 2)
end
end
end
end
#==============================================================================
# ** Window_SkillSort
#------------------------------------------------------------------------------
# This window displays what type of skill is being displayed.
#==============================================================================
class Window_SkillSort < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y, width)
super(x, y, width, WLH + 32)
@ox = 0
if COZZIEKUNS::SSSI::MAX_NUMBER < COZZIEKUNS::SSSI::SKILL_CATEGORIES.size
self.contents = Bitmap.new(self.width - 32 + ((COZZIEKUNS::SSSI::SKILL_CATEGORIES.size - COZZIEKUNS::SSSI::MAX_NUMBER) * 54), self.height - 32)
end
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(sort_index = 0)
@sort_index = sort_index
@item_categories = COZZIEKUNS::SSSI::SKILL_CATEGORIES
@item_categories_width = COZZIEKUNS::SSSI::SKILL_CATEGORY_WIDTH
self.contents.clear
for i in 0...@item_categories.size
@icon_x = 0 + (i * ((544 - @item_categories_width) / @item_categories.size))
if @item_categories.size < COZZIEKUNS::SSSI::MAX_NUMBER
draw_item(i)
else
draw_items(i)
end
if @sort_index == i
if @item_categories.size < COZZIEKUNS::SSSI::MAX_NUMBER
draw_icon(@item_categories[i][0], @icon_x, 0, true)
else
draw_icon(@item_categories[i][0], i * 54, 0, true)
end
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
icons_x = (544 - @item_categories_width) / @item_categories.size
draw_icon(@item_categories[index][0], index * icons_x, 0, false)
end
#--------------------------------------------------------------------------
# * Draw Items
# index : item number
#--------------------------------------------------------------------------
def draw_items(index)
draw_icon(@item_categories[index][0], index * 54, 0, false)
end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs the skill screen processing.
#==============================================================================
class Scene_Skill < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@sort_index = 0
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new
@help_window.viewport = @viewport
@status_window = Window_SkillStatus.new(0, 56, @actor)
@status_window.viewport = @viewport
@skill_window = Window_Skill.new(0, 168, 544, 248, @actor)
@skill_window.viewport = @viewport
@skill_window.help_window = @help_window
@category_width = COZZIEKUNS::SSSI::SKILL_CATEGORY_WIDTH
@category_window = Window_SkillCategory.new(544 - @category_width, 112, @category_width)
@sort_window = Window_SkillSort.new(0, 112, 544 - @category_width)
@target_window = Window_MenuStatus.new(0, 0)
@skill_categories = COZZIEKUNS::SSSI::SKILL_CATEGORIES
hide_target_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
alias coz_kyriaki_sssi_ss_terminate terminate
def terminate
coz_kyriaki_sssi_ss_terminate
@category_window.dispose
@sort_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
if @skill_window.active
update_skill_selection
elsif @target_window.active
update_target_selection
end
end
#--------------------------------------------------------------------------
# * Update Skill Selection
#--------------------------------------------------------------------------
def update_skill_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::A)
@sort_index -= 1
@sort_index %= @skill_categories.size
if @sort_index + 1 == @skill_categories.size
@sort_window.ox += 54 * (@skill_categories.size - COZZIEKUNS::SSSI::MAX_NUMBER)
else
if @skill_categories.size > COZZIEKUNS::SSSI::MAX_NUMBER and @sort_index > COZZIEKUNS::SSSI::MAX_NUMBER - 2
@sort_window.ox -= 54
end
end
@category_window.refresh(@sort_index)
@sort_window.refresh(@sort_index)
@skill_window.refresh(@sort_index)
@skill_window.index = 0
Sound.play_cursor
elsif Input.trigger?(Input::Y)
@sort_index += 1
@sort_index %= @skill_categories.size
if @sort_index != 0
if @skill_categories.size > COZZIEKUNS::SSSI::MAX_NUMBER and @sort_index > COZZIEKUNS::SSSI::MAX_NUMBER - 1
@sort_window.ox += 54
end
else
@sort_window.ox = 0
end
@category_window.refresh(@sort_index)
@sort_window.refresh(@sort_index)
@skill_window.refresh(@sort_index)
@skill_window.index = 0
Sound.play_cursor
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill != nil
@actor.last_skill_id = @skill.id
end
if @actor.skill_can_use?(@skill)
Sound.play_decision
determine_skill
else
Sound.play_buzzer
end
end
end
end
Credit
Thanks
- Kyriaki, for requesting, and giving me some ideas.
Support
Just post down here.
Known Compatibility Issues
Obviously won't work with any custom skill inventory scripts.
Demo
See attached.
Restrictions