canepalace
Member
What it does
It avoids clutter on the battle skill select screen.
It causes all skills learned by the character to become unequipped. To use them in battle they must first be equipped. This is easy. Just go to the Skills screen and select whatever skills you want to be used in battle. They will change color from gray to white. Selected skills will now be enabled. This was meant to avoid the clutter of having to cursor over Fire 1, Fire 2, Fire 3 in order to get to Fire 4. Late in RPG's players tend to use the same skills and neglect earlier ones. This is useful for keeping it simple.
I am pretty sure we can find more uses for it.
The code is based on code from Momomo's Ability AP learning system used in XP. Just copy/paste it into a new script above main.
Future Add-ons
It avoids clutter on the battle skill select screen.
It causes all skills learned by the character to become unequipped. To use them in battle they must first be equipped. This is easy. Just go to the Skills screen and select whatever skills you want to be used in battle. They will change color from gray to white. Selected skills will now be enabled. This was meant to avoid the clutter of having to cursor over Fire 1, Fire 2, Fire 3 in order to get to Fire 4. Late in RPG's players tend to use the same skills and neglect earlier ones. This is useful for keeping it simple.
I am pretty sure we can find more uses for it.
The code is based on code from Momomo's Ability AP learning system used in XP. Just copy/paste it into a new script above main.
Code:
# Equip/Unequip Skill System
# created/posted by canepalace, based on a similar system coded by Momomo
# just insert over main and it works
# when new skills are learned they must be equipped before they can be used in battle
# this will avoid the clutter of having to skip over Fire 1, when you've learned Fire 3, etc.
# it is also useful for more things that this
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# actor_id
#--------------------------------------------------------------------------
alias ability_system_initialize initialize
def initialize(actor_id)
@ability = {}
@ability_skill = []
ability_system_initialize(actor_id)
end
def ability_equip_ok?(skill_id)
return true
end
def add_ability(skill_id)
unless @ability_skill.include?(skill_id)
@ability_skill.push(skill_id)
end
end
def del_ability(skill_id)
@ability_skill.delete(skill_id)
end
def ability_initialize(skill_id)
@ability[skill_id] = 0
end
def equip_ability(skill_id)
@ability[skill_id] = 1
add_ability(skill_id)
end
def remove_ability(skill_id)
@ability[skill_id] = 0
del_ability(skill_id)
end
def ability_equip?(skill_id)
unless @ability.include?(skill_id)
ability_initialize(skill_id)
end
return false if @ability[skill_id] == 0
return true
end
def ability_fix?(skill_id)
return false
end
def og_skills
return @skills
end
def skills
return @ability_skill
end
#--------------------------------------------------------------------------
# skill_id
#--------------------------------------------------------------------------
alias ability_system_learn_skill learn_skill
def learn_skill(skill_id)
ability_system_learn_skill(skill_id)
if @skills.include?(skill_id) and @ability != nil
unless @ability.include?(skill_id)
ability_initialize(skill_id)
add_ability(skill_id)
end
end
end
#--------------------------------------------------------------------------
# skill_id
#--------------------------------------------------------------------------
alias ability_system_forget_skill forget_skill
def forget_skill(skill_id)
ability_system_forget_skill(skill_id)
remove_ability(skill_id)
end
#--------------------------------------------------------------------------
# skill_id
#--------------------------------------------------------------------------
alias ability_system_skill_learn? skill_learn?
def skill_learn?(skill_id)
if ability_system_skill_learn?(skill_id) or @ability_skill.include?(skill_id)
return true
else
return false
end
end
end
#==============================================================================
# ** Window_Selectable
#------------------------------------------------------------------------------
# This window contains cursor movement and scroll functions.
#==============================================================================
class Window_Selectable < Window_Base
#--------------------------------------------------------------------------
# * Create Window Contents
#--------------------------------------------------------------------------
def create_contents
self.contents = Bitmap.new(width - 32, [height - 32, row_max * WLH].max)
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
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.og_skills.size
skill = $data_skills[@actor.og_skills[i]]
if $game_temp.in_battle and !@actor.ability_equip?(skill)
#Do not even add skill to list in battle if not equipped
else
@data.push(skill)
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = @actor.ability_equip?(skill)
draw_item_name(skill, rect.x, rect.y, enabled)
self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
end
end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs the skill screen processing.
#==============================================================================
class Scene_Skill < Scene_Base
#--------------------------------------------------------------------------
# * Update Skill Selection
#--------------------------------------------------------------------------
def update_skill_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
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
Sound.play_buzzer
return
end
if @actor.ability_equip?(@skill)
@actor.remove_ability(@skill)
Sound.play_equip
else
@actor.equip_ability(@skill)
Sound.play_equip
end
@skill_window.refresh
@status_window.refresh
return
else
end
end
end
Future Add-ons
- maximum amount of skills equippable
- skill information window