Introduction
As soon as an actor gains a fifth skill (if set), it will promptly take you to Scene_Max where you can delete one of your skills The actual Scene_Max was spawned out of the Scene_Skill code and now for what was updated Create an element named undeletable give skills you want to be unable to delete with this element checked remember the id change the part in this script to the element id you created now Undeletable Skills will appear in red
Script
Maximum Skill Limits
Code:
#=============================================================================
# * Maximum Skill Limits
#=============================================================================
# Trickster
# Version 1.1
# 10.3.05
#=============================================================================
# Introduction
# - This script allows you to limit the number of skills each actor may have
# rather than allowing them to have an enormous number of skills available
# to them. Each time a skill is acquired, they must choose one to remove.
# Setting up the system
# - There are three configurables:
# 1) SKILL_SIZE This sets how many skills they can have at any one time.
# 2) SKILL_UNDELETABLE The element to tag unremovable skills.
# 3) SKILL_DELETE_TEXT Text to let the player know they filled their quota.
# To Use
# - It's automatic. Once you reach the limit, the screen pops up.
#
#=============================================================================
# Configurables
SKILL_SIZE = 4
SKILL_UNDELETABLE = 17
SKILL_DELETE_TEXT = " has too many skills select one to delete"
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Learn Skill
# skill_id : skill ID
#--------------------------------------------------------------------------
def learn_skill(skill_id)
if skill_id > 0 and not skill_learn?(skill_id)
@skills.push(skill_id)
@skills.sort!
if @skills.size > SKILL_SIZE
$scene = Scene_Max.new
if $game_temp.in_battle
$game_temp.in_battle = false
end
end
end
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Get Undelete Text Color
#--------------------------------------------------------------------------
def undelete_color
return Color.new(175, 0, 5, 255)
end
end
#==============================================================================
# ** Window_SkillDelete
#------------------------------------------------------------------------------
# This window displays removeable skills on the skill screen.
#==============================================================================
class Window_SkillDelete < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 128, 640, 352)
@actor = actor
@column_max = 2
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Acquiring Skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
self.contents.font.color = normal_color
if skill.element_set.include?(SKILL_UNDELETABLE)
self.contents.font.color = undelete_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text( @actor.name + SKILL_DELETE_TEXT)
end
end
#==============================================================================
# ** Scene_Max
#------------------------------------------------------------------------------
# This class performs skill-limit screen processing.
#==============================================================================
class Scene_Max
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# Make help window, status window, and skill delete window
@help_window = Window_Help.new
@status_window = Window_SkillStatus.new(@actor)
@skill_window = Window_SkillDelete.new(@actor)
# Associate help window
@skill_window.help_window = @help_window
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@status_window.dispose
@skill_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@help_window.update
@status_window.update
@skill_window.update
# If skill window is active: call update_skill
if @skill_window.active
update_skill
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if skill window is active)
#--------------------------------------------------------------------------
def update_skill
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the skill window
@skill = @skill_window.skill
# Prevent removal if denied
unless @skill.element_set.include?(SKILL_UNDELETABLE)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Delete skill
@actor.skills.delete(@skill.id)
# Switch to map screen
$scene = Scene_Map.new
return
else
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
end
end
end
end
Note
Be warned because using this in the wrong way could leave the player unable to delete a skill and thus trapped and unable to continue playing (The script doesn't check if all of the skills are undeletable)
Limitations of this script:
If a character gains a level to where two skills are learned and the player already has 4 skills only one will be deleted this will give them 5 skills
Doesn't check to see if all of the skills are undeletable
FAQ Note:Permission granted by Trickster to post:
Quote:And if you post what you have now of my stuff then you don't have the latest versions. I'm too lazy/busy to post stuff.
As this is his material, it is deletable upon his request. Due to his current absense, no support is available. Please do not PM or eMail him for support.
Terms and Conditions
Hey, I posted this publicly. You can use it. What do you expect? But if you do use it, I do expect you to spell my name correctly in your game. And yes you can use it in commercial games too.