Jump to content
Rpg²S Forum

Belxebu

Utenti
  • Posts

    186
  • Joined

  • Last visited

Posts posted by Belxebu

  1. Ecco lo script per avere delle barre ho, sp in battaglia NON solo per l' eroe...ma anche x i mostri

     

    Ecco lo script.. create un nuova classe sopra main e metteteci questo:

     

    Lo script è di SephirothSpawn e non mio!!!

     

    class Window_Base < Window  
     #--------------------------------------------------------------------------
     # * Draw Slant Bar(by SephirothSpawn)
     #--------------------------------------------------------------------------
     def draw_slant_bar(x, y, min, max, width = 152, height = 6,
      bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
    # Draw Border
    for i in 0..height
      self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
    end
    # Draw Background
    for i in 1..(height - 1)
      r = 100 * (height - i) / height + 0 * i / height
      g = 100 * (height - i) / height + 0 * i / height
      b = 100 * (height - i) / height + 0 * i / height
      a = 255 * (height - i) / height + 255 * i / height
      self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
    end
    # Draws Bar
    for i in 1..( (min / max.to_f) * width - 1)
      for j in 1..(height - 1)
    r = bar_color.red * (width - i) / width + end_color.red * i / width
    g = bar_color.green * (width - i) / width + end_color.green * i / width
    b = bar_color.blue * (width - i) / width + end_color.blue * i / width
    a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
    self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
      end
    end
     end
    end
    
    
    class Window_EnemyHP < Window_Base
     
     def initialize
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    refresh
     end
     
     def refresh
    self.contents.clear
    for i in 0...$game_troop.enemies.size
      @enemy = $game_troop.enemies[i]
      @percent = (@enemy.hp * 100) / @enemy.maxhp
      unless @enemy.hp == 0
      draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 10, @enemy.hp, @enemy.maxhp, width = 75, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
      self.contents.draw_text(@enemy.screen_x - 39, @enemy.screen_y - 22, 100, 32, "#{@percent}" + "%")
    end
     end
    end
    end
    
    class Scene_Battle
     
     alias raz_update update
     alias raz_update_phase5 update_phase5
     alias raz_update_phase4_step1 update_phase4_step1
     alias raz_update_phase4_step5 update_phase4_step5
     alias raz_enemy_hp_main main
     
      def main
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    @enemy_window = Window_EnemyHP.new
    @enemy_window.z = 95
    raz_enemy_hp_main
    @enemy_window.dispose
     end
    
     
     def update
    @enemy_window.update
    raz_update
     end
    
     def update_phase5
    # If wait count is larger than 0
    if @phase5_wait_count > 0
      # Decrease wait count
      @phase5_wait_count -= 1
      # If wait count reaches 0
      if @phase5_wait_count == 0
    @enemy_window.visible = false
    # Show result window
    @result_window.visible = true
    # Clear main phase flag
    $game_temp.battle_main_phase = false
    # Refresh status window
    @status_window.refresh
    @enemy_window.refresh
      end
      return
    end
      raz_update_phase5
    end
    
    def update_phase4_step1
     raz_update_phase4_step1
     @enemy_window.refresh
    end
    
     def update_phase4_step5
    # Hide help window
    @help_window.visible = false
    # Refresh status window
    @status_window.refresh
    @enemy_window.refresh
    raz_update_phase4_step5
     end
    end
    
    class Window_BattleStatus < Window_Base
     #--------------------------------------------------------------------------
     # * Object Initialization
     #--------------------------------------------------------------------------
     def initialize
    super(0, 320, 640, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    @level_up_flags = [false, false, false, false]
    refresh
     end
     #--------------------------------------------------------------------------
     # * Dispose
     #--------------------------------------------------------------------------
     def dispose
    super
     end
     #--------------------------------------------------------------------------
     # * Set Level Up Flag
     #	 actor_index : actor index
     #--------------------------------------------------------------------------
     def level_up(actor_index)
    @level_up_flags[actor_index] = true
     end
     #--------------------------------------------------------------------------
     # * Refresh
     #--------------------------------------------------------------------------
     def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_x = i * 160 + 4
      draw_slant_bar(actor_x, 55, actor.hp, actor.maxhp, 120)
      draw_slant_bar(actor_x, 88, actor.sp, actor.maxsp, 120, 6, bar_color = Color.new(150, 0, 150, 255), end_color = Color.new(0, 0, 255, 255))
      draw_actor_name(actor, actor_x, 0)
      draw_actor_hp(actor, actor_x, 32, 120)
      draw_actor_sp(actor, actor_x, 64, 120)
      if @level_up_flags[i]
    self.contents.font.color = normal_color
    self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
      else
    draw_actor_state(actor, actor_x, 96)
      end
    end
     end
     #--------------------------------------------------------------------------
     # * Frame Update
     #--------------------------------------------------------------------------
     def update
    super
    # Slightly lower opacity level during main phase
    if $game_temp.battle_main_phase
      self.contents_opacity -= 4 if self.contents_opacity > 191
    else
      self.contents_opacity += 4 if self.contents_opacity < 255
    end
     end
    end

     

     

    <b> Se volete che si vedano solo le barre dei nemici invece che quelle dell' eroe </b>

     

    Metteteci questo

     

     

    class Window_Base < Window  
     #--------------------------------------------------------------------------
     # * Draw Slant Bar(by SephirothSpawn)
     #--------------------------------------------------------------------------
     def draw_slant_bar(x, y, min, max, width = 152, height = 6,
      bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
    # Draw Border
    for i in 0..height
      self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
    end
    # Draw Background
    for i in 1..(height - 1)
      r = 100 * (height - i) / height + 0 * i / height
      g = 100 * (height - i) / height + 0 * i / height
      b = 100 * (height - i) / height + 0 * i / height
      a = 255 * (height - i) / height + 255 * i / height
      self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
    end
    # Draws Bar
    for i in 1..( (min / max.to_f) * width - 1)
      for j in 1..(height - 1)
    r = bar_color.red * (width - i) / width + end_color.red * i / width
    g = bar_color.green * (width - i) / width + end_color.green * i / width
    b = bar_color.blue * (width - i) / width + end_color.blue * i / width
    a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
    self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
      end
    end
     end
    end
    
    
    class Window_EnemyHP < Window_Base
     
     def initialize
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    refresh
     end
     
     def refresh
    self.contents.clear
    for i in 0...$game_troop.enemies.size
      @enemy = $game_troop.enemies[i]
      @percent = (@enemy.hp * 100) / @enemy.maxhp
      unless @enemy.hp == 0
      draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 10, @enemy.hp, @enemy.maxhp, width = 75, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
      self.contents.draw_text(@enemy.screen_x - 39, @enemy.screen_y - 22, 100, 32, "#{@percent}" + "%")
    end
     end
    end
    end
    
    class Scene_Battle
     
     alias raz_update update
     alias raz_update_phase5 update_phase5
     alias raz_update_phase4_step1 update_phase4_step1
     alias raz_update_phase4_step5 update_phase4_step5
     alias raz_enemy_hp_main main
     
      def main
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    @enemy_window = Window_EnemyHP.new
    @enemy_window.z = 95
    raz_enemy_hp_main
    @enemy_window.dispose
     end
    
     
     def update
    @enemy_window.update
    raz_update
     end
    
     def update_phase5
    # If wait count is larger than 0
    if @phase5_wait_count > 0
      # Decrease wait count
      @phase5_wait_count -= 1
      # If wait count reaches 0
      if @phase5_wait_count == 0
    @enemy_window.visible = false
    # Show result window
    @result_window.visible = true
    # Clear main phase flag
    $game_temp.battle_main_phase = false
    # Refresh status window
    @status_window.refresh
    @enemy_window.refresh
      end
      return
    end
      raz_update_phase5
    end
    
    def update_phase4_step1
     raz_update_phase4_step1
     @enemy_window.refresh
    end
    
     def update_phase4_step5
    # Hide help window
    @help_window.visible = false
    # Refresh status window
    @status_window.refresh
    @enemy_window.refresh
    raz_update_phase4_step5
     end
    end
    
    class Window_BattleStatus < Window_Base
     #--------------------------------------------------------------------------
     # * Object Initialization
     #--------------------------------------------------------------------------
     def initialize
    super(0, 320, 640, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    @level_up_flags = [false, false, false, false]
    refresh
     end
     #--------------------------------------------------------------------------
     # * Dispose
     #--------------------------------------------------------------------------
     def dispose
    super
     end
     #--------------------------------------------------------------------------
     # * Set Level Up Flag
     #	 actor_index : actor index
     #--------------------------------------------------------------------------
     def level_up(actor_index)
    @level_up_flags[actor_index] = true
     end
     #--------------------------------------------------------------------------
     # * Refresh
     #--------------------------------------------------------------------------
     def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_x = i * 160 + 4
      draw_slant_bar(actor_x, 55, actor.hp, actor.maxhp, 120)
      draw_slant_bar(actor_x, 88, actor.sp, actor.maxsp, 120, 6, bar_color = Color.new(150, 0, 150, 255), end_color = Color.new(0, 0, 255, 255))
      draw_actor_name(actor, actor_x, 0)
      draw_actor_hp(actor, actor_x, 32, 120)
      draw_actor_sp(actor, actor_x, 64, 120)
      if @level_up_flags[i]
    self.contents.font.color = normal_color
    self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
      else
    draw_actor_state(actor, actor_x, 96)
      end
    end
     end
     #--------------------------------------------------------------------------
     # * Frame Update
     #--------------------------------------------------------------------------
     def update
    super
    # Slightly lower opacity level during main phase
    if $game_temp.battle_main_phase
      self.contents_opacity -= 4 if self.contents_opacity > 191
    else
      self.contents_opacity += 4 if self.contents_opacity < 255
    end
     end
    end

     

     

    <b>Per vedere soloquelle degli eroi metteteci questo</b>

     

     

    class Window_Base < Window  
     #--------------------------------------------------------------------------
     # * Draw Slant Bar(by SephirothSpawn)
     #--------------------------------------------------------------------------
     def draw_slant_bar(x, y, min, max, width = 152, height = 6,
      bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
    # Draw Border
    for i in 0..height
      self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
    end
    # Draw Background
    for i in 1..(height - 1)
      r = 100 * (height - i) / height + 0 * i / height
      g = 100 * (height - i) / height + 0 * i / height
      b = 100 * (height - i) / height + 0 * i / height
      a = 255 * (height - i) / height + 255 * i / height
      self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
    end
    # Draws Bar
    for i in 1..( (min / max.to_f) * width - 1)
      for j in 1..(height - 1)
    r = bar_color.red * (width - i) / width + end_color.red * i / width
    g = bar_color.green * (width - i) / width + end_color.green * i / width
    b = bar_color.blue * (width - i) / width + end_color.blue * i / width
    a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
    self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
      end
    end
     end
    end
    
    
    class Window_BattleStatus < Window_Base
    
     def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_x = i * 160 + 4
      draw_slant_bar(actor_x, 55, actor.hp, actor.maxhp, 120)
      draw_slant_bar(actor_x, 88, actor.sp, actor.maxsp, 120, 6, bar_color = Color.new(150, 0, 150, 255), end_color = Color.new(0, 0, 255, 255))
      draw_actor_name(actor, actor_x, 0)
      draw_actor_hp(actor, actor_x, 32, 120)
      draw_actor_sp(actor, actor_x, 64, 120)
      if @level_up_flags[i]
    self.contents.font.color = normal_color
    self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
      else
    draw_actor_state(actor, actor_x, 96)
      end
    end
     end
    end

     

     

    Ecco uno screen di esempio

    http://img145.imageshack.us/img145/448/name3hh.png

     

     

     

     

    A me da errore nella linea 20.Sapete perchè????

  2. Permette di avere un venditore di magie(ma si può fare tranquillamente a eventi quindi...)

     

    Nuova classe sopra Main e chiamatela Skill Shop

     

    #================================================================
    # ** Skill Shop
    #------------------------------------------------------------------------------
    # SephirothSpawn
    # 2006-04-06
    # Version 1
    #------------------------------------------------------------------------------
    # * Instrucions :
    #
    # ~ Gaining Skill Points
    # - $game_party.actors[actor_index].skill_shop_points +-*/= x
    # OR
    # - $game_actors[actor_id].skill_shop_points +-*/= x
    #
    # ~ Setting Up Aviable Skills
    # - $game_temp.skill_shop_skills[actor_id] = [skill_id, ... ]
    # OR
    # - $game_temp.skill_shop_skills[actor_id] = nil
    # - $game_temp.skill_shop_skills[0] = [skill_id, ...]
    # (0 is used as the default. Any actor ID not defined will use this list for the skills)
    #
    # ~ Calling Skill Shop
    # - $scene = Scene_SkillShop.new(actor_index)
    #
    # ~ Switching Actor In Skill Shop
    # - Press L or R
    #------------------------------------------------------------------------------
    # * Customization :
    #
    # ~ Purchasing Types (Must Use 1, can Use 2)
    # - Spend_Gold = true (On) or false (Off)
    # - Spend_Skill_Points = true (On) or false (Off)
    #
    # ~ Skill Cost
    # - Gold Cost
    # Skill_Gold_Cost = { skill_id => cost, ... }
    # - Skill Point Cost
    # Skill_Point_Cost = { skill_id => cost, ... }
    #
    # ~ Actor Requirements
    # - Actor_Requirements = { skill_id => [actor_id, ...], ... }
    #
    # ~ Level Requirements
    # - Level_Requirements = { skill_id => req_level, ... }
    #
    # ~ Previous Skill Requirements
    # - Previous_Skill_Requirments = { skill_id => [req_skill, ...], ... }
    #==============================================================================
    
    
    #==============================================================================
    # ** Skill_Shop
    #==============================================================================
    
    module Skill_Shop
    #--------------------------------------------------------------------------
    # * Purchasing Types
    #--------------------------------------------------------------------------
    Spend_Gold = true
    Spend_Skill_Points = true
    #--------------------------------------------------------------------------
    # * Skill Cost
    # ~ Skill_Gold_Cost = { skill_id => cost, ... }
    # ~ Skill_Point_Cost = { skill_id => cost, ... }
    #--------------------------------------------------------------------------
    Default_Skill_Gold_Cost = 500
    Skill_Gold_Cost = {}
    Default_SP_Cost = 500
    Skill_Point_Cost = {}
    #--------------------------------------------------------------------------
    # * Actor Requirements
    # ~ Actor_Requirements = { skill_id => [actor_id, ...], ... }
    #--------------------------------------------------------------------------
    Actor_Requirements = {
    57 => [1], 58 => [1], 59 => [1], 60 => [1],
    61 => [2], 62 => [2], 63 => [2], 64 => [2],
    65 => [3], 66 => [3], 67 => [3], 68 => [3],
    69 => [4], 70 => [4], 71 => [4], 72 => [4],
    73 => [5], 74 => [5], 75 => [5], 76 => [5],
    77 => [6], 78 => [6], 79 => [6], 80 => [6],
    }
    #--------------------------------------------------------------------------
    # * Level Requirements
    # ~ Level_Requirements = { skill_id => req_level, ... }
    #--------------------------------------------------------------------------
    Level_Requirements = {}
    #--------------------------------------------------------------------------
    # * Previous Skill Requirements
    # ~ Previous_Skill_Requirments = { skill_id => [req_skill, ...], ... }
    #--------------------------------------------------------------------------
    Previous_Skill_Requirments = {
    2 => [1], 3 => [1, 2],
    5 => [4],
    8 => [7], 9 => [7, 8],
    11 => [10], 12 => [10, 11],
    14 => [13], 15 => [13, 14],
    17 => [16], 18 => [16, 17],
    20 => [19], 21 => [19, 20],
    23 => [22], 24 => [22, 23],
    26 => [25], 27 => [25, 26],
    29 => [28], 30 => [28, 29], 32 => [31],
    58 => [57], 59 => [57, 58], 60 => [57, 58, 59],
    62 => [61], 63 => [61, 62], 64 => [61, 62, 63],
    66 => [65], 67 => [65, 66], 68 => [65, 66, 67],
    70 => [69], 71 => [69, 70], 72 => [69, 70, 71],
    74 => [73], 75 => [73, 74], 76 => [73, 74, 75],
    78 => [77], 79 => [77, 78], 80 => [77, 78, 79]
    }
    end
    
    #==============================================================================
    # ** Game_Temp
    #==============================================================================
    
    class Game_Temp
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_accessor :skill_shop_skills
    #--------------------------------------------------------------------------
    # * Alias Listings
    #--------------------------------------------------------------------------
    alias seph_skillshop_gtemp_init initialize
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
    # Original Initialization
    seph_skillshop_gtemp_init
    # Sets Skills Shop Skills List
    @skill_shop_skills = {0 => (1...$data_skills.size).to_a}
    end
    end
    
    #==============================================================================
    # ** Game_Actor
    #==============================================================================
    
    class Game_Actor < Game_Battler
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_accessor :skill_shop_points
    #--------------------------------------------------------------------------
    # * Alias Listings
    #--------------------------------------------------------------------------
    alias seph_skillshop_gactor_setup setup
    alias seph_skillshop_gactor_skills skills
    #--------------------------------------------------------------------------
    # * Setup
    #--------------------------------------------------------------------------
    def setup(actor_id)
    # Sets Up Skill Shop Skills Array
    @skill_shop_skills = []
    # Sets Up Skill Points
    @skill_shop_points = 0
    # Original Setup Method
    seph_skillshop_gactor_setup(actor_id)
    end
    #--------------------------------------------------------------------------
    # * Skills
    #--------------------------------------------------------------------------
    def skills
    # Gets Original Skills
    s = seph_skillshop_gactor_skills.dup
    # Adds Skill Shop Skills
    s << @skill_shop_skills
    # Returns Skills
    return s.flatten.uniq.sort.dup
    end
    #--------------------------------------------------------------------------
    # * Learn Shop Skill
    #--------------------------------------------------------------------------
    def learn_shop_skill(skill_id)
    # Unless Skill Already Learned
    unless @skill_shop_skills.include?(skill_id)
    # Learn Shop Skill
    @skill_shop_skills << skill_id
    end
    end
    #--------------------------------------------------------------------------
    # * Can Learn Shop Skill Check
    #--------------------------------------------------------------------------
    def can_learn_shop_skill?(skill_id)
    # If Skill Learned
    if self.skills.include?(skill_id)
    return false
    end
    # If Gold Cost
    if Skill_Shop::Spend_Gold
    if Skill_Shop::Skill_Gold_Cost.has_key?(skill_id)
    if $game_party.gold < Skill_Shop::Skill_Gold_Cost[skill_id]
    return false
    end
    else
    if $game_party.gold < Skill_Shop::Default_Skill_Gold_Cost
    return false
    end
    end
    end
    # If Skill Point Cost
    if Skill_Shop::Spend_Skill_Points
    if Skill_Shop::Skill_Point_Cost.has_key?(skill_id)
    if @skill_shop_points < Sklll_Shop::Skill_Point_Cost[skill_id]
    p 'Not Enough SP'
    return false
    end
    else
    if @skill_shop_points < Skill_Shop::Default_SP_Cost
    return false
    end
    end
    end
    # Actor Requirement
    if Skill_Shop::Actor_Requirements.has_key?(skill_id)
    unless Skill_Shop::Actor_Requirements[skill_id].include?(@actor_id)
    return false
    end
    end
    # Level Requirement
    if Skill_Shop::Level_Requirements.has_key?(skill_id)
    if @level < Skill_Shop::Level_Requirements[skill_id]
    return false
    end
    end
    # Previous Skill Requirement
    if Skill_Shop::Previous_Skill_Requirments.has_key?(skill_id)
    for s_id in Skill_Shop::Previous_Skill_Requirments[skill_id]
    unless self.skills.include?(s_id)
    return false
    end
    end
    end
    return true
    end
    end
    
    #==============================================================================
    # ** Window_SkillShop_SkillList
    #==============================================================================
    
    class Window_SkillShop_SkillList < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize(actor_id)
    super(0, 64, 224, 320)
    @actor = $game_party.actors[actor_id]
    create_skills_list
    refresh
    self.index = 0
    end
    #--------------------------------------------------------------------------
    # * Create Skills List
    #--------------------------------------------------------------------------
    def create_skills_list
    # Check for Personalize Skills List
    if $game_temp.skill_shop_skills.has_key?(@actor.id)
    unless $game_temp.skill_shop_skills[@actor.id].nil?
    @skills = $game_temp.skill_shop_skills[@actor.id]
    end
    end
    # Default Skill List
    if @skills.nil?
    @skills = $game_temp.skill_shop_skills[0]
    end
    # Sets Item Max
    @item_max = @skills.size
    if @item_max > 0
    self.contents = Bitmap.new(192, @item_max * 32)
    end
    end
    #--------------------------------------------------------------------------
    # * Return Skill Id
    #--------------------------------------------------------------------------
    def skill_id
    return @skills[self.index]
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
    self.contents.clear
    for i in 0...@item_max
    draw_item(i)
    end
    end
    #--------------------------------------------------------------------------
    # * Draw Item
    #--------------------------------------------------------------------------
    def draw_item(index)
    # Sets Skill
    skill = $data_skills[@skills[index]]
    # Can Learn Flag
    can_learn = @actor.can_learn_shop_skill?(skill.id)
    # Skill Icon
    bitmap = RPG::Cache.icon(skill.icon_name)
    # Draws Skill Icon
    self.contents.blt(4, index * 32 + 4, bitmap, Rect.new(0, 0, 24, 24), can_learn ? 255 : 160)
    # Font Color
    self.contents.font.color = can_learn ? normal_color : disabled_color
    # Draws Skill Name
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.draw_text(32, index * 32, 160, 32, skill.name)
    end
    end
    
    #==============================================================================
    # ** Window_SkillShop_Cost
    #==============================================================================
    
    class Window_SkillShop_Cost < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize(actor_id, skill_id)
    super(0, 384, 224, 96)
    self.contents = Bitmap.new(192, 64)
    @actor = $game_party.actors[actor_id]
    refresh(skill_id)
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh(skill_id)
    self.contents.clear
    # Gold & SP Cost
    if Skill_Shop::Spend_Gold && Skill_Shop::Spend_Skill_Points
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 192, 32, "#{$data_system.words.gold} Cost:")
    self.contents.draw_text(4, 32, 192, 32, 'Skill Point Cost:')
    gold = $game_party.gold - (Skill_Shop::Skill_Gold_Cost.has_key?(skill_id) ?
    Skill_Shop::Skill_Gold_Cost[skill_id] : Skill_Shop::Default_Skill_Gold_Cost)
    self.contents.font.color = gold >= 0 ? text_color(1) : text_color(2)
    self.contents.draw_text(- 4, 0, 192, 32, gold.to_s, 2)
    sp = @actor.skill_shop_points - (Skill_Shop::Skill_Point_Cost.has_key?(skill_id) ?
    Skill_Shop::Skill_Point_Cost[skill_id] : Skill_Shop::Default_SP_Cost)
    self.contents.font.color = sp >= 0 ? text_color(1) : text_color(2)
    self.contents.draw_text(- 4, 32, 192, 32, sp.to_s, 2)
    # Only Gold Cost
    elsif Skill_Shop::Spend_Gold
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 192, 32, "#{$data_system.words.gold} Cost:")
    gold = $game_party.gold - (Skill_Shop::Skill_Gold_Cost.has_key?(skill_id) ?
    Skill_Shop::Skill_Gold_Cost[skill_id] : Skill_Shop::Default_Skill_Gold_Cost)
    self.contents.font.color = gold >= 0 ? text_color(1) : text_color(2)
    self.contents.draw_text(- 4, 32, 192, 32, gold.to_s, 2)
    elsif Skill_Shop::Spend_Skill_Points
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 192, 32, 'Skill Point Cost')
    self.contents.font.color = normal_color
    sp = @actor.skill_shop_points - Skill_Shop::Skill_Point_Cost.has_key?(skill_id) ?
    Skill_Shop::Skill_Point_Cost[skill_id] : Skill_Shop::Default_SP_Cost
    
    self.contents.font.color = sp >= 0 ? text_color(1) : text_color(2)
    self.contents.draw_text(- 4, 32, 192, 32, sp.to_s, 2)
    end
    end
    end
    
    #==============================================================================
    # ** Window_SkillShop_SkillData
    #==============================================================================
    
    class Window_SkillShop_SkillData < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize(actor_index, skill_id)
    super(224, 64, 416, 416)
    self.contents = Bitmap.new(384, 384)
    @actor = $game_party.actors[actor_index]
    refresh(skill_id)
    end
    #--------------------------------------------------------------------------
    # * Disabled System Color
    #--------------------------------------------------------------------------
    def disabled_system_color
    color = system_color
    color.alpha = disabled_color.alpha
    return color
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh(skill_id)
    self.contents.clear
    # Gets Skills
    skill = $data_skills[skill_id]
    # Can Learn Flag
    can_learn = @actor.can_learn_shop_skill?(skill.id)
    # Gets Icon
    bitmap = RPG::Cache.icon(skill.icon_name)
    # Draws Skill Icon
    self.contents.blt(4, 4, bitmap, Rect.new(0, 0, 24, 24), can_learn ? 255 : 160)
    # Draws Skill Name
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = can_learn ? normal_color : disabled_color
    self.contents.draw_text(32, 0, 352, 32, skill.name)
    # Draws SP Cost
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = can_learn ? system_color : disabled_system_color
    self.contents.draw_text(272, 0, 112, 32, "#{$data_system.words.sp} :")
    self.contents.font.color = can_learn ? normal_color : disabled_color
    self.contents.draw_text(- 4, 0, 384, 32, skill.sp_cost.to_s, 2)
    # Draws Descritpion
    self.contents.font.color = can_learn ? system_color : disabled_system_color
    self.contents.draw_text(4, 32, 60, 32, 'Desc. :')
    self.contents.font.color = can_learn ? normal_color : disabled_color
    self.contents.draw_text(64, 32, 320, 32, skill.description)
    # Draws Scope
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    case skill.scope
    when 0; scope = 'None'
    when 1; scope = 'One Enemy'
    when 2; scope = 'All Enemies'
    when 3; scope = 'One Ally'
    when 4; scope = 'All Allies'
    when 5; scope = "KO'd Ally"
    when 6; scope = "All KO'd Allies"
    when 7; scope = 'User'
    end
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = can_learn ? system_color : disabled_system_color
    self.contents.draw_text(4, 64, 186, 32, 'Scope :')
    self.contents.font.color = can_learn ? normal_color : disabled_color
    self.contents.draw_text(- 4, 64, 190, 32, scope, 2)
    # Draws Occassion
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    case skill.occasion
    when 0; occ = 'Sempre'
    when 1; occ = 'In battaglia'
    when 2; occ = 'Nel Menu'
    when 3; occ = 'Mai'
    end
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = can_learn ? system_color : disabled_system_color
    self.contents.draw_text(194, 64, 186, 32, 'Occassion :')
    self.contents.font.color = can_learn ? normal_color : disabled_color
    self.contents.draw_text(190, 64, 190, 32, occ, 2)
    # Draws Skill Power & Hit Probability
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = can_learn ? system_color : disabled_system_color
    self.contents.draw_text(4, 96, 186, 32, 'Potenza :')
    self.contents.draw_text(194, 96, 186, 32, 'Attacco %')
    self.contents.font.color = can_learn ? normal_color : disabled_color
    self.contents.draw_text(- 4, 96, 190, 32, skill.power.to_s, 2)
    self.contents.draw_text(190, 96, 190, 32, skill.hit.to_s, 2)
    # Cash Cost
    if Skill_Shop::Spend_Gold
    cost = Skill_Shop::Skill_Gold_Cost.has_key?(skill_id) ?
    Skill_Shop::Skill_Gold_Cost[skill_id] : Skill_Shop::Default_Skill_Gold_Cost
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = can_learn ? system_color : disabled_system_color
    self.contents.draw_text(4, 128, 186, 32, "#{$data_system.words.gold} Cost:")
    self.contents.font.color = can_learn ? normal_color : disabled_color
    self.contents.draw_text(- 4, 128, 190, 32, cost.to_s, 2)
    end
    # Skill Points Cost
    if Skill_Shop::Spend_Skill_Points
    cost = Skill_Shop::Skill_Point_Cost.has_key?(skill_id) ?
    Skill_Shop::Skill_Point_Cost[skill_id] : Skill_Shop::Default_SP_Cost
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = can_learn ? system_color : disabled_system_color
    self.contents.draw_text(194, 128, 186, 32, "Costo Mp:")
    self.contents.font.color = can_learn ? normal_color : disabled_color
    self.contents.draw_text(190, 128, 190, 32, cost.to_s, 2)
    end
    # Draws Level Requried
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = can_learn ? system_color : disabled_system_color
    self.contents.draw_text(95, 160, 190, 32, 'Livello richiesto :')
    req_lvl = Skill_Shop::Level_Requirements.has_key?(skill_id) ?
    Skill_Shop::Level_Requirements[skill_id].to_s : 'Niente'
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = can_learn ? normal_color : disabled_color
    self.contents.draw_text(95, 160, 190, 32, req_lvl, 2)
    # Actor Requirment
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = can_learn ? system_color : disabled_system_color
    self.contents.draw_text(0, 192, 384, 32, 'Actor allowed skills', 1)
    self.contents.font.color = can_learn ? normal_color : disabled_color
    if Skill_Shop::Actor_Requirements.has_key?(skill_id)
    actors = Skill_Shop::Actor_Requirements[skill_id].dup
    actors.collect! { |x| $data_actors[x].name}
    actors = actors.join(' - ')
    else
    actors = 'Tutti gli alleti'
    end
    self.contents.draw_text(0, 224, 384, 32, actors, 1)
    # Draws Previous Skill Requirements
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 24
    self.contents.font.color = can_learn ? system_color : disabled_system_color
    self.contents.draw_text(0, 256, 384, 32, 'Magie richieste', 1)
    self.contents.font.color = can_learn ? normal_color : disabled_color
    if Skill_Shop::Previous_Skill_Requirments.has_key?(skill_id)
    skills = Skill_Shop::Previous_Skill_Requirments[skill_id].dup
    skills.collect! {|x| $data_skills[x]}
    for i in 0...skills.size
    skill = skills[i]
    x = 4 + i % 2 * 190
    y = i / 2 * 32 + 288
    bitmap = RPG::Cache.icon(skill.icon_name)
    self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), can_learn ? 255 : 160)
    self.contents.draw_text(x + 32, y, 154, 32, skill.name)
    end
    else
    self.contents.draw_text(0, 288, 384, 32, 'Niente magie', 1)
    end
    end
    end
    
    #==============================================================================
    # ** Scene_SkillShop
    #==============================================================================
    
    class Scene_SkillShop
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize(actor_index = 0)
    @actor_index = actor_index
    @actor = $game_party.actors[actor_index]
    end
    #--------------------------------------------------------------------------
    # * Main Processing
    #--------------------------------------------------------------------------
    def main
    # Creates Help Window
    @help_window = Window_Help.new
    @help_window.set_text("Benvenuto nel negozio di magia! #{@actor.name} ~ Scegli magia da imparare", 1)
    # Creates Skill List
    @skill_list_window = Window_SkillShop_SkillList.new(@actor_index)
    # Creates Skill Shop Cost Window
    @skill_cost_window = Window_SkillShop_Cost.new(@actor_index, @skill_list_window.skill_id)
    # Creates Skill Data Window
    @skill_data_window = Window_SkillShop_SkillData.new(@actor_index, @skill_list_window.skill_id)
    # Confirmation Window
    @confirmation_window = Window_Command.new(128, ['Si', 'No'])
    @confirmation_window.x, @confirmation_window.y = 256, 208
    @confirmation_window.z = 1000
    @confirmation_window.visible = @confirmation_window.active = false
    # Scene Objects
    @scene_objects = [@help_window, @skill_list_window, @skill_cost_window,
    @skill_data_window, @confirmation_window]
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
    # Update game screen
    Graphics.update
    # Update input information
    Input.update
    # Updates Scene Objects
    @scene_objects.each { |x| x.update }
    # Frame update
    update
    # Abort loop if screen is changed
    break if $scene != self
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose Scene Objects
    @scene_objects.each { |x| x.dispose }
    end
    #--------------------------------------------------------------------------
    # * Frame Update
    #--------------------------------------------------------------------------
    def update
    # If Skill List Window Active
    if @skill_list_window.active
    update_skill_select
    return
    # If Confirmation Window Active
    elsif @confirmation_window.active
    update_confirmation
    return
    end
    end
    #--------------------------------------------------------------------------
    # * Frame Update : Skill Select
    #--------------------------------------------------------------------------
    def update_skill_select
    # If Up or Down Is Pressed
    if Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)
    # Refresh Windows
    @skill_cost_window.refresh(@skill_list_window.skill_id)
    @skill_data_window.refresh(@skill_list_window.skill_id)
    end
    # If B Button Is Pressed
    if Input.trigger?(Input::B)
    # Play cancel SE
    $game_system.se_play($data_system.cancel_se)
    # Switch to map screen
    $scene = Scene_Map.new
    return
    end
    # If C Button Is Pressed
    if Input.trigger?(Input::C)
    # Can learn Check
    unless @actor.can_learn_shop_skill?(@skill_list_window.skill_id)
    # Play Buzzer SE
    $game_system.se_play($data_system.buzzer_se)
    # Set Help Text
    @help_window.set_text('Non può imparare questa magia!', 1)
    return
    end
    # Play Decision SE
    $game_system.se_play($data_system.decision_se)
    # Turn Off Skill List Window
    @skill_list_window.active = false
    # Resets Index
    @confirmation_window.index = 0
    # Turns Window On
    @confirmation_window.visible = @confirmation_window.active = true
    # Gets Skill Name
    skill_name = $data_skills[@skill_list_window.skill_id].name
    # Updates Help Text
    @help_window.set_text("Vuoi imparare #{skill_name} #{@actor.name}?", 1)
    end
    # If L is Pressed
    if Input.trigger?(Input::LEFT)
    # Play Cursor SE
    $game_system.se_play($data_system.cursor_se)
    # Changes Actor Index
    @actor_index == 0 ? @actor_index = $game_party.actors.size - 1: @actor_index -= 1
    # Resets Scene
    $scene = Scene_SkillShop.new(@actor_index)
    end
    # If R is Pressed
    if Input.trigger?(Input::RIGHT)
    # Play Cursor SE
    $game_system.se_play($data_system.cursor_se)
    # Changes Actor Index
    @actor_index == $game_party.actors.size - 1 ? @actor_index = 0 : @actor_index += 1
    # Resets Scene
    $scene = Scene_SkillShop.new(@actor_index)
    end
    end
    #--------------------------------------------------------------------------
    # * Frame Update : Confirmation
    #--------------------------------------------------------------------------
    def update_confirmation
    # If B Button Pressed
    if Input.trigger?(Input::B)
    # Play cancel SE
    $game_system.se_play($data_system.cancel_se)
    # Turn On Skill List Window
    @skill_list_window.active = true
    # Turns Off Confirmation Window
    @confirmation_window.visible = @confirmation_window.active = false
    # Updates Help Text
    @help_window.set_text("Benvenuto nel negozio di magia! #{@actor.name} ~ Scegli la magia da imparare", 1)
    end
    # If C Button Pressed
    if Input.trigger?(Input::C)
    # Play Decision SE
    $game_system.se_play($data_system.decision_se)
    # Gets Skill ID
    skill_id = @skill_list_window.skill_id
    # Lose Gold
    if Skill_Shop::Spend_Gold
    cost = Skill_Shop::Skill_Gold_Cost.has_key?(skill_id) ?
    Skill_Shop::Skill_Gold_Cost[skill_id] : Skill_Shop::Default_Skill_Gold_Cost
    $game_party.lose_gold(cost)
    end
    # Lose Skill Points
    if Skill_Shop::Spend_Skill_Points
    cost = Skill_Shop::Skill_Point_Cost.has_key?(skill_id) ?
    Skill_Shop::Skill_Point_Cost[skill_id] : Skill_Shop::Default_SP_Cost
    @actor.skill_shop_points -= cost
    end
    # Learn Skill
    @actor.learn_shop_skill(skill_id)
    # Refresh Windows
    @skill_list_window.refresh
    @skill_cost_window.refresh(@skill_list_window.skill_id)
    @skill_data_window.refresh(@skill_list_window.skill_id)
    # Turn On Skill List Window
    @skill_list_window.active = true
    # Turns Off Confirmation Window
    @confirmation_window.visible = @confirmation_window.active = false
    # Gets Skill Name
    skill_name = $data_skills[@skill_list_window.skill_id].name
    # Updates Help Text
    @help_window.set_text("#{@actor.name} ha imparato #{skill_name}!", 1)
    end
    end
    end

     

    Le Istruzioni sono in inglese e se qualcuno mi spiegasse come funziona e dove mettere le stringhe per gli incantesimi da vendere mi farebbe un piacere...(ho capito solo che per richiamarlo bisogna fare Call Script e metterci:

    $scene = 
    Scene_SkillShop.new(actor_index)

  3. Scusate se uppo un topic vecchio ma,al codice per richiamare lo script,cosa si deve mettere in velocità cursore?e morte e fuga vanno bne così: morte = false fuga = false ???.gli etc.. si devono levare???e in forza pesce cosa va???

    Io ho fatto così : Scene_Fishing.new(3,[2,3],[1,32,33],1) ma non mi parte,dove sbaglio?

×
×
  • Create New...