Jump to content
Sign in to follow this  
Wizered99

Updated skill mixing system

Recommended Posts

This is my first post, so I apologize for any informality I may have when posting this.

Woratana created a script which allows you to have an script call in an event that opens up a window allowing you to mix skills you currently possess on a character to create another skill within a Christmas Giftbox Demo. He created this with several other scripts in RPG Maker VX. The Christmas Giftbox he created for VX can be found at this URL: http://www.rpgmakervx.net/index.php?showtopic=7797
I am requesting and would greatly appreciate it if someone could possibly translate or update the mix skills system script to ace. The script basically checked to see if a specific character had Skill index 1 and skill index 2, then if you mixed them, it would delete skill index 1 and index 2, and add skill index 3. If it is impossible to translate for some unknown reason then I'd also like to request that somebody perhaps attempt to create a script like this. I have searched the master script list ( http://rmvxace.wikia.com/wiki/RPG_Maker_VX_Ace_Master_Script_List ) for a script like this but I never found anything that works precisely the way Woratana's script worked. The inspiration for this script is from Kingdom Hearts: Birth by Sleep where you can mix skills to form new ones permanently.

To simplify viewing the script by Woratana, I will post the Mix Skill System here that I downloaded some time ago.

 


 

#===============================================================
# â— [VX] â—¦ Mix Skill System â—¦ â–¡
#--------------------------------------------------------------
# â—¦ by Woratana [woratana@hotmail.com]
# â—¦ Thaiware RPG Maker Community
# â—¦ Released on: 25/05/2008
# â—¦ Version: 1.1
#--------------------------------------------------------------
# â—¦ Features:
# - Mix 2 or more skills to get new skill(s)
# - Choose actor(s) that can/cannot use each recipe
# - Choose to just add new skill(s), or remove skills you used for mix too.
# - Easy to edit text in Mix Spell System windows
#--------------------------------------------------------------
# â—¦ How to use:
# - Call Scene_MixSkill by call script:
#  $scene = Scene_Mixskill.new
#=================================================================

  #=============================================================
  # ** Constants Initialization (DO NOT EDIT THIS PART!) **
  #-------------------------------------------------------------
class Skill_Recipe
  attr_accessor :result, :skills, :user, :nonuser, :replace
end
class Scene_Mixskill < Scene_Base
  RECIPE = []
  #=============================================================
  
  #=============================================================
  # ** [SETUP] SCENE MIXSPELL WINDOWS & TEXTS
  #-------------------------------------------------------------
  ACTOR_LIST_WIDTH = 172 # Width of Actors list Window
  
  TOP_WINDOW_TEXT = '- Mix Skill System -' # Text show on Top window when start
  TOP_WINDOW_TEXT_WITH_ACTOR = '- Mix Skill System -: {name}'
  # Text show after chose actor, use {name} for actor's name
  
  BOTTOM_WINDOW_TEXT_ACTOR = 'Choose actor you want to mix skill'
  # Text show when player has to choose actor to mix skills
  
  MIX_BUTTON = 'Start Mix Skills!' # Mix button
  MIX_BETWEEN = '---------------------------'
  # Text between recipe's result and chosen skills
  
  EXIT_BUTTON = '- Exit -' # Exit button in Actors list window
  
  SE_FOUND_RECIPE = 'Chime1'
  # Sound Effect to play when found recipe for chosen skills
  SE_FOUND_RECIPE_VOLUME = 80 # Sound Effect volume
  
  SE_MIXED = 'Chime2'
  # Sound Effect to play when mixed skils
  SE_MIXED_VOLUME = 80
  #=============================================================
=begin
  #=============================================================
  # ** [SETUP] SKILL MIX RECIPE
  #-------------------------------------------------------------
  # .: RECIPE TEMPLATE :.
  #-------------------------------------------------
  data = Skill_Recipe.new
  data.skills = [skill ID, skill ID, ...]
  data.result = [skill ID, skill ID, ...]
  data.replace = true (or) false
  data.user = [Actor ID, Actor ID, ...]
  data.nonuser = [Actor ID, Actor ID, ...]
  RECIPE << data
  #-------------------------------------------------
  # * data = Skill_Recipe.new: create new blank recipe.
  
  # * data.skills: Skills that you have to mix to get data.result (line below)
  # You must have data.skills at least 2 skills (or recipe will not work).
  
  # * data.result: Skills that you will get when you mixed data.skills (line above)
  # You can have data.result 1 skill or more.
  
  # * data.user: Actors that can use this recipe, put 0 as Actor ID for ALL ACTORS.
  
  # * data.nonuser: Actors that cannot use this recipe.
  # You don't have to use data.nonuser if you didn't put 0 (usable for All actors)
  # in data.user. -- Put [] if you don't use this.
  
  # ** TIP: When system check to see if Actor can use each recipe,
  # It will check if Actor's ID is not included in data.nonuser first.
  # Next, it will check if Actor's ID include in data.user (or) recipe's data.user
  # is included 0 (usable for All actors).
  #
  # So, you can create recipe that will work with all actors, except for actors 2 and 4
  # by set data.user and data.nonuser like this:
  # data.user = [0]
  # data.nonuser = [2, 3]
  
  # * data.replace = true (or) false: If you want to remove skills in data.skills
  when you mixed this recipe, put 'true'. If not, put 'false'.
    
  # * RECIPE << data: Add new recipe to database.
  #-------------------------------------------------------------
=end
  #=============================================================
  data = Skill_Recipe.new
  data.skills = [1,2]
  data.result = [3]
  data.user = [0]
  data.nonuser = [0]
  data.replace = true
  RECIPE << data
  
  
  #=============================================================
  
  def start
    super
    create_menu_background
    @help1 = Window_Help.new
    @help2 = Window_Help.new
    @help2.y = Graphics.height - @help2.height
    
    @sk = Window_MS_Skill.new(0, @help1.height, Graphics.width/2,
Graphics.height - (@help1.height*2))
    @sk.help_window = @help2
    @sk_chosen = Window_MS_SkillList.new(@sk.width, @sk.y + @help1.height,
@sk.width, @sk.height - @help1.height)
    
    @act_list = Window_MS_ActorList.new(ACTOR_LIST_WIDTH)
    @act_list.x = (Graphics.width - @act_list.width) / 2
    @act_list.y = (Graphics.height - @act_list.height) / 2
  
    @winmix = Window_Command.new(@sk.width, [MIX_BUTTON])
    @winmix.x = @sk.width
    @winmix.y = @help1.height
    
    runstep(0)
  end
  
  def update
    super
    if @act_list.active
      @act_list.update
      if Input.trigger?(Input::C)
        @act_list.visible = @act_list.active = false
        case @act_list.define[@act_list.index]
        when 'exit'
          Sound.play_cancel
          $scene = Scene_Map.new
        else
          runstep(1)
        end
      elsif Input.trigger?(Input::
        Sound.play_cancel
        $scene = Scene_Map.new
      end
    elsif @sk.active
      @sk.update
      if Input.trigger?(Input::C)
        if @sk_chosen.skills.include?(@sk.skill)
          Sound.play_cancel
          return
        end
        Sound.play_decision
        @sk_chosen.skills << @sk.skill
        refresh_chosen_data
      elsif Input.trigger?(Input::
        runstep(4)
      elsif Input.trigger?(Input::RIGHT)
        runstep(2)
      end
    elsif @winmix.active
      @winmix.update
      if Input.trigger?(Input::C)
        runstep(5)
      elsif Input.trigger?(Input::LEFT)
        runstep(3)
      elsif Input.trigger?(Input::
        runstep(4)
      end
    end
  end
  
  def terminate
    super
    @act_list.dispose
    @sk_chosen.dispose
    @sk.dispose
    @help1.dispose
    @help2.dispose
    dispose_menu_background
  end
  
  def refresh_chosen_data
    @sk.chosen = @sk_chosen.skills
    @sk_chosen.skills.uniq!
    @sk.chosen.uniq!
    data_mixable = spell_mixable(@sk_chosen.skills)
    @sk_chosen.result = data_mixable[0]
    @sk_chosen.result -= @sk.actor.skills
    @sk_chosen.replace = data_mixable[1]
    RPG::SE.new(SE_FOUND_RECIPE, SE_FOUND_RECIPE_VOLUME).play if !@sk_chosen.result.empty?
    @winmix.draw_item(0, !@sk_chosen.result.empty?)
    @sk_chosen.refresh
    @sk.refresh
  end
  
  def spell_mixable(chosen)
    skills = []
    chosen.each {|i| skills << i.id if i.is_a?(RPG::Skill) }
    RECIPE.each_index do |r|
      next if RECIPE[r].nil? or RECIPE[r].skills.size < 2 or
  RECIPE[r].skills.size != skills.size or RECIPE[r].skills.sort != skills.sort
      next if RECIPE[r].nonuser.include?(@sk.actor.id)
      if RECIPE[r].user.include?(@sk.actor.id) or RECIPE[r].user.include?(0)
        result = RECIPE[r].result
        result_skills = []
        result.each {|i| result_skills << $data_skills[i] unless $data_skills[i].nil? }
        return [result_skills, RECIPE[r].replace]
      end
    end
    return [[], true]
  end
  
  def runstep(id)
    case id
    when 0
      @sk.visible = @sk.active = false
      @sk_chosen.visible = @sk_chosen.active = false
      @act_list.active = @act_list.visible = true
      @winmix.visible = @winmix.active = false
      @help1.set_text(TOP_WINDOW_TEXT, 1)
      @help2.set_text(BOTTOM_WINDOW_TEXT_ACTOR, 1)
    when 1
      Sound.play_decision
      @act_list.active = @act_list.visible = false
      @sk.visible = @sk.active = true
      @sk_chosen.visible = true
      @sk_chosen.active = false
      @winmix.visible = true
      @winmix.active = false
      @winmix.index = -1
      @sk.set_actor(@act_list.define[@act_list.index])
      @help1.set_text(TOP_WINDOW_TEXT_WITH_ACTOR.gsub(/\{name\}/i){@sk.actor.name}, 1)
      @sk_chosen.clear
      @winmix.draw_item(0, !@sk_chosen.result.empty?)
    when 2
      if @sk_chosen.result.empty?
        Sound.play_cancel
      else
        Sound.play_decision
        @winmix.index = 0
        @winmix.active = true
        @sk.active = false
        @sk_lastindex = @sk.index
        @sk.index = -1
      end
    when 3
      Sound.play_decision
      @winmix.index = -1
      @winmix.active = false
      @sk.active = true
      @sk.index = @sk_lastindex
    when 4
      if @sk_chosen.skills.empty?
        Sound.play_decision
        runstep(0)
      else
        Sound.play_cancel
        @sk_chosen.skills.pop
        refresh_chosen_data
      end
    when 5
      if @sk_chosen.result.empty?
        Sound.play_cancel
      else
        RPG::SE.new(SE_MIXED,SE_MIXED_VOLUME).play
        actor = @sk.actor
        ingrad = @sk_chosen.skills
        result = @sk_chosen.result
        ingrad.each {|i| actor.forget_skill(i.id) } if @sk_chosen.replace
        result.each {|i| actor.learn_skill(i.id) }
        runstep(1)
      end
    end
  end
end

#==============================================================================
# ** Window_MS_Skill
#==============================================================================
class Window_MS_Skill < Window_Selectable
  attr_accessor :chosen, :actor
  def initialize(x, y, width, height)
    super(x, y, width, height)
    @column_max = 1
    @chosen = []
    @data = []
    self.index = 0
  end

  def skill
    return @data[self.index]
  end

  def refresh
    @data = []
    for skill in @actor.skills
      @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
  
  def set_actor(actor)
    @actor = actor
    @chosen = []
    self.index = 0
    refresh
  end

  def draw_item(index)
    skill = @data[index]
    return if @chosen.include?(skill)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    if skill != nil
      rect.width -= 4
      draw_item_name(skill, rect.x, rect.y)
    end
  end

  def update_help
    @help_window.set_text(skill == nil ? '' : skill.description)
  end
end

#==============================================================================
# ** Window_MS_SkillList
#==============================================================================
class Window_MS_SkillList < Window_Selectable
  attr_accessor :result, :skills, :replace
  def initialize(x, y, width, height)
    super(x, y, width, height)
    clear
  end

  def refresh
    self.contents.clear
    @data = @result + [Scene_Mixskill::MIX_BETWEEN] + @skills
    @item_max = @data.size
    for i in 0...@item_max
      draw_item(i)
    end
  end

  def draw_item(index, enabled = true)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    rect.width -= 4
    if skill.is_a?(RPG::Skill)
      draw_icon(skill.icon_index, rect.x, rect.y, enabled)
      self.contents.font.color = @result.include?(skill) ? system_color : normal_color
      self.contents.draw_text(rect.x + 24, rect.y, rect.width-24, WLH, skill.name)
    else
      self.contents.font.color = normal_color
      self.contents.draw_text(rect.x, rect.y, rect.width, rect.height, skill, 1)
    end
  end
  
  def clear
    @result = []
    @skills = []
    @replace = true
    refresh
  end

  def cursor_movable?
    return false
  end
end

#==============================================================================
# ** Window_MS_ActorList
#==============================================================================
class Window_MS_ActorList < Window_Command
  attr_reader :define
  def initialize(width)
    commands = []
    @define = []
    $game_party.members.each do |i|
      commands << i.name
      @define << i
    end
    commands << Scene_Mixskill::EXIT_BUTTON
    @define << 'exit'
    super(width, commands)
  end
end

 

 

Edited by Wizered99

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×