Alessandro_Trigger Administrador
Número de Mensagens : 207 Data de inscrição : 15/03/2009 Idade : 30
Mochila -: Mensagem do Membro: RPG lab! RPG não é hobbie...é um estilo de vida!
| Assunto: [Script VX] v 1.0.1 Loja de Habilidades - Por LB Sáb Mar 28, 2009 12:42 pm | |
| Olá pessoal, estou aqui disponibilizando este script de Loja de Habilidades. Créditos à: Lb - Reino Rpg - Por criar o script. Admin - Por disponibilizá-lo aqui. Função:Cria uma loja em que pode-se comprar magias para os personagens Incompactilidade:Desconhecido Instalação:Colocar o script acima de main. Configuração no inicio. Para ativar use: - Código:
-
$scene = Scene_Magics.new Imagem:- Spoiler:
- Código:
-
########################################################### ################### COMPRA DE MAGIAS ###################### #### V 1.0.1 ############################################## ################################### Por: LB ############### ########################################################### ##################### www.ReinoRpg.com #################### ###########################################################
module Refiner Grupos_mags = [] Grupos_g = [] # ---------------------------------------------------- # ID das magias que fazem parte dos grupos: # Max = 15 por grupo # Grupos_mags[ID DO HEROI] = [MAGIAS] Grupos_mags[1] = [1,2,3,4,5] Grupos_mags[2] = [6,7,8,9,10] Grupos_mags[3] = [11,12,13] Grupos_mags[4] = [14,15,16,17,18,19,20,21,22,23] # ---------------------------------------------------- # Preço das habilidades # Deve seguir a mesma ordem do "Grupos_mags". # Grupos_g[ID DO HEROI] = [VALORES] Grupos_g[1] = [5000,500,500,500,500] Grupos_g[2] = [500,500,5000,500,500] Grupos_g[3] = [500,500,5000] Grupos_g[4] = [500,500,500,500,500,500,500,500,500,500] # ---------------------------------------------------- # # FIM DAS CONFIGURAÇÕES - INICIO DO SCRIP # # ---------------------------------------------------- # end class Game_Party < Game_Unit attr_reader:actors end class Scene_Magics < Scene_Base def start super create_menu_background start_vars @grupo_window = Window_Command.new(160, @pers_names) @grupo_window.x = 5 @grupo_window.y = 5 @gold_window = Window_Gold.new(5,(@pers_names.size * 24 + 42)) @equips_window = Window_Command.new(160, [""]) @equips_window.visible = false @equips_window.active = false @confirm_window = Window_Confirm.new @confirm_window.x = 5 @confirm_window.y = 331 @confirm_op_window = Window_Command.new(75, ["Sim","Não"]) @confirm_op_window.x = 90 @confirm_op_window.y = 331 @confirm_op_window.opacity = 0 @confirm_window.visible = false @confirm_op_window.visible = false @confirm_op_window.active = false @confirm_op_window.index = 1 end def start_vars @groups_names = [] @groups_icons = [] @groups_value = [] @groups_ids = [] @pers_names = [] @pers_ids = [] for a in 0...$game_party.members.size b = $game_party.actors[a] @groups_names[b] = [] @groups_icons[b] = [] @groups_value[b] = [] @groups_ids[b] = [] @pers_names[a] = $game_actors[b].name @pers_ids[a] = b for i in 0...Refiner::Grupos_mags[b].size id = Refiner::Grupos_mags[b][i] @groups_names[b][i] = $data_skills[id].name @groups_icons[b][i] = $data_skills[id].icon_index @groups_value[b][i] = Refiner::Grupos_g[b][i] @groups_ids[b][i] = id end end end def terminate super dispose_menu_background @equips_window.dispose @grupo_window.dispose @confirm_op_window.dispose @confirm_window.dispose @gold_window.dispose end def update super update_menu_background @equips_window.update @grupo_window.update @gold_window.update @confirm_op_window.update @confirm_window.update if @grupo_window.active == true grupo_update elsif @equips_window.active == true equips_update elsif @confirm_window.visible == true confirm_update end end def confirm_update if Input.trigger?(Input::B) Sound.play_cancel un_active elsif Input.trigger?(Input::C) case @confirm_op_window.index when 0 Sound.play_decision refinar un_active @icon_window.dispose desactive_options @confirm_op_window.index = 1 when 1 Sound.play_cancel un_active end end end def refinar per = @pers_ids[@grupo_window.index] $game_party.lose_gold(@groups_value[per][@equips_window.index]) $game_actors[per].learn_skill(@groups_ids[per][@equips_window.index]) @gold_window.refresh end def un_active @confirm_window.visible = false @confirm_op_window.visible = false @confirm_op_window.active = false @equips_window.active = true @confirm_window.contents.clear @confirm_window.contents.draw_text(0, 0, 80, 24, "Confirma?") end def equips_update if Input.trigger?(Input::B) Sound.play_cancel @equips_window.visible = false @equips_window.active = false @grupo_window.active = true @icon_window.dispose end if Input.trigger?(Input::C) Sound.play_decision trocar end end def grupo_update if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) Sound.play_decision @equips_window.dispose @equips_window = Window_Command2.new(369, @groups_names[@pers_ids[@grupo_window.index]]) @equips_window.x = 170 @equips_window.y = 5 @grupo_window.active = false desactive_options end end def desactive_options @troc = [] @icon_window = Window_Icon.new @icon_window.opacity = 0 x = 0 y = -24 id = @pers_ids[@grupo_window.index] for a in 0...@groups_ids[id].size v = @groups_value[id][a] if v == nil v = 0 end if $game_party.gold < v @equips_window.draw_item(a, false) @troc[a] = false else @troc[a] = true end y = y + 24 icon = @groups_icons[id][a] @icon_window.draw_icon(icon, x, y, @troc[a]) @icon_window.draw_currency_value(@groups_value[id][a].to_s, x + 250, y, 80, @troc[a]) end end def trocar if @troc[@equips_window.index] == false Sound.play_cancel @confirm_window.visible = true @equips_window.active = false @confirm_window.contents.clear @confirm_window.contents.draw_text(0, 0, 130, 24, "Você não tem di-") @confirm_window.contents.draw_text(0, 24, 130, 24, "nheiro suficiente") else @confirm_window.visible = true @confirm_op_window.visible = true @confirm_op_window.active = true @equips_window.active = false end end end class Window_Confirm < Window_Base def initialize super (0, 0, 160, WLH * 2 + 32) self.contents.draw_text(0, 0, 80, 24, "Confirma?") end end class Window_Icon < Window_Base def initialize super (170, 5, 369, WLH * 14 + 32) end end class Window_Command2 < Window_Selectable attr_reader:commands def initialize(width, commands) super(0, 0, width, commands.size * WLH + 32, 32) @commands = commands @item_max = commands.size refresh self.index = 0 end def refresh self.contents.clear for i in 0...@item_max draw_item(i) end end def draw_item(index, enabled = true) rect = item_rect(index) rect.x += 30 rect.width -= 8 self.contents.clear_rect(rect) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(rect, @commands[index]) end end class Window_Base < Window def draw_currency_value(value, x, y, width, enabled = true) cx = contents.text_size(Vocab::gold).width self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x, y, width-cx-2, WLH, value, 2) self.contents.font.color = system_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x, y, width, WLH, Vocab::gold, 2) end end
Scripts RGSS2 for RPG Maker VX by LB is licensed under a Creative Commons Atribuição-Uso Não-Comercial-Compartilhamento pela mesma Licença 2.5 Brasil License.Permissions beyond the scope of this license may be available at ReinoRPG.comAté! | |
|