New skill script with Blizzabs?

Started by elmangakac, March 19, 2011, 05:39:03 pm

Previous topic - Next topic

elmangakac

Hello guys... i found a script that let you know when a character learn a new skill if this levels up!... But have a little issue with BLIZZABS when the actor going to open a range in a new skill... anybody know how that can be solved???

The author of script are: Kyonides-Arkanthos alias Kyonides, Shadowball




#============================
#  *  New Skills List
#     por Kyonides-Arkanthos alias Kyonides, Shadowball
#     v 1.0.0 - 19.01.2008 (New Skill Script)
#     v 1.0.1 - 06.02.2010
#============================
module KyoSkillMod
  APRENDER = ' Learn '
  @@new_skill = []
  @@time, @@index, @@max_index = 60, 0, 0
 
  def self.actor(actor, skill)
    @@new_skill[@@index] = [actor, skill]
    @@max_index = @@index
    @@index += 1
  end

  def new_skill(index)
    actor, skill = @@new_skill[index][0], @@new_skill[index][1]
    actor + APRENDER + skill if index <= @@max_index
  end
 
  def show_new_skills
    if !@no_new_skill and !@@new_skill.empty?
      if @index == @@max_index+1
        @skills_window.visible = false
        @no_new_skill = true
        return
      end
      @wait_count = @@time
      @skills_window.visible = true
      set_next_skill
    end
  end
 
  def set_next_skill
    @skills_window.set_text(new_skill(@index), 1)
    @index += 1
  end
 
  def clear_all
    @@new_skill, @@index, @@max_index = [], 0, 0
  end
end
#============================
#  *  Game_Actor Mod
class Game_Actor 
  def learn_skill(skill_id)
    if skill_id > 0 and not skill_learn?(skill_id)
      @skills.push(skill_id)
      @skills.sort!
      # Si el héroe aprende habilidades, estás se agrupan en un listado
      # Funciona tanto en el Mapa como en Batalla
      if Graphics.frame_count / Graphics.frame_rate != 0
        skill = $data_skills[skill_id].name
        KyoSkillMod.actor(self.name, skill)
      end
    end
  end
end
#============================
#  *  Window_Help2
class Window_Help2 < Window_Base
  def initialize
    x = 320 - 360 / 2
    super(x, 0, 360, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 160
  end
 
  def set_text(text, align)
    self.contents.clear
    self.contents.draw_text(0, 0, width - 32, 32, text, align)
  end
end
#============================
#  *  Scene_Map Modificado
class Scene_Map
  include KyoSkillMod
  alias :kyon_skill_smap_main :main
  alias :kyon_skill_smap_up :update
 
  def main
    @wait_count, @index = 0, 0
    @skills_window = Window_Help2.new
    @skills_window.visible = false
    kyon_skill_smap_main
    @skills_window.dispose
  end
 
  def update
    if @wait_count > 0
      @wait_count -= 1
      return
    end
    show_new_skills
    clear_all if @no_new_skill or @@new_skill.empty?
    kyon_skill_smap_up
  end
end
#============================
#  *  Scene_Battle Mod
class Scene_Battle
  include KyoSkillMod
  alias :kyon_skill_battle_main :main
  def main
    @skills_window = Window_Help2.new
    @skills_window.visible = false
    @no_new_skill = false
    @index = 0
    kyon_skill_battle_main
    @skills_window.dispose
  end
  def update_phase5
    @status_window.refresh
    $game_temp.battle_main_phase = false if $game_temp.battle_main_phase
    @result_window.visible = true if !@result_window.visible
    if Input.trigger?(Input::C)
      clear_all
      battle_end(0) if @@new_skill.empty?
    end
    show_new_skills
  end
end
#=begin
class Scene_Battle
  alias :kyon_skill_battle_sb_event :setup_battle_event
  def setup_battle_event
    kyon_skill_battle_sb_event
    $game_troop.enemies.each {|e| e.hp = 0}
  end
end
#=end