Belxebu Posted January 6, 2008 Share Posted January 6, 2008 (edited) 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) Edited January 12, 2008 by Belxebu Link to comment Share on other sites More sharing options...
Artia Posted January 6, 2008 Share Posted January 6, 2008 #================================================================ # ** Skill Shop #------------------------------------------------------------------------------ # SephirothSpawn # 2006-04-06 # Version 1 #------------------------------------------------------------------------------ # * Istruzioni: # # ~ Acquisire Skill Points: # - $game_party.actors[actor_index].skill_shop_points +-*/= x # Oppure # - $game_actors[actor_id].skill_shop_points +-*/= x # # ~ Settare le skill acquisibili # - $game_temp.skill_shop_skills[actor_id] = [skill_id, ... ] # Oppure # - $game_temp.skill_shop_skills[actor_id] = nil # - $game_temp.skill_shop_skills[0] = [skill_id, ...] # (0 è usato come default. Qualsiasi ID di personaggio non settato acquisirà questa lista di skill) # # ~ Chiamare lo skill shop # - $scene = Scene_SkillShop.new(actor_index) # # ~ Cambiare personaggio nella scena dello skill shop # - Press L or R #------------------------------------------------------------------------------ # * Customizzazione : # # ~ Tipo di acquisto (Deve usare 1, Può usare 2) # - Spend_Gold = true (On) or false (Off) # - Spend_Skill_Points = true (On) or false (Off) # # ~ Costo delle skill # - Costo in oro # Skill_Gold_Cost = { skill_id => cost, ... } # - Costo in skill point # Skill_Point_Cost = { skill_id => cost, ... } # # ~ Requisiti dei personaggi # - Actor_Requirements = { skill_id => [actor_id, ...], ... } # # ~ Requisiti livello # - Level_Requirements = { skill_id => req_level, ... } # # ~ Requisiti di skill precedenti # - Previous_Skill_Requirments = { skill_id => [req_skill, ...], ... } #============================================================================== Tradotte le istruzioni, ora dovrebbe essere più comprensibile. Per qualsiasi cosa chiedete pure che io l'ho capito come va settato ^^ Link to comment Share on other sites More sharing options...
Belxebu Posted January 7, 2008 Author Share Posted January 7, 2008 Allora come funziona?Come si inseriscono nuove magie ecc ecc??? Link to comment Share on other sites More sharing options...
Artia Posted January 7, 2008 Share Posted January 7, 2008 Mizzica c'è scritto nella testa dello script... spè che spiego meglio va ~ Acquisire Skill Points: # - $game_party.actors[actor_index].skill_shop_points +-*/= x Con questo comando, che va richiamato dall'evento con Script Call si possono aggiungere o sottrarre Skill Point (che servono a comprare le skill) Ad un personaggio. al posto di Actor_index ci va l'id del personaggio ~ Settare le skill acquisibili # - $game_temp.skill_shop_skills[actor_id] = [skill_id, ... ] # Oppure # - $game_temp.skill_shop_skills[actor_id] = nil # - $game_temp.skill_shop_skills[0] = [skill_id, ...] # (0 è usato come default. Qualsiasi ID di personaggio non settato acquisirà questa lista di skill) Questo pezzo di codice credo sia abbastanza chiaro. con $game_temp.skill_shop_skills[actor_id] = [skill_id, ... ] si impostano le skill (Skill_id) acquistabili da un determinato personaggio [actor_id]Se actor id viene lasciato 0 tutti i personaggi che non hanno un elenco specificato potranno acquistare quelle skill] ~ Chiamare lo skill shop # - $scene = Scene_SkillShop.new(actor_index) Questo pezzo parla da sè... copiate questo in Script Call da un evento e chiama la scena shop La seconda parte delle opzioni non c'è niente da spiegare, basta vedere le righe successive e copiare la sintassi, mettendo id e requisiti che si vuole. Link to comment Share on other sites More sharing options...
Belxebu Posted January 7, 2008 Author Share Posted January 7, 2008 si,ma quelli sono nelle instruzioni,a quali righe dello script corrispondono(e per mettere piu di una magia si mette l'elsif?? Link to comment Share on other sites More sharing options...
Artia Posted January 8, 2008 Share Posted January 8, 2008 tutto ciò che ho spiegato con i tag spoiler va fatto in call script, per settare quali skill sono vendibili dal negozio. Link to comment Share on other sites More sharing options...
Belxebu Posted January 8, 2008 Author Share Posted January 8, 2008 io ho inserito in un call script questo: $scene = Scene_SkillShop.new(actor_index) $game_temp.skill_shop_skills[1] = [069, 070] $game_party.actors[1].skill_shop_point s +-*/= x ma mi da SyntaxError(errore di sintassi.Dove sbaglio?) Link to comment Share on other sites More sharing options...
Artia Posted January 8, 2008 Share Posted January 8, 2008 +-*/=X... non puoi moltiplicare, sottrarre, aggiungere e dividere una X devimettere sono un segno (+, -, *, /) e un valore al posto di X. Inoltre credo che tu debba prima stabilire le variabili, poi chiamare la scene_skillshop Link to comment Share on other sites More sharing options...
Belxebu Posted January 9, 2008 Author Share Posted January 9, 2008 Non ho capito lo stesso ma siccome mi sono stufato di provare e riprovare mi sonof atto il tutto in eventi.Credo sia anche meglio :) grazie per la pazienza. Link to comment Share on other sites More sharing options...
nihil-omen Posted February 2, 2009 Share Posted February 2, 2009 Uhm... scusatemi ma io dovrei impostare le magie da poter apprendere in base alla classe e non in base all'ID dei pgpoichè i pg possono cambiare classe [dimenticando tutte le vecchie skill apprese].Si può fare? Se si come? http://i30.tinypic.com/xehois.gif} 2rA - web site {E' disponibile il primo capitolo completo di 2rA!} 2rA: Capitolo I { Link to comment Share on other sites More sharing options...
Tribe X Posted February 5, 2009 Share Posted February 5, 2009 è se io volessi far imparare certe Skill solo se possiedo nell'inventario un certo oggetto (ti se hai oggetto A puoi imparare skill A, skill B e cosi via!)? e per togliere il prezzo in skill point o in denaro? TRIBE X: MEMBRO FONDATORE DEL DIGITADREAM PROJECTProgetti in corso:ERTHIA - THE LOST DIMENSIONProgetti in sospeso (Da riprendere al più presto):ARKANA CHRONICLESPS: Cercasi Scripter da includere nel team! Link to comment Share on other sites More sharing options...
nihil-omen Posted February 6, 2009 Share Posted February 6, 2009 Vabè ho provato a smanettarci ed ho messo un evento che setta le skill acquisibili dal pg 1 , uno che apre lo shop e uno che aggiunge 5 skill points al pg 1... Mi da problemi l'evento che da i 5 punti...Ci ho scritto (nel Call Script)$game_actors[1].skill_shop_points += 5 E mi appare la finestra di errore che dice: NoMethodError occurred while running script.Undefined method "skill_shop_points" for [1]:Array [Ho provato anche a togliere l'uguale eh, ma mi da sempre lo stesso errore] Dove sbaglio? XD http://i30.tinypic.com/xehois.gif} 2rA - web site {E' disponibile il primo capitolo completo di 2rA!} 2rA: Capitolo I { Link to comment Share on other sites More sharing options...
giver Posted February 6, 2009 Share Posted February 6, 2009 Quando si usa una call script, se un'istruzione è più lunga di una linea, non bisogna sfruttare la capo automatico perchè la spezzetta spesso e volentieri in modo sbagliato . . .Bisogna andare a capo manualmente, seguendo una serie di criteri particolari, tra cui i seguenti: dopo una virgola, dopo un operatore (+=, -=, =, and, or, not, eccetera), dopo una parentesi aperta, dopo un punto . . . Es. potresti riscriverla così$game_actors[1]. skill_shop_points += 5 SCRIPT RGSS (RPG Maker XP) VINTAGE LIBRARY [2018+]http://www.rpg2s.net/forum/index.php/topic/21892-vintagevisualsrewrite-enhanced-revised-victory-screen-v-35-da-autori-vari-a-giver/ http://www.rpg2s.net/forum/index.php/topic/21868-eventing-utility-simple-last-battle-events-fix-v-30-by-giver/ http://www.rpg2s.net/forum/index.php/topic/21853-vintagerewrite-constance-menu-per-4-personaggi-da-team-constance-a-giver/ http://www.rpg2s.net/forum/index.php/topic/22126-vintagedoveroso-necroedit-dummy-title-22u-update-per-crearlo-ad-eventi-su-mappa-by-giver/ http://www.rpg2s.net/forum/index.php/topic/22127-vintagevisuals-tale-chapters-save-system-20-by-giver/ Breaking (in ogni senso) News: "Treno deraglia per via del seno di Sakurai Aoi . . ." - Info nello spoiler !! http://afantasymachine.altervista.org/_altervista_ht/NOOOOOOOOOilMIOtreninooooo_500.gifNon riesco a smettere di essere affascinato da immagini come questa . . .http://anime.vl-vostok.ru/art/photos2011/17/78049800/wall_VladAnime_WWA_1885-1680x1050.jpgAlcuni wallpapers che faccio ruotare sul mio vecchio PC . . .http://afantasymachine.altervista.org/_altervista_ht/gits_window.jpghttp://afantasymachine.altervista.org/_altervista_ht/madoka_group01.jpghttp://afantasymachine.altervista.org/_altervista_ht/arisu_picipici_01.jpghttp://afantasymachine.altervista.org/_altervista_ht/phantom_wp01_einzwei.jpg La parte più spassosa della mia vita è quando gli altri cercano di spiegarmi i miei pensieri . . . BBCode TestingTypeface & Size Link to comment Share on other sites More sharing options...
nihil-omen Posted February 6, 2009 Share Posted February 6, 2009 Ah ok tencs ^^ Però ora ho un altro problema T___T Visto che non voglio che ci si spendano gold ho messo a Gold Cost = false (come scritto nelle istruzioni) solo che poi mi dà errore alla riga 338 T_____T Che devo fare ora? http://i30.tinypic.com/xehois.gif} 2rA - web site {E' disponibile il primo capitolo completo di 2rA!} 2rA: Capitolo I { Link to comment Share on other sites More sharing options...
EvilSeep Posted May 26, 2009 Share Posted May 26, 2009 porto in alto questo topic scusate...ma ho riscontrato un problema nello script Shop Skill(quello con i Punti GP).In pratica non mi fa usare le magie in battaglia...come mai? huh.gif SEEP Universe su Steam:http://cdn.akamai.steamstatic.com/steam/apps/383630/capsule_184x69.jpg?t=1436537417 SEEP Universe: http://www.seepuniverse.com/ (Sito ufficiale) Blogging, dev log e vecchi progetti:SEEP Blog: http://www.seeproduction.blogspot.ie/ (DOWNLOAD dei nostri progetti)SEEP Bar: http://seepbar.blogspot.it/ (il bar viruale dove parlare di retrogaming e giochi indie) Link to comment Share on other sites More sharing options...
AegisSoul Posted January 9, 2011 Share Posted January 9, 2011 Buongiorno a tutti (quelli che leggeranno il messaggio), mi chiamo Walter e sono nuovo del forum (nuovo intendo come appena registrato, ma è più di una settimana che sbircio le vostre vecchie conversazioni alla fine di ricercare info utili per quanto rigurda gli script di rmxp. Utilizzare un post non generico per presentarsi non è il massimo dell'educazione, me ne rendo conto, ma di solito preferisco passare in sordina, quindi ho allestito un benvenuto alla bell'e meglio qui.. non vogliatemene.. :p Passando al punto della questione, volevo riportare all'attenzione di chi ne sa, questo topic, poichè anch'io (come quelli sopra) riscontro un problema nella costumizzazione dello script. Premetto che non sono uno scripter, ma prima di rompere le scatole a chicchessia cerco di risolvermi i problemi da solo e di farmi del male fisico e morale ricercando e assimilando quanto più dalle fonti in mio possesso. (evidentemente non ho fatto un buon lavoro =_=") Il problema è che questo script mi è utile per un progettino di gioco (tanto semplice, così per passare il tempo) ma volevo apportare qualche modifica tipo abbassare il costo degli Skill Points ed eliminare il costo in Gold. Ecco, già mettendo "false" alla riga: module Skill_Shop#--------------------------------------------------------------------------# * Purchasing Types#--------------------------------------------------------------------------Spend_Gold = falseSpend_Skill_Points = true#--------------------------------------------------------------------------# * Skill Cost# ~ Skill_Gold_Cost = { skill_id => cost, ... }# ~ Skill_Point_Cost = { skill_id => cost, ... }#--------------------------------------------------------------------------Default_Skill_Gold_Cost = 500Skill_Gold_Cost = {}Default_SP_Cost = 500Skill_Point_Cost = {} Mi da errore sulla parte del refresh alla riga: sp = @actor.skill_shop_points - Skill_Shop::Skill_Point_Cost.has_key?(skill_id) ? Mi dice "false can't be coerced into fixnum". Premetto che ho provato a smanettare sino al punto di dover ricopiare il codice originale perchè mi ero perso, e aggiungendo che non ho altri script a creare conflitti (ho solo quelli standard di rpg maker xp), non so davvero più dove sbattere la testa. Non è vitale una risposta o una soluzione, ma almeno chiedendo a voi che ve la cavate, so di aver tentato tutto. Grazie in anticipo per chi si prenderà la briga di rispondermi. :) Link to comment Share on other sites More sharing options...
Pokèmaker Posted February 14, 2011 Share Posted February 14, 2011 Un'idea carina sarebbe far pagare tanti G quanti sono gli Sp da usare per castare la skill per comprarla Il mio sito: gemini://zekromaster.net (Mirror HTTP) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now