Hello,
I added SeM Equipment skill (link at the end of the post) to my project (it makes your hero learn a skill from a weapon). Since it modifies the "Equipment" sub-menu I was wondering if it was compatible with Luna's Engine. Actually the result wasn't so bad :
From this (without the script) :
To this :
It's kinda messy but nothing that seems difficult to fix.
However, it modifies the Skill sub-menu aswell, where we can see how much learning point we got for a specified skill, or even to activate a skill that will grant a passive stat (think about FFIX). For this, it should look like this (without Luna's Engine) :
Though, when I associate it to Luna's Engine, I have this error message :
"Script 'Menu Luna' Line 5354: NoMethodError occured.
Undefinied method 'update' for nil:NilClass"
I have the feeling that it's not that complicated to associate the Luna's Engine with this script, but I have no idea how to do it.
Would you help me ? Thanks a lot XX
P.S. : Here the script :
I added SeM Equipment skill (link at the end of the post) to my project (it makes your hero learn a skill from a weapon). Since it modifies the "Equipment" sub-menu I was wondering if it was compatible with Luna's Engine. Actually the result wasn't so bad :
From this (without the script) :
It's kinda messy but nothing that seems difficult to fix.
However, it modifies the Skill sub-menu aswell, where we can see how much learning point we got for a specified skill, or even to activate a skill that will grant a passive stat (think about FFIX). For this, it should look like this (without Luna's Engine) :
"Script 'Menu Luna' Line 5354: NoMethodError occured.
Undefinied method 'update' for nil:NilClass"
I have the feeling that it's not that complicated to associate the Luna's Engine with this script, but I have no idea how to do it.
Would you help me ? Thanks a lot XX
P.S. : Here the script :
Code:
#=begin #===============================================================================# SeM's Final Fantasy IX Equipment Skills VXA## - v1.1# By SeMcDun# Last Update: 03/02/2013#===============================================================================# Description;# -- Players can equip items which grant them battle skills and passive skills.# -- These skills can be learned permanently if the player earns enough AP in# battle.# -- Passive skills must be activated in the menu before their effects become# active.# -- Passive skills can only be activated if the player has enough unused magic# stones.# -- Skills can be easier or harder to learn for specific actors.# -- Skills can be set so only specific actors may learn them.##===============================================================================# Version History;## v1.0# 2013.01.24 - Completed## v1.1# 2013.01.31 - Bug Fix# AP Window was overlapping the actor window.## ##===============================================================================# Installation;# -- Paste above Main and below Materials.#===============================================================================# Note:# #===============================================================================# Weapon Notetags#-------------------------------------------------------------------------------# <learn_skill x># x - skill to learn# y - amount of ap needed to learn the skill#===============================================================================# Armour Notetags#-------------------------------------------------------------------------------# <learn_skill x># x - skill to learn# y - amount of ap needed to learn the skill#===============================================================================# Skill Notetags#-------------------------------------------------------------------------------# <ap_cost x># x - amount of ap needed to learn the skill## <ap_cost x y># x - amount of ap needed to learn skill# y - actor specific## <lock x># x - only actor x can learn this skill# NOTE: Multiple tags can be used for the same skill for several actors.## <stones x># x - amount of stones needed to activate# NOTE: Can only be used with passive skills.##===============================================================================# Script Calls#------------------------------------------------------------------------------- #===============================================================================$imported = {} if $imported.nil?$imported["SEM-EquipmentSkills"] = true#===============================================================================# ■ SEM::EQUIPMENTSKILLS#===============================================================================module SEM module EQUIPMENTSKILLS # Icon to use for magic stones : Menu purposes STONES_ICON = 188 # Empty Socket : EMPTY_ICON = 184 # Used socket : USED_ICON = 188 # Disabled socket DISABLED_SOCKET = 186 # Usable Skill socket SKILL_ICON = 187 # Default base stones DEFAULT_BASE = 5 # Base Stones BASE_STONES = [] BASE_STONES[1] = 8 BASE_STONES[2] = 5 BASE_STONES[3] = 4 BASE_STONES[4] = 6 # Bonus stone increase BONUS_STONE = 5 # ID of the passive skill id PASSIVE_ID = 3 # How to display when a skill is learned # false : display numbers eg. 15/15 # "String" : display a word eg. "Learned" # integer : display icon with integer as index #LEARNED = false #LEARNED = "Learned" LEARNED = 125 # If LEARNED is an icon, display 3 of them? THREE_ICONS = true #THREE_ICONS = false # The word beside the skill-giving equipment icons EQUIP = "Equip" # Slot icons WEAPON_ICON = 147 ARMOUR_ONE_ICON = 458 ARMOUR_TWO_ICON = 513 ARMOUR_THREE_ICON = 168 ARMOUR_FOUR_ICON = 520 end module REGEXP module WEAPON LEARN_SKILL = /<(?:LEARN_SKILL|learn_skill)[ ](\d+)>/i end module ARMOUR LEARN_SKILL = /<(?:LEARN_SKILL|learn_skill)[ ](\d+)>/i end module ENEMY AP = /<(?:AP|ap)[ ](\d+)>/i end # ENEMY module SKILL AP_COST = /<(?:AP_COST|ap_cost)[ ](\d+)>/i AP_COST_ACTOR = /<(?:AP_COST|ap_cost)[ ](\d+)[ ](\d+)>/i LOCK = /<(?:LOCK|lock)[ ](\d+)>/i STONES = /<(?:STONES|stones)[ ](\d+)>/i end end module VOCAB SKILL_AP = "AP" end end#==============================================================================# ■ DataManager#==============================================================================module DataManager #-------------------------------------------------------------------------- # alias method: load_database #-------------------------------------------------------------------------- class <<self; alias load_database_ses load_database; end def self.load_database load_database_ses load_notetags_ses end #-------------------------------------------------------------------------- # new method: load_notetags_ses #-------------------------------------------------------------------------- def self.load_notetags_ses for weapon in $data_weapons next if weapon.nil? weapon.load_weapon_notetags_ses end for armor in $data_armors next if armor.nil? armor.load_armor_notetags_ses end for enemy in $data_enemies next if enemy.nil? enemy.load_enemy_notetags_ses end for skill in $data_skills next if skill.nil? skill.load_skill_notetags_ses end end end # DataManager#==============================================================================# ■ RPG::Enemy#==============================================================================class RPG::Enemy < RPG::BaseItem # AP which an enemy gives when defeated attr_accessor :ap def load_enemy_notetags_ses @ap = 0 #--- self.note.split(/[\r\n]+/).each { |line| case line #--- when SEM::REGEXP::ENEMY::AP @ap = $1.to_i end } end def ap return @ap end end # RPG::Enemy#==============================================================================# ■ RPG::Weapon#==============================================================================class RPG::Weapon < RPG::EquipItem # Skills which players can learn from this equipment attr_accessor :equip_skills #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- def load_weapon_notetags_ses @equip_skills = [] #--- self.note.split(/[\r\n]+/).each { |line| case line when SEM::REGEXP::WEAPON::LEARN_SKILL skill_id = $1.to_i @equip_skills.push(RPG::Weapon::LearnSkill.new(skill_id)) end } endend#==============================================================================# ■ RPG::Skill#==============================================================================class RPG::Skill < RPG::UsableItem # AP needed to permanently learn the skill attr_accessor :ap_needed # Current AP earned of each character for this skill attr_accessor :ap # Magic Stone cost to activate attr_accessor :stones attr_accessor :stype_id # True or False : Is the passive skill activated? attr_accessor :active # Lock array. Allowed actors are pushed into here attr_accessor :lock #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- def load_skill_notetags_ses @ap = [] # loop through ap and make 0 for i in 0..999 @ap[i] = 0 end @stones = 0 @ap_needed = [] for i in 0..999 @ap_needed[i] = 10000 end @active = [] @lock = [] #--- self.note.split(/[\r\n]+/).each { |line| case line when SEM::REGEXP::SKILL::AP_COST for i in 0..999 if @ap_needed[i] == 10000 @ap_needed[i] = $1.to_i end end when SEM::REGEXP::SKILL::STONES @stones = $1.to_i when SEM::REGEXP::SKILL::AP_COST_ACTOR @ap_needed[$2.to_i] = $1.to_i when SEM::REGEXP::SKILL::LOCK @lock.push($1.to_i) end } endend#==============================================================================# ■ RPG::Armor#==============================================================================class RPG::Armor < RPG::EquipItem # Skills which players can learn from this equipment attr_accessor :equip_skills #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- def load_armor_notetags_ses @equip_skills = [] #--- self.note.split(/[\r\n]+/).each { |line| case line when SEM::REGEXP::ARMOUR::LEARN_SKILL skill_id = $1.to_i @equip_skills.push(RPG::Armor::LearnSkill.new(skill_id)) end } end end#==============================================================================# ■ RPG::Weapon::LearnSkill#============================================================================== class RPG::Weapon::LearnSkill #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_accessor :skill_id #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize(skill_id) @skill_id = skill_id end end # RPG::Weapon::LearnSkill#==============================================================================# ■ RPG::Armor::LearnSkill#============================================================================== class RPG::Armor::LearnSkill #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_accessor :skill_id #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize(skill_id) @skill_id = skill_id end end # RPG::Weapon::LearnSkill#===============================================================================# module BattleManager#===============================================================================module BattleManager def self.process_victory if $imported["YEA-VictoryAftermath"] if $imported["YEA-CommandAutobattle"] SceneManager.scene.close_disable_autobattle_window end return skip_aftermath if Switch.skip_aftermath play_battle_end_me gain_jp if $imported["YEA-JPManager"] display_exp gain_exp # Add the skill AP gain_skill_ap gain_gold gain_drop_items close_windows SceneManager.return replay_bgm_and_bgs battle_end(0) return true else play_battle_end_me replay_bgm_and_bgs $game_message.add(sprintf(Vocab::Victory, $game_party.name)) display_exp gain_gold gain_drop_items # Add the skill AP gain_skill_ap gain_exp SceneManager.return battle_end(0) return true end end def self.gain_skill_ap $game_party.members.each do |member| member.learning_skills.each do |skill| @total_skill_ap = $game_troop.total_skill_ap if $data_skills[skill].ap[member.actor_id] == nil $data_skills[skill].ap[member.actor_id] = 0 end $data_skills[skill].ap[member.actor_id] += @total_skill_ap if $data_skills[skill].ap[member.actor_id] > $data_skills[skill].ap_needed[member.actor_id] $data_skills[skill].ap[member.actor_id] = $data_skills[skill].ap_needed[member.actor_id] end end end #if !$imported["YEA-VictoryAftermath"] # text = "Gained #{@total_skill_ap} #{SEM::VOCAB::SKILL_AP}" # $game_message.add('\.' + text) #end end end#==============================================================================# ** Game_Troop#------------------------------------------------------------------------------# This class handles enemy groups and battle-related data. Also performs# battle events. The instance of this class is referenced by $game_troop.#==============================================================================class Game_Troop < Game_Unit def total_skill_ap @total_skill_ap = 0 $game_troop.members.each do |member| if member.death_state? @total_skill_ap += $data_enemies[member.enemy_id].ap end end return @total_skill_ap end end#==============================================================================# ■ game_battler#==============================================================================class Game_Battler < Game_BattlerBase # Array of all the skills currently equipped attr_reader :learning_skills alias game_battler_init_ses initialize def initialize game_battler_init_ses @learning_skills = [] end end#==============================================================================# ■ Game_Actor#==============================================================================class Game_Actor < Game_Battler # Current number of unused magic stones attr_accessor :magic_stones # Maximum number of magic stones a character may have attr_accessor :max_magic_stones # Actor ID attr_reader :actor_id # Bonus stones for the formula attr_accessor :bonus_stones alias game_actor_init_ses initialize def initialize(actor_id) game_actor_init_ses(actor_id) if SEM::EQUIPMENTSKILLS::BASE_STONES[actor_id] @max_magic_stones = SEM::EQUIPMENTSKILLS::BASE_STONES[actor_id] else @max_magic_stones = SEM::EQUIPMENTSKILLS::DEFAULT_BASE end @magic_stones = @max_magic_stones @bonus_stones = 0 # Add skills from pre-equipped items counter = 0 @equips.each do |equip| if counter == 0 if equip.item_id != 0 if $data_weapons[equip.item_id].equip_skills $data_weapons[equip.item_id].equip_skills.each do |skill| # If font is passive, don't actually add the skill yet. # Add the skill when it is activated in the skill scene if $data_skills[skill.skill_id].lock.count > 0 # There is SOMETHING in the lock if $data_skills[skill.skill_id].lock.include?(actor_id) # If the actor is included in the lock... give the skill @learning_skills.push(skill.skill_id) else # Not included, don't learn the skill end else # Nothing in the lock, open to all @learning_skills.push(skill.skill_id) end if $data_skills[skill.skill_id].stype_id != SEM::EQUIPMENTSKILLS::PASSIVE_ID if $data_skills[skill.skill_id].lock.count > 0 # There is SOMETHING in the lock if $data_skills[skill.skill_id].lock.include?(actor_id) # If the actor is included in the lock... give the skill learn_skill(skill.skill_id) else # Not included, don't learn the skill end else # Nothing in the lock, open to all learn_skill(skill.skill_id) end end end end end end if counter > 0 if equip.item_id != 0 if $data_armors[equip.item_id].equip_skills $data_armors[equip.item_id].equip_skills.each do |skill| # If font is passive, don't actually add the skill yet. # Add the skill when it is activated in the skill scene if $data_skills[skill.skill_id].lock.count > 0 # There is SOMETHING in the lock if $data_skills[skill.skill_id].lock.include?(actor_id) # If the actor is included in the lock... give the skill @learning_skills.push(skill.skill_id) else # Not included, don't learn the skill end else # Nothing in the lock, open to all @learning_skills.push(skill.skill_id) end if $data_skills[skill.skill_id].stype_id != SEM::EQUIPMENTSKILLS::PASSIVE_ID if $data_skills[skill.skill_id].lock.count > 0 # Something in the lock if $data_skills[skill.skill_id].lock.include?(actor_id) # Actor IS included in the lock learn_skill(skill.skill_id) else # Actor not in the lock, don't learn it end else # Nothing locked, open to all learn_skill(skill.skill_id) end end end end end end counter += 1 end end #-------------------------------------------------------------------------- # * Change Equipment # slot_id: Equipment slot ID # item: Weapon/armor (remove equipment if nil) #-------------------------------------------------------------------------- def change_equip(slot_id, item) return unless trade_item_with_party(item, equips[slot_id]) return if item && equip_slots[slot_id] != item.etype_id case slot_id when 0 # weapon if $data_weapons[@equips[slot_id].item_id] if $data_weapons[@equips[slot_id].item_id].equip_skills remove_weapon_skills(slot_id) end end else # armour if $data_armors[@equips[slot_id].item_id] if $data_armors[@equips[slot_id].item_id].equip_skills remove_armour_skills(slot_id) end end end @equips[slot_id].object = item # If new item is equipped, add equipment skills to learning_skills case slot_id when 0 # weapon if item add_weapon_skills(slot_id) end else # armour if item add_armour_skills(slot_id) end end refresh end def add_weapon_skills(slot_id) if $data_weapons[@equips[slot_id].item_id] if $data_weapons[@equips[slot_id].item_id].equip_skills $data_weapons[@equips[slot_id].item_id].equip_skills.each do |skill| if $data_skills[skill.skill_id].lock.count > 0 # Something is IN the lock if $data_skills[skill.skill_id].lock.include?(@actor_id) # Actor IS in the lock, give the skill @learning_skills.push(skill.skill_id) else # Actor is NOT in the lock, don't learn the skill end else # Nothing in the lock, open to all @learning_skills.push(skill.skill_id) end if $data_skills[skill.skill_id].stype_id != SEM::EQUIPMENTSKILLS::PASSIVE_ID if $data_skills[skill.skill_id].lock.count > 0 # Something is IN the lock if $data_skills[skill.skill_id].lock.include?(@actor_id) # Actor IS in the lock, give the skill learn_skill(skill.skill_id) else # Actor is NOT in the lock, don't learn the skill end else # Nothing in the lock, open to all learn_skill(skill.skill_id) end end end end end end def add_armour_skills(slot_id) if $data_armors[@equips[slot_id].item_id] if $data_armors[@equips[slot_id].item_id].equip_skills $data_armors[@equips[slot_id].item_id].equip_skills.each do |skill| if $data_skills[skill.skill_id].lock.count > 0 # Something is IN the lock if $data_skills[skill.skill_id].lock.include?(@actor_id) # Actor IS in the lock, give the skill @learning_skills.push(skill.skill_id) else # Actor is NOT in the lock, don't learn the skill end else # Nothing in the lock, open to all @learning_skills.push(skill.skill_id) end if $data_skills[skill.skill_id].stype_id != SEM::EQUIPMENTSKILLS::PASSIVE_ID if $data_skills[skill.skill_id].lock.count > 0 # Something is IN the lock if $data_skills[skill.skill_id].lock.include?(@actor_id) # Actor IS in the lock, give the skill learn_skill(skill.skill_id) else # Actor is NOT in the lock, don't learn the skill end else # Nothing in the lock, open to all learn_skill(skill.skill_id) end end end end end end def remove_weapon_skills(slot_id) $data_weapons[@equips[slot_id].item_id].equip_skills.each do |skill| @removed = false @counter = 0 # Loop through each learning_skills @learning_skills.each do |learn_skill| if skill.skill_id == learn_skill if @removed == false @learning_skills.delete_at(@counter) @removed = true # Check through learning_skills and see if there is STILL a skill of # skill.skill_id. if there IS, don't remove the skill if !@learning_skills.include?(skill.skill_id) # Check if they have learned the skill if $data_skills[skill.skill_id].ap[self.actor_id] >= $data_skills[skill.skill_id].ap_needed[self.actor_id] # They have more or equal to the ap needed, leave the skill else # They don't have enough AP to master the skill, remove it forget_skill(skill.skill_id) # Return the magic stones if the skill was active if $data_skills[skill.skill_id].active[self.actor_id] == true @magic_stones += $data_skills[skill.skill_id].stones $data_skills[skill.skill_id].active[self.actor_id] = false end end end end end @counter += 1 end end end def remove_armour_skills(slot_id) $data_armors[@equips[slot_id].item_id].equip_skills.each do |skill| @removed = false @counter = 0 # Loop through each learning_skills @learning_skills.each do |learn_skill| if skill.skill_id == learn_skill if @removed == false @learning_skills.delete_at(@counter) @removed = true # Check through learning_skills and see if there is STILL a skill of # skill.skill_id. if there IS, don't remove the skill if !@learning_skills.include?(skill.skill_id) if $data_skills[skill.skill_id].ap[self.actor_id] >= $data_skills[skill.skill_id].ap_needed[self.actor_id] # They have more or equal to the ap needed, leave the skill else # They don't have enough AP to master the skill, remove it forget_skill(skill.skill_id) # Return the magic stones if the skill was active if $data_skills[skill.skill_id].active[self.actor_id] == true @magic_stones += $data_skills[skill.skill_id].stones $data_skills[skill.skill_id].active[self.actor_id] = false end end end end end @counter += 1 end end end # Do the level up thing #-------------------------------------------------------------------------- # * Level Up #-------------------------------------------------------------------------- alias game_actor_level_up_ses level_up def level_up game_actor_level_up_ses @bonus_stones += SEM::EQUIPMENTSKILLS::BONUS_STONE old_max_stones = @max_magic_stones if SEM::EQUIPMENTSKILLS::BASE_STONES[@actor_id] base = SEM::EQUIPMENTSKILLS::BASE_STONES[@actor_id] else base = SEM::EQUIPMENTSKILLS::DEFAULT_BASE end @max_magic_stones = base + ((@level * 4) / 10) + (@bonus_stones / 32) @magic_stones += @max_magic_stones - old_max_stones end end#==============================================================================# ** Scene_Skill#------------------------------------------------------------------------------# This class performs skill screen processing. Skills are handled as items for# the sake of process sharing.#============================================================================== class Scene_Skill < Scene_ItemBase attr_accessor :ap_window #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super create_help_window create_status_window create_command_window create_ap_window create_item_window create_passive_window end #-------------------------------------------------------------------------- # * Create AP Window #-------------------------------------------------------------------------- def create_ap_window wx = @command_window.x wy = @command_window.y ww = @command_window.width wh = @command_window.height @ap_window = Window_AP.new(wx, wy, ww, wh) @ap_window.viewport = @viewport @ap_window.actor = @actor end #-------------------------------------------------------------------------- # * Create Passive Window #-------------------------------------------------------------------------- def create_passive_window wx = 0 wy = @status_window.y + @status_window.height ww = Graphics.width wh = Graphics.height - wy @passive_window = Window_PassiveList.new(wx, wy, ww, wh) @passive_window.actor = @actor @passive_window.viewport = @viewport @passive_window.help_window = @help_window @passive_window.set_handler(:ok, method(:on_passive_ok)) @passive_window.set_handler(:cancel, method(:on_passive_cancel)) end def on_passive_ok if @passive_window.item.active[@actor.actor_id] != true # Activate the skill @actor.magic_stones -= @passive_window.item.stones @passive_window.item.active[@actor.actor_id] = true @actor.learn_skill(@passive_window.item.id) @passive_window.refresh @status_window.refresh @passive_window.activate else @actor.magic_stones += @passive_window.item.stones @passive_window.item.active[@actor.actor_id] = false @actor.forget_skill(@passive_window.item.id) @status_window.refresh @passive_window.refresh @passive_window.activate end end def on_passive_cancel @command_window.activate @passive_window.unselect end alias scene_skill_update_ses update def update # recall alias scene_skill_update_ses # check if "passive" skill type is hovered over if @command_window.command_data[@command_window.index] == SEM::EQUIPMENTSKILLS::PASSIVE_ID @item_window.hide @passive_window.show else @item_window.show @passive_window.hide end # check if "passive" skill type is active if !@command_window.active @ap_window.show @command_window.hide else @command_window.show @ap_window.hide end @ap_window.refresh end #-------------------------------------------------------------------------- # * Change Actors #-------------------------------------------------------------------------- def on_actor_change @command_window.actor = @actor @status_window.actor = @actor @item_window.actor = @actor @passive_window.actor = @actor @ap_window.actor = @actor @passive_window.refresh @command_window.activate end #-------------------------------------------------------------------------- # * [Skill] Command #-------------------------------------------------------------------------- def command_skill if @command_window.command_data[@command_window.index] == SEM::EQUIPMENTSKILLS::PASSIVE_ID # Go to the passive window @passive_window.activate @passive_window.select_last else @item_window.activate @item_window.select_last end end #-------------------------------------------------------------------------- # * Create Status Window #-------------------------------------------------------------------------- def create_status_window y = @help_window.height @status_window = Window_SkillStatus.new(0, y) @status_window.viewport = @viewport @status_window.actor = @actor end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window wy = @help_window.height @command_window = Window_SkillCommand.new(@status_window.width, wy) @command_window.viewport = @viewport @command_window.help_window = @help_window @command_window.actor = @actor @command_window.set_handler(:skill, method(:command_skill)) @command_window.set_handler(:cancel, method(:return_scene)) @command_window.set_handler(:pagedown, method(:next_actor)) @command_window.set_handler(:pageup, method(:prev_actor)) end #-------------------------------------------------------------------------- # * Create Item Window #-------------------------------------------------------------------------- def create_item_window wx = 0 wy = @status_window.y + @status_window.height ww = Graphics.width wh = Graphics.height - wy @item_window = Window_SkillList_two.new(wx, wy, ww, wh) @item_window.actor = @actor @item_window.viewport = @viewport @item_window.help_window = @help_window @item_window.set_handler(:ok, method(:on_item_ok)) @item_window.set_handler(:cancel, method(:on_item_cancel)) @command_window.skill_window = @item_window end end #==============================================================================# ** Window_PassiveList#------------------------------------------------------------------------------# This window is for displaying a list of available skills on the skill window.#============================================================================== class Window_PassiveList < Window_SkillList #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias window_passivelist_ses initialize def initialize(x, y, width, height) window_passivelist_ses(x, y, width, height) self.hide end def refresh make_item_list create_contents draw_all_items end #-------------------------------------------------------------------------- # * Create Skill List #-------------------------------------------------------------------------- def make_item_list @data = [] $data_skills.each do |skill| if skill != nil if skill.stype_id == SEM::EQUIPMENTSKILLS::PASSIVE_ID if skill.ap[@actor.actor_id] >= skill.ap_needed[@actor.actor_id] if [email protected]?(skill) @data.push(skill) end end end end end @actor.learning_skills.each do |skill| if $data_skills[skill].stype_id == SEM::EQUIPMENTSKILLS::PASSIVE_ID # if it is already in the list, don't draw it again if [email protected]?($data_skills[skill]) @data.push($data_skills[skill]) end end end end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index) skill = @data[index] if skill rect = item_rect(index) rect.width -= 4 if skill.active[@actor.actor_id] == true draw_icon(SEM::EQUIPMENTSKILLS::USED_ICON, rect.x + 4, rect.y) else if skill.stones > @actor.magic_stones draw_icon(SEM::EQUIPMENTSKILLS::DISABLED_SOCKET, rect.x + 4, rect.y) else draw_icon(SEM::EQUIPMENTSKILLS::EMPTY_ICON, rect.x + 4, rect.y) end end draw_item_name(skill, rect.x + 32, rect.y, enable?(skill)) draw_skill_cost(rect, skill) end end #-------------------------------------------------------------------------- # * Draw Skill Use Cost #-------------------------------------------------------------------------- def draw_skill_cost(rect, skill) change_color(normal_color, enable?(skill)) draw_text(rect, skill.stones, 2) end #-------------------------------------------------------------------------- # * Display Skill in Active State? #-------------------------------------------------------------------------- def enable?(item) if item if item.active[@actor.actor_id] return true else if item.stones > @actor.magic_stones return false else return true end end end else return false end #-------------------------------------------------------------------------- # * alias Update Help Text #-------------------------------------------------------------------------- alias window_skilllist_update_help_ses update_help def update_help window_skilllist_update_help_ses SceneManager.scene.ap_window.set_item(item) end end#==============================================================================# ** Window_SkillCommand#------------------------------------------------------------------------------# This window is for selecting commands (special attacks, magic, etc.) on the# skill screen.#============================================================================== class Window_SkillCommand < Window_Command attr_accessor :command_data #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list @command_data = [] return unless @actor @actor.added_skill_types.sort.each do |stype_id| name = $data_system.skill_types[stype_id] add_command(name, :skill, true, stype_id) @command_data.push(stype_id) end end end#==============================================================================# ** Game_BaseItem#------------------------------------------------------------------------------# This class uniformly handles skills, items, weapons, and armor. References# to the database object itself are not retained to enable inclusion in save# data.#============================================================================== class Game_BaseItem attr_accessor :item_id end#==============================================================================# ** Window_Base#------------------------------------------------------------------------------# This is a super class of all windows within the game.#============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # * Draw HP #-------------------------------------------------------------------------- def draw_actor_hp(actor, x, y, width = 124) #draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2) contents.font.size -= 2 change_color(system_color) draw_text(x, y, 30, line_height, Vocab::hp_a) draw_current_and_max_values(x, y, width, actor.hp, actor.mhp, hp_color(actor), normal_color) contents.font.size += 2 end #-------------------------------------------------------------------------- # * Draw MP #-------------------------------------------------------------------------- def draw_actor_mp(actor, x, y, width = 124) #draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2) contents.font.size -= 2 change_color(system_color) draw_text(x, y, 30, line_height, Vocab::mp_a) draw_current_and_max_values(x, y, width, actor.mp, actor.mmp, mp_color(actor), normal_color) contents.font.size += 2 end #-------------------------------------------------------------------------- # * Draw Name #-------------------------------------------------------------------------- def draw_actor_name(actor, x, y, width = 112) contents.font.size -= 2 change_color(hp_color(actor)) draw_text(x, y, width, line_height, actor.name) contents.font.size += 2 end #-------------------------------------------------------------------------- # * Draw Level #-------------------------------------------------------------------------- def draw_actor_level(actor, x, y) contents.font.size -= 2 change_color(system_color) draw_text(x, y, 32, line_height, Vocab::level_a) change_color(normal_color) draw_text(x + 32 + 18, y, 24, line_height, actor.level, 2) contents.font.size += 2 end #-------------------------------------------------------------------------- # * Draw Simple Status #-------------------------------------------------------------------------- def draw_actor_simple_status(actor, x, y) draw_actor_name(actor, x, y) draw_actor_level(actor, x, y + line_height * 1) draw_actor_icons(actor, x, y + line_height * 1) # Take out the class to make space for the magic stones #draw_actor_class(actor, x + 90, y) draw_actor_stones(actor, x, y) draw_actor_hp(actor, x, y + line_height * 1 + 17) draw_actor_mp(actor, x, y + line_height * 1 + 34) end #-------------------------------------------------------------------------- # * Draw Actor Crystal #-------------------------------------------------------------------------- def draw_actor_stones(actor, x, y) contents.font.size += 4 draw_icon(SEM::EQUIPMENTSKILLS::STONES_ICON, x + 90 + 60, y + 30) draw_text(x + 90 + 32 + 60, y + 30, 100, 24, "#{actor.magic_stones}/#{actor.max_magic_stones}") contents.font.size -= 4 end #-------------------------------------------------------------------------- # * Draw Item Name # enabled : Enabled flag. When false, draw semi-transparently. #-------------------------------------------------------------------------- def draw_item_name(item, x, y, enabled = true, width = 172) return unless item draw_icon(item.icon_index, x + 4, y, enabled) change_color(normal_color, enabled) draw_text(x + 32, y, width, line_height, item.name) end end#===============================================================================# * Window_AP#===============================================================================class Window_AP < Window_Base def initialize(x, y, ww, wh) super self.hide end #-------------------------------------------------------------------------- # * Set Text #-------------------------------------------------------------------------- def set_text refresh end #-------------------------------------------------------------------------- # * Set Item # item : Skills and items etc. #-------------------------------------------------------------------------- def set_item(item) set_text if item != @item @item = item end end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear contents.font.size -= 6 if @item item_ap = @item.ap[@actor.actor_id] if item_ap == nil item_ap = 0 end ap_rate = @item.ap[@actor.actor_id].to_f / @item.ap_needed[@actor.actor_id] draw_text(4, 0, 128, line_height, "#{SEM::VOCAB::SKILL_AP}:") if item_ap >= @item.ap_needed[@actor.actor_id] draw_gauge(50, 3, 80, ap_rate, hp_gauge_color1, hp_gauge_color1) else draw_gauge(50, 3, 80, ap_rate, mp_gauge_color1, mp_gauge_color2) end if item_ap >= @item.ap_needed[@actor.actor_id] # Display learned if SEM::EQUIPMENTSKILLS::LEARNED == false draw_text(51, 6, 80, line_height, "#{item_ap}/#{@item.ap_needed[@actor.actor_id]}", 1) end if SEM::EQUIPMENTSKILLS::LEARNED.is_a?(Integer) draw_icon( SEM::EQUIPMENTSKILLS::LEARNED, 79, 6) if SEM::EQUIPMENTSKILLS::THREE_ICONS == true draw_icon( SEM::EQUIPMENTSKILLS::LEARNED, 55, 6) draw_icon( SEM::EQUIPMENTSKILLS::LEARNED, 103, 6) end end if SEM::EQUIPMENTSKILLS::LEARNED.is_a?(String) draw_text(51, 6, 80, line_height, "#{SEM::EQUIPMENTSKILLS::LEARNED}", 1) end else draw_text(51, 6, 80, line_height, "#{item_ap}/#{@item.ap_needed[@actor.actor_id]}", 1) end draw_text(4, 24, 128, line_height, "#{SEM::EQUIPMENTSKILLS::EQUIP}:") # Loop through each piece of equipment and see if one of it's equip_skills # is the current skill icon_placer = 0 placer_y = 0 @actor.equips.each do |equips| if equips equips.equip_skills.each do |skill| if @item.id == skill.skill_id # The same one, show the equip icon and + 1 to the placement draw_icon( equips.icon_index, 4 + (icon_placer * 34), 44 + (placer_y * 26)) if icon_placer == 3 icon_placer = 0 placer_y += 1 else icon_placer += 1 end end end end # equips end # equips loop end contents.font.size += 6 end #-------------------------------------------------------------------------- # * Set Actor #-------------------------------------------------------------------------- def actor=(actor) return if @actor == actor @actor = actor refresh end #-------------------------------------------------------------------------- # * Draw Gauge # rate : Rate (full at 1.0) # color1 : Left side gradation # color2 : Right side gradation #-------------------------------------------------------------------------- def draw_gauge(x, y, width, rate, color1, color2) fill_w = (width * rate).to_i gauge_y = y contents.fill_rect(x, gauge_y, width, 12, gauge_back_color) contents.gradient_fill_rect(x, gauge_y, fill_w, 12, color1, color2) end end#===============================================================================# * Window_SkillList#===============================================================================class Window_SkillList_two < Window_SkillList #-------------------------------------------------------------------------- # * alias Update Help Text #-------------------------------------------------------------------------- alias window_skilllist_update_help_ses update_help def update_help window_skilllist_update_help_ses SceneManager.scene.ap_window.set_item(item) end end #==============================================================================# ** Scene_Equip#------------------------------------------------------------------------------# This class performs the equipment screen processing.#============================================================================== class Scene_Equip < Scene_MenuBase attr_accessor :ability_window #---------------------- # * start #---------------------- alias scene_equip_start_ses start def start scene_equip_start_ses create_ability_window end #-------------------------------- # * Create ability window #-------------------------------- def create_ability_window @ability_window = Window_EquipAbility.new(@status_window.width, 72 + @slot_window.height + @command_window.height, @slot_window.width, Graphics.height - (72 + @slot_window.height + @command_window.height)) @ability_window.actor = @actor end #-------------------------------------------------------------------------- # * Change Actors #-------------------------------------------------------------------------- alias scene_equip_on_actor_change_ses on_actor_change def on_actor_change scene_equip_on_actor_change_ses @ability_window.actor = @actor end #-------------------------------------------------------------------------- # * Create Status Window #-------------------------------------------------------------------------- def create_status_window @status_window = Window_EquipStatus.new(0, @help_window.height) @status_window.viewport = @viewport @status_window.actor = @actor end #-------------------------------------------------------------------------- # * Create Item Window #-------------------------------------------------------------------------- def create_item_window wx = @slot_window.x wy = @slot_window.y ww = @slot_window.width wh = @slot_window.height @item_window = Window_EquipItem.new(wx, wy, ww, wh) @item_window.viewport = @viewport @item_window.help_window = @help_window @item_window.status_window = @status_window @item_window.actor = @actor @item_window.set_handler(:ok, method(:on_item_ok)) @item_window.set_handler(:cancel, method(:on_item_cancel)) @slot_window.item_window = @item_window end #-------------------------------------------------------------------------- # * Slot [OK] #-------------------------------------------------------------------------- def on_slot_ok @item_window.show @item_window.activate @item_window.select(0) @slot_window.hide end #-------------------------------------------------------------------------- # * Slot [Cancel] #-------------------------------------------------------------------------- def on_slot_cancel @slot_window.unselect @command_window.activate end #-------------------------------------------------------------------------- # * Item [OK] #-------------------------------------------------------------------------- def on_item_ok Sound.play_equip @actor.change_equip(@slot_window.index, @item_window.item) @slot_window.activate @slot_window.refresh @item_window.unselect @item_window.refresh @slot_window.show @item_window.hide end #-------------------------------------------------------------------------- # * Item [Cancel] #-------------------------------------------------------------------------- def on_item_cancel @slot_window.show @slot_window.activate @item_window.unselect @item_window.hide end alias scene_equip_update_ses update def update scene_equip_update_ses if @slot_window.active @ability_window.set_item(@actor.equips[@slot_window.index], @slot_window.index) end if @command_window.active @ability_window.set_item(nil, nil) end end end#==============================================================================# ** Window_EquipStatus#------------------------------------------------------------------------------# This window displays actor parameter changes on the equipment screen.#============================================================================== class Window_EquipStatus < Window_Base #-------------------------------------------------------------------------- # * Get Number of Lines to Show #-------------------------------------------------------------------------- def visible_line_number return 12 end #-------------------------------------------------------------------------- # * Get Window Height #-------------------------------------------------------------------------- def window_height Graphics.height - fitting_height(2) end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 260 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear if @actor draw_actor_face(@actor, 4, 4, enabled = true) draw_actor_simple_status(@actor, 108, 20) end 6.times {|i| draw_item(0, line_height * (1 + i) + 130, 2 + i) } end #-------------------------------------------------------------------------- # * Draw Simple Status #-------------------------------------------------------------------------- def draw_actor_simple_status(actor, x, y) draw_actor_name(actor, x, y) draw_actor_level(actor, x, y + line_height * 1) draw_actor_icons(actor, x, y + line_height * 1) draw_actor_hp(actor, x, y + line_height * 1 + 17) draw_actor_mp(actor, x, y + line_height * 1 + 34) end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(x, y, param_id) draw_param_name(x + 4, y, param_id) draw_current_param(x + 144, y, param_id) if @actor draw_right_arrow(x + 176, y) if @temp_actor draw_new_param(x + 200, y, param_id) if @temp_actor end #-------------------------------------------------------------------------- # * Draw Parameter Name #-------------------------------------------------------------------------- def draw_param_name(x, y, param_id) change_color(system_color) draw_text(x, y, 130, line_height, Vocab::param(param_id)) end end#==============================================================================# ** Window_EquipItem#------------------------------------------------------------------------------# This window displays choices when opting to change equipment on the# equipment screen.#============================================================================== class Window_EquipItem < Window_ItemList alias window_equipitem_init_ses initialize def initialize(wx, wy, ww, wh) window_equipitem_init_ses(wx, wy, ww, wh) self.hide end def col_max return 1 end #-------------------------------------------------------------------------- # * Update Help Text #-------------------------------------------------------------------------- def update_help super if @actor && @status_window temp_actor = Marshal.load(Marshal.dump(@actor)) temp_actor.force_change_equip(@slot_id, item) @status_window.set_temp_actor(temp_actor) end #if SceneManager.scene.command_window.active # SceneManager.scene.ability_window.clear #else SceneManager.scene.ability_window.set_item(item, @slot_id) #end end end#===============================================================================# * Window_EquipAbility#===============================================================================class Window_EquipAbility < Window_Base def initialize(wx, wy, ww, wh) super end #-------------------------------------------------------------------------- # * Set Text #-------------------------------------------------------------------------- def set_text refresh end #-------------------------------------------------------------------------- # * Clear #-------------------------------------------------------------------------- def clear set_item(nil, nil) end #-------------------------------------------------------------------------- # * Set Item # item : Skills and items etc. #-------------------------------------------------------------------------- def set_item(item, slot) if item != @item @item = item end if slot != @slot @slot = slot end refresh end def refresh self.contents.clear case @slot when 0 draw_icon(SEM::EQUIPMENTSKILLS::WEAPON_ICON, 4, 0) when 1 draw_icon(SEM::EQUIPMENTSKILLS::ARMOUR_ONE_ICON, 4, 0) when 2 draw_icon(SEM::EQUIPMENTSKILLS::ARMOUR_TWO_ICON, 4, 0) when 3 draw_icon(SEM::EQUIPMENTSKILLS::ARMOUR_THREE_ICON, 4, 0) when 4 draw_icon(SEM::EQUIPMENTSKILLS::ARMOUR_FOUR_ICON, 4, 0) end if @slot != nil draw_text(4 + 32, 0, 8, 24, ":") end draw_horz_line(line_height * 1 - 4) if @item # Draw the top, icon and name draw_icon(@item.icon_index, 48, 0) draw_text(76,0,200,24, @item.name) @skill_placer = 1 # Draw the skills you can learn from the item @item.equip_skills.each do |skill| # Icon first : Used/Empty or Ability skill = $data_skills[skill.skill_id] if skill.stype_id == SEM::EQUIPMENTSKILLS::PASSIVE_ID # Draw used or unused socket if skill.active[@actor.actor_id] == true draw_icon(SEM::EQUIPMENTSKILLS::USED_ICON, 4, (29 * @skill_placer) + 12) else draw_icon(SEM::EQUIPMENTSKILLS::EMPTY_ICON, 4, (29 * @skill_placer) + 12) end else draw_icon(SEM::EQUIPMENTSKILLS::SKILL_ICON, 4, (29 * @skill_placer) + 12) end if skill.lock.count > 0 # Something is in the lock if skill.lock.include?(@actor.actor_id) # Actor is IN the lock, use white draw_text(32,(29 * @skill_placer) + 12,150,24, skill.name) else # Not in the lock, use grey change_color(normal_color, false) draw_text(32,(29 * @skill_placer) + 12,150,24, skill.name) change_color(normal_color, true) end else # Open to all draw_text(32,(29 * @skill_placer) + 12,150,24, skill.name) end skill_ap = skill.ap[@actor.actor_id] if skill_ap == nil skill_ap = 0 end if skill.lock.count > 0 # Something is in the lock if skill.lock.include?(@actor.actor_id) # Actor is IN the lock, show the skill gauge ap_rate = skill.ap[@actor.actor_id].to_f / skill.ap_needed[@actor.actor_id] if skill_ap >= skill.ap_needed[@actor.actor_id] draw_gauge(170, (29 * @skill_placer) + 16, 80, ap_rate, hp_gauge_color1, hp_gauge_color1) else draw_gauge(170, (29 * @skill_placer) + 16, 80, ap_rate, mp_gauge_color1, mp_gauge_color2) end else # Actor is NOT in the skill lock. Show no gauge. end else ap_rate = skill.ap[@actor.actor_id].to_f / skill.ap_needed[@actor.actor_id] if skill_ap >= skill.ap_needed[@actor.actor_id] draw_gauge(170, (29 * @skill_placer) + 16, 80, ap_rate, hp_gauge_color1, hp_gauge_color1) else draw_gauge(170, (29 * @skill_placer) + 16, 80, ap_rate, mp_gauge_color1, mp_gauge_color2) end end contents.font.size -= 6 if skill.lock.count > 0 # Something in the lock if skill.lock.include?(@actor.actor_id) # Allow the rest to continue if skill_ap >= skill.ap_needed[@actor.actor_id] # Display learned if SEM::EQUIPMENTSKILLS::LEARNED == false draw_text(172, (29 * @skill_placer) + 19, 80, line_height, "#{skill_ap}/#{skill.ap_needed[@actor.actor_id]}", 1) end if SEM::EQUIPMENTSKILLS::LEARNED.is_a?(Integer) draw_icon( SEM::EQUIPMENTSKILLS::LEARNED, 199, (29 * @skill_placer) + 19) if SEM::EQUIPMENTSKILLS::THREE_ICONS == true draw_icon( SEM::EQUIPMENTSKILLS::LEARNED, 175, (29 * @skill_placer) + 19) draw_icon( SEM::EQUIPMENTSKILLS::LEARNED, 223, (29 * @skill_placer) + 19) end end if SEM::EQUIPMENTSKILLS::LEARNED.is_a?(String) draw_text(172, (29 * @skill_placer) + 19, 80, line_height, "#{SEM::EQUIPMENTSKILLS::LEARNED}", 1) end else draw_text(172, (29 * @skill_placer) + 19, 80, line_height, "#{skill_ap}/#{skill.ap_needed[@actor.actor_id]}", 1) end else # Show Nuhin... end else # Nothing in the lock, wooo if skill_ap >= skill.ap_needed[@actor.actor_id] # Display learned if SEM::EQUIPMENTSKILLS::LEARNED == false draw_text(172, (29 * @skill_placer) + 19, 80, line_height, "#{skill_ap}/#{skill.ap_needed[@actor.actor_id]}", 1) end if SEM::EQUIPMENTSKILLS::LEARNED.is_a?(Integer) draw_icon( SEM::EQUIPMENTSKILLS::LEARNED, 199, (29 * @skill_placer) + 19) if SEM::EQUIPMENTSKILLS::THREE_ICONS == true draw_icon( SEM::EQUIPMENTSKILLS::LEARNED, 175, (29 * @skill_placer) + 19) draw_icon( SEM::EQUIPMENTSKILLS::LEARNED, 223, (29 * @skill_placer) + 19) end end if SEM::EQUIPMENTSKILLS::LEARNED.is_a?(String) draw_text(172, (29 * @skill_placer) + 19, 80, line_height, "#{SEM::EQUIPMENTSKILLS::LEARNED}", 1) end else draw_text(172, (29 * @skill_placer) + 19, 80, line_height, "#{skill_ap}/#{skill.ap_needed[@actor.actor_id]}", 1) end end contents.font.size += 6 @skill_placer += 1 end end end #-------------------------------------------------------------------------- # * Draw Gauge # rate : Rate (full at 1.0) # color1 : Left side gradation # color2 : Right side gradation #-------------------------------------------------------------------------- def draw_gauge(x, y, width, rate, color1, color2) fill_w = (width * rate).to_i gauge_y = y contents.fill_rect(x, gauge_y, width, 12, gauge_back_color) contents.gradient_fill_rect(x, gauge_y, fill_w, 12, color1, color2) end #-------------------------------------------------------------------------- # * Set Actor #-------------------------------------------------------------------------- def actor=(actor) return if @actor == actor @actor = actor refresh end #-------------------------------------------------------------------------- # * Draw Horizontal Line #-------------------------------------------------------------------------- def draw_horz_line(y) line_y = y + line_height / 2 - 1 contents.fill_rect(0, line_y, contents_width, 2, line_color) end #-------------------------------------------------------------------------- # * Get Color of Horizontal Line #-------------------------------------------------------------------------- def line_color color = normal_color color.alpha = 48 color end end#==============================================================================# ** Window_EquipSlot#------------------------------------------------------------------------------# This window displays items the actor is currently equipped with on the# equipment screen.#============================================================================== class Window_EquipSlot < Window_Selectable #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index) return unless @actor rect = item_rect_for_text(index) change_color(system_color, enable?(index)) case index when 0 draw_icon(SEM::EQUIPMENTSKILLS::WEAPON_ICON, rect.x + 2, rect.y) when 1 draw_icon(SEM::EQUIPMENTSKILLS::ARMOUR_ONE_ICON, rect.x + 2, rect.y) when 2 draw_icon(SEM::EQUIPMENTSKILLS::ARMOUR_TWO_ICON, rect.x + 2, rect.y) when 3 draw_icon(SEM::EQUIPMENTSKILLS::ARMOUR_THREE_ICON, rect.x + 2, rect.y) when 4 draw_icon(SEM::EQUIPMENTSKILLS::ARMOUR_FOUR_ICON, rect.x + 2, rect.y) end draw_text(rect.x + 32, rect.y, 8, 24, ":") draw_item_name(@actor.equips[index], rect.x + 44, rect.y, enable?(index)) end end#==============================================================================# ** Window_ActorCommand#------------------------------------------------------------------------------# This window is for selecting an actor's action on the battle screen.#============================================================================== class Window_ActorCommand < Window_Command #-------------------------------------------------------------------------- # * Add Skill Command to List #-------------------------------------------------------------------------- def add_skill_commands @actor.added_skill_types.sort.each do |stype_id| if $imported["SEM-EquipmentSkills"] if stype_id != SEM::EQUIPMENTSKILLS::PASSIVE_ID name = $data_system.skill_types[stype_id] add_command(name, :skill, true, stype_id) end end end end end #=end