Chasseur41
Nombre de messages : 21 Age : 31 Localisation : Vendôme (41) et Tours (37) Emploi : Collégiens (3ème) Loisirs : Création de jeu, musique, livre et sortit Date d'inscription : 03/07/2007
| Sujet: Alchimie (part.2) Mer 4 Juil - 19:11 | |
| A la suite de l'ancien script, en ne laissant aucun n'éspace entre les deux sinnon sa ne marche pas.
# ● Création de la fenêtre # recipe : Liste des recettes #-------------------------------------------------------------------------- def initialize(recipe) super(0, 0, 200, 480) @commands = recipe @item_max = recipe.size self.contents = Bitmap.new(width - 32, self.height - 32) self.contents.font.name = 'Monotype Corsiva' self.contents.font.size = 20 refresh self.index = 0 end #-------------------------------------------------------------------------- # ● Affichage #-------------------------------------------------------------------------- def refresh self.contents.clear for i in [email]0...@item_max[/email] draw_recipe(i) end end #-------------------------------------------------------------------------- # ● Fonction d'affichage # index : Position de la recette #-------------------------------------------------------------------------- def draw_recipe(index) recipe = @commands[index] rect = Rect.new(4, 32 * index, self.contents.width - 8, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.draw_text(rect, $data_items[recipe].name) end end class Scene_Recipe #-------------------------------------------------------------------------- # ● Principal #-------------------------------------------------------------------------- def main @spriteset = Spriteset_Map.new @recipe = [] for i in 1..$data_items.size if ($game_party.item_number(i) > 0) and ($data_items[i].element_set[0] == 20) @recipe.push(i) end end @select_window = Window_AlSelect.new(@recipe) @recipe_window = Window_AlRecipe.new @select_window.active = true @select_window.index = 0 if @recipe.size == 0 @select_window.index = -1 end @select_window.opacity = 190 @recipe_window.opacity = 190 Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @spriteset.dispose @select_window.dispose @recipe_window.dispose end #-------------------------------------------------------------------------- # ● Mise à jour #-------------------------------------------------------------------------- def update @select_window.update @recipe_window.update(@recipe, @select_window.index) if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Alchimie.new end end end class Scene_Alchimie #-------------------------------------------------------------------------- # ● Principal #-------------------------------------------------------------------------- def main @spriteset = Spriteset_Map.new @items = [] @recipe = [] for i in 1...$data_items.size if ($game_party.item_number(i) > 0) and ($data_items[i].element_set[0] != 20) @items.push(i) end end for i in 1..$data_items.size if ($game_party.item_number(i) > 0) and ($data_items[i].element_set[0] == 20) @recipe.push(i) end end @itemA_window = Window_AlItem.new(@items, 40) @itemB_window = Window_AlItem.new(@items, 230) @itemC_window = Window_AlItem.new(@items, 420) @res_window = Window_AlRes.new @command_window = Window_Command.new(200, ["Créer un objet", "Consulter les recettes", "Annuler"]) @itemA_window.opacity = 190 @itemB_window.opacity = 190 @itemC_window.opacity = 190 @res_window.opacity = 190 @command_window.opacity = 190 @itemA_window.visible = false @itemB_window.visible = false @itemC_window.visible = false @res_window.visible = false @itemA_window.active = false @itemC_window.active = false @itemB_window.active = false @command_window.active = true @command_window.index = 0 @command_window.x = 220 @command_window.y = 180 Graphics.transition loop do Graphics.update Input.update if (@items.size == 0) or (@recipe.size == 0) @command_window.disable_item(0) end update if $scene != self break end end Graphics.freeze @spriteset.dispose @itemA_window.dispose @itemB_window.dispose @itemC_window.dispose @res_window.dispose @command_window.dispose end #-------------------------------------------------------------------------- # ● Mise à jour #-------------------------------------------------------------------------- def update @command_window.update @itemA_window.update @itemB_window.update @itemC_window.update if @command_window.active update_command return end if @itemA_window.active update_itemA return end if @itemB_window.active update_itemB return end if @itemC_window.active update_itemC return end if @res_window.visible if Input.trigger?(Input::C) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new end return end end #-------------------------------------------------------------------------- # ● Mise à jour : Menu de commande #-------------------------------------------------------------------------- def update_command if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) case @command_window.index when 0 if (@items.size == 0) or (@recipe.size == 0) $game_system.se_play($data_system.buzzer_se) else @command_window.visible = false @itemA_window.visible = true @itemB_window.visible = true @itemC_window.visible = true @command_window.active = false @itemA_window.active = true @itemA_window.index = 0 @itemB_window.index = -1 @itemC_window.index = -1 end when 1 $scene = Scene_Recipe.new when 2 $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new end end end #-------------------------------------------------------------------------- # ● Mise à jour : ItemA #-------------------------------------------------------------------------- def update_itemA if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @itemA_window.visible = false @itemB_window.visible = false @itemC_window.visible = false @itemA_window.active = false @itemC_window.active = false @itemB_window.active = false @command_window.visible = true @command_window.active = true @command_window.index = 0 end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @itemA_window.lose(@itemA_window.index) @newb = [] for i in 1...$data_items.size if ($game_party.item_number(i) > 0) and ($data_items[i].element_set[0] != 20) @newb.push(i) end end @itemB_window.update_qty(@newb) @itemC_window.update_qty(@newb) @itemA_window.active = false @itemB_window.active = true @itemB_window.index = 0 end end #-------------------------------------------------------------------------- # ● Mise à jour : ItemB #-------------------------------------------------------------------------- def update_itemB if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @itemA_window.gain(@itemA_window.index) @newb = [] for i in 1...$data_items.size if ($game_party.item_number(i) > 0) and ($data_items[i].element_set[0] != 20) @newb.push(i) end end @itemB_window.update_qty(@newb) @itemC_window.update_qty(@newb) @itemB_window.active = false @itemA_window.active = true @itemA_window.index = 0 @itemB_window.index = -1 end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @itemB_window.lose(@itemB_window.index) @newc = [] for i in 1...$data_items.size if ($game_party.item_number(i) > 0) and ($data_items[i].element_set[0] != 20) @newc.push(i) end end @itemC_window.update_qty(@newc) @itemB_window.active = false @itemC_window.active = true @itemC_window.index = 0 end end #-------------------------------------------------------------------------- # ● Mise à jour : ItemC #-------------------------------------------------------------------------- def update_itemC if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @itemB_window.gain(@itemB_window.index) @newc = [] for i in 1...$data_items.size if ($game_party.item_number(i) > 0) and ($data_items[i].element_set[0] != 20) @newc.push(i) end end @itemC_window.update_qty(@newc) @itemC_window.active = false @itemB_window.active = true @itemB_window.index = 0 @itemC_window.index = -1 end if Input.trigger?(Input::C) @itemC_window.lose(@itemC_window.index) @itemC_window.active = false @res_window.visible = true @itemA_window.visible = false @itemB_window.visible = false @itemC_window.visible = false inga = @items[@itemA_window.index] ingb = @newb[@itemB_window.index] ingc = @newc[@itemC_window.index] @res_window.make(inga, ingb, ingc) end end end
Pour pouvoir l'utilisez, créer un nouvel évenement puis insérez-y ce script: $scene = Scene_Alchimie.new | |
|