Intanto posto lo script:
Spoiler
#=============================================================================== # Tales of Dishes(Abyss) ver 12.1 # by Oz # # I made to try to blame the script's proposed food # Combined with previously made scripts that are not food # In which one or the other please # The method of implementation is the same as the # previous script, KGC Custom Menu Command # Place below this script # Here the whole party can only have finished food items # be effective once per battle # Food item information placed in notes # # TL NOTE: "cooknote", "addstate" and "recovery" are translated script terms # "Cooknote" was originally "Additional Material" but that's a bit to hefty # # use [cooknote] ~ [/cooknote] to define dishes # [cooknote] # materials = 43 # addstate = 9,10 # effect = MPrecovery+1% # [/cooknote] # In this case the cooknote (Item ID: 43) by adding # Increasing the amount of state MPrecovery 1% # Adding State ID: 9,10 to all party members # # You can define special cases by Actor ID when cooking # more than one level 3 # [cooknote] # actor = 1 # level = 3 # materials = RICE # effect = HPrecovery+20% # [/cooknote] # RICE CLASS are registered in the cooknote you specify will be 57,60 # In addition to the default effect of this cooknote by adding either one # HPrecovery 20% more weight # In such a feeling to describe, by adding items to the specified ID # Larger than the effect # # When setting the maximum level of learning [ACTOR (actor ID): MAX x] # This dish is an actor with the specified ID x is the maximum skill # NEXT_EXP has become the default number of elements. # Increasing the maximum value can be changed NEXT_EXP elements # Also, every skill cooknote'm not at most one more Yarenaku, noodles Sounaruto d (ry # I have no words to be switched. # Way function, the data referring to the Abyss # Have not played Abyss (Roar # Later, Luke likes and dislikes too much=end #=============================================================================== module COOKING #Here we define the creatable Dish Item IDs DISHES = [ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79 ] #Ingredient group classifications #All ingredients need not be described here MEAT = [21, 22, 23, 24, 25, 26] FISH = [27, 28, 29, 30, 31, 32, 33, 34] VEGETABLE = [35, 36, 37, 38, 39, 40, 41, 42] FRUIT = [43, 44, 45, 46, 47] RICE = [48, 51] BREAD = [49, 52] PASTA = [50, 53] #Language used to classify the material #Item classifications can be registered here. CLASS = { "MEAT"=>MEAT,"FISH"=>FISH,"VEGETABLE"=>VEGETABLE,"FRUIT"=>FRUIT, "RICE"=>RICE,"BREAD"=>BREAD,"PASTA"=>PASTA } #Add Material in the notes databases you specify MEAT #MEAT will be what they register as #Recipes #Describe the necessary ingredients to make food RECIPE = [] #Do Not Touch #Example Recipe Item ID:69 can be made with any Grain material #if you have more relevant ingredients, consumption is determined at random RECIPE[60] = [RICE] RECIPE[61] = [PASTA] RECIPE[62] = [BREAD] RECIPE[63] = [MEAT] RECIPE[64] = [RICE] RECIPE[65] = [PASTA,57] RECIPE[66] = [BREAD,58] RECIPE[67] = [VEGETABLE,35] RECIPE[68] = [RICE,37] RECIPE[69] = [PASTA,57] RECIPE[70] = [BREAD,54,55] RECIPE[71] = [RICE,54] RECIPE[72] = [RICE,FISH] RECIPE[73] = [PASTA,57] RECIPE[74] = [BREAD,55] RECIPE[75] = [36,37] RECIPE[76] = [MEAT,55,58,37] RECIPE[77] = [FRUIT,FRUIT,FRUIT,55] RECIPE[78] = [36,47,38,41] RECIPE[79] = [39,54,57,59] #The experience needed for next level Default_Next_EXP = [100,200,300,400,500] # Define the experience necessary for each actor to reach the next level Next_EXP = [] # Do Not Touch # Actor ID[1] default requires 120,240,360,480,600 experience for each level. Next_EXP[1] = [120,240,360,480,600] # Success rate for each level Default_Success = [50,60,70,85,95,99] # Set the success rate for each actor Success = [] # Do Not Touch #Actor ID[1] default success rates 30,40,50,60,70,80 Success[1] = [30,40,50,60,70,80] #Random Item ID chosen to be created on a failure Default_Failure = [80,81,82,83,84,85] #Set for each actor Failure = [] # Do Not Touch #Actor ID[1]:Failure hash defined by actor Failure[1] = [80,81,82] # Text icons to display the current level of learning LEVEL = ["","★","★★","★★★","★★★★","★★★★★"] #アクター毎に覚えることのできない料理を設定する ACTOR_CANT_LEARN = [] #ACTOR_CANT_LEARN[1] = [0,1] でID:1のキャラは、 #料理番号の0と1を覚えることはできません ACTOR_CANT_LEARN[1] = [0,1] #Success Dialogue #When cooking is successfull display "☆ Success! ☆" Default_Success_Message = "☆ Success! ☆" #Set Each Actor's Success message. Success_Message = [] #Actor ID[1]: "I did it!" Success_Message[1] = "I did it!" #Play SE on Success SUCCESS_SE = "Chime2" #Gain EXP on Success SUCCESS_EXP = 30 #Failure Dialaogue # When cooking is a failure display "Better luck next time..." Default_Failure_Message = "Better luck next time..." #Set for each Actor Failure_Message = [] #Actor ID[1]: "I failed..." Failure_Message[1] = "I failed..." #Play SE on Failure FAILURE_SE = "Down" #Gaine EXP on Failure FAILURE_EXP = 10 #Set to True to Display messages. MESSAGE_FLAG = false #Display in menu COOK = "Cooking" #Place Menu command before Menu option (4) [May not be compatible with all Custom Menu Systems] COMMAND_COOK = 4 #Display message when trying to make multiple recipes. NO_MORE_EAT = "You can't eat anymore \n. Please digest and continue fighting" #To display message for Food effects set to True EFFECT_MESSAGE_FLAG = true #Cooking (with sound effects), or in the message? Now_Cooking = true #Display Message when cooking Now_Cooking_Message = "Now Cooking..." #Cooking time (in frames) Now_Cooking_Wait = 50 #Play SE when Cooking Now_Cooking_SE = "Earth9" #Assigned variable for actors made food Cooking_Actor_Variable = 1 #Assigned variable for dish success Cooking_Dish_Variable = 2 end #=============================================================================== # ■ COOKING::Regexp #=============================================================================== module COOKING module Regexp #料理のcooknote設定 定義開始 ADD_MATERIAL = /\[(?:ADD\s*MATERIALS|cooknote)\]/i #料理のcooknote設定 定義終了 END_MATERIAL = /\[\/(?:ADD\s*MATERIALS|cooknote)\]/i #cooknote MATERIALS = /(?:MATERIALS|材料)\s*(?:=|\=)\s*(\w+)/i #アクター指定 ACTOR = /(?:ACTOR|アクター)\s*(?:=|\=)\s*(\d+)/i #レベル指定 LEVEL = /(?:LEVEL|レベル)\s*(?:=|\=)\s*(\d+)/i #効果指定 EFFECT = /(?:EFFECT|効果)\s*(?:=|\=)\s*((?:HP|HP)recovery|(?:MP|MP)recovery|(?:HPMP|HPMP)recovery)\s*(?:\+|+)(\d+)(?:\%|%)/i #addstate ADD_STATE = /(?:ADD\s*STATE|addstate)\s*(?:=|\=)\s*([\d\,]+)/i #ステート解除 REMOVE_STATE = /(?:REMOVE\sSTATE|ステート解除)\s*(?:=|\=)\s*([\d\,])+/i #アクター毎の料理の最大レベル ACTOR_COOKING_MAX_LV = /\[ACTOR\s*(\d+)\:MAX\s*(\d+)\]/i end end #=============================================================================== # ■ Vocab #=============================================================================== module Vocab #メニュー項目 def self.cookingform return COOKING::COOK end #連続で料理しようとしたときのメッセージ def self.no_more_eat return COOKING::NO_MORE_EAT end end #=============================================================================== # ■ Sound #=============================================================================== module Sound #料理で成功した時 def self.cooking_success_play Audio.se_play("Audio/SE/" + COOKING::SUCCESS_SE,100,100) end #料理で失敗した時 def self.cooking_failure_play Audio.se_play("Audio/SE/" + COOKING::FAILURE_SE,100,100) end #料理中の効果音 def self.now_cooking_play Audio.se_play("Audio/SE/" + COOKING::Now_Cooking_SE, 100, 100) end end #=============================================================================== # ☐ Command #=============================================================================== module Commands module_function def learn_cooking(cooking_id) for actor in $data_actors $game_actors[actor.id].learn_cooking(cooking_id) end end end class Game_Interpreter include Commands end #============================================================================== # ■ RPG::BaseItem #============================================================================== class RPG::BaseItem #-------------------------------------------------------------------------- # ○ 料理のアクター毎のcooknoteのキャッシュ生成 #-------------------------------------------------------------------------- def create_cooking_add_materials_cache @add_materials = [] @actor_max_level = {} self.note.each{|line| case line when COOKING::Regexp::ADD_MATERIAL @cooking = RPG::Cooking.new when COOKING::Regexp::END_MATERIAL @add_materials << @cooking @cooking = nil when COOKING::Regexp::ACTOR @cooking.actor_id = $1.to_i when COOKING::Regexp::MATERIALS if COOKING::CLASS.include?($1) @cooking.materials = COOKING::CLASS[$1] else $1.scan(/\d+/){|s| @cooking.materials << s.to_i } end when COOKING::Regexp::LEVEL @cooking.level = $1.to_i when COOKING::Regexp::EFFECT @cooking.effect = $1 @cooking.recovery = $2.to_i when COOKING::Regexp::ADD_STATE $1.scan(/\d+/){|s| @cooking.add_state << s.to_i } when COOKING::Regexp::REMOVE_STATE $1.scan(/\d+/){|s| @cooking.recovery_state << s.to_i } when COOKING::Regexp::ACTOR_COOKING_MAX_LV @actor_max_level[$1] = $2 end } end #-------------------------------------------------------------------------- # ● 追加料理の取得 #-------------------------------------------------------------------------- def add_materials create_cooking_add_materials_cache if @add_materials.nil? return @add_materials end #-------------------------------------------------------------------------- # ● アクター毎の最大レベルの取得 #-------------------------------------------------------------------------- def actor_max_level create_cooking_add_materials_cache if @actor_max_level.nil? return @actor_max_level end end #============================================================================== # ■ RPG::Cooking #============================================================================== class RPG::Cooking attr_accessor :materials attr_accessor :actor_id attr_accessor :level attr_accessor :effect attr_accessor :recovery attr_accessor :add_state attr_accessor :recovery_state #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @materials = [] @actor_id = 0 @level = 0 @effect = "" @recovery = 0 @add_state = [] @recovery_state = [] end #-------------------------------------------------------------------------- # ● cooknoteのうち 持っている材料の取得 #-------------------------------------------------------------------------- def has_materials has_materials = [] for material in @materials has_materials << material if $game_party.item_number($data_items[material]) > 0 end return has_materials end #-------------------------------------------------------------------------- # ● HPのrecovery% #-------------------------------------------------------------------------- def hp_recovery_rate recovery_rate = 0 if @effect.upcase.include?("HP") or @effect.upcase.include?("HP") recovery_rate = @recovery end return recovery_rate end #-------------------------------------------------------------------------- # ● HPのrecovery% #-------------------------------------------------------------------------- def mp_recovery_rate recovery_rate = 0 if @effect.upcase.include?("MP") or @effect.upcase.include?("MP") recovery_rate = @recovery end return recovery_rate end end #=============================================================================== # ■ Game_Actor #=============================================================================== class Game_Actor < Game_Battler #----------------------------------------------------------------------------- # ● アクターの料理スキルの初期化 #----------------------------------------------------------------------------- attr_accessor :cooking_level attr_accessor :cooking_next_exp attr_accessor :cooking_enable def cooking_status_clear @cooking_level = [] @cooking_next_exp = [] @cooking_enable = [] COOKING::DISHES.size.times{|i| @cooking_level[i] = 0 if COOKING::Next_EXP[self.id].nil? @cooking_next_exp[i] = COOKING::Default_Next_EXP[0] else next_exp = COOKING::Next_EXP[self.id] @cooking_next_exp[i] = next_exp[0] end @cooking_enable[i] = false } end #----------------------------------------------------------------------------- # ● 料理のレベル #----------------------------------------------------------------------------- def cooking_level create_cooking_status_cache if @cooking_level == nil return @cooking_level end #----------------------------------------------------------------------------- # ● 次のレベルになるための必要経験値 #----------------------------------------------------------------------------- def cooking_next_exp create_cooking_status_cache if @cooking_next_exp == nil return @cooking_next_exp end #----------------------------------------------------------------------------- # ● 料理が作れるか #----------------------------------------------------------------------------- def cooking_enable create_cooking_status_cache if @cooking_enable == nil return @cooking_enable end #-------------------------------------------------------------------------- # ● セットアップ # actor_id : アクター ID #-------------------------------------------------------------------------- alias setup_cooking setup def setup(actor_id) setup_cooking(actor_id) cooking_status_clear end #----------------------------------------------------------------------------- # ● 覚える料理 #----------------------------------------------------------------------------- def learn_cooking(cooking_id) cant_cooking_list = [] cant_cooking_list = COOKING::ACTOR_CANT_LEARN[self.id] unless cant_cooking_list.nil? return if cant_cooking_list.include?(cooking_id) end self.cooking_enable[cooking_id] = true end end #============================================================================== # ■ Game_Temp #============================================================================== class Game_Temp #----------------------------------------------------------------------------- # ○ハッシュの再定義 #----------------------------------------------------------------------------- unless method_defined?(:hushredefine) def hushredefine(list,hash) if list.has_value?(hash) key = list.index(hash) hash+=1 list = hushredefine(list,hash) list[key] = hash end return list end end end #============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler def cooking_effect(hp_recovery,mp_recovery,state_recovery,add_states) for state in state_recovery remove_state(state) @removed_states.push(state) end return if dead? @hp+=hp_recovery @hp = [@hp,maxhp].min @mp+=mp_recovery @mp = [@mp,maxmp].min for state in add_states add_state(state) end end end #============================================================================== # ■ Game_Map #============================================================================== class Game_Map attr_accessor :cooking_flag end #============================================================================== # ■ Window_Command #============================================================================== class Window_Command < Window_Selectable unless method_defined?(:add_command) #-------------------------------------------------------------------------- # ○ コマンドを追加 # 追加した位置を返す #-------------------------------------------------------------------------- def add_command(command) @commands << command @item_max = @commands.size item_index = @item_max - 1 refresh_command draw_item(item_index) return item_index end #-------------------------------------------------------------------------- # ○ コマンドをリフレッシュ #-------------------------------------------------------------------------- def refresh_command buf = self.contents.clone self.height = [self.height, row_max * WLH + 32].max create_contents self.contents.blt(0, 0, buf, buf.rect) buf.dispose end #-------------------------------------------------------------------------- # ○ コマンドを挿入 #-------------------------------------------------------------------------- def insert_command(index, command) @commands.insert(index, command) @item_max = @commands.size refresh_command refresh end #-------------------------------------------------------------------------- # ○ コマンドを削除 #-------------------------------------------------------------------------- def remove_command(command) @commands.delete(command) @item_max = @commands.size refresh end end end #============================================================================== # □ Window_Dishes_Selectable #------------------------------------------------------------------------------ # 料理画面でつくる料理を選択するウィンドウです。 #============================================================================== class Window_Dishes_Selectable < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0,56,160,360) self.z = 2000 self.index = 0 @cooking_dishes_actors = [] refresh end attr_accessor :cooking_dishes_actors #-------------------------------------------------------------------------- # ● ウィンドウ内容の作成 #-------------------------------------------------------------------------- def create_contents self.contents.dispose self.contents = Bitmap.new(width - 32, [height - 32, row_max * (WLH+12)].max) end #-------------------------------------------------------------------------- # ● 先頭の行の取得 #-------------------------------------------------------------------------- def top_row return self.oy / (WLH+12) end #-------------------------------------------------------------------------- # ● 先頭の行の設定 # row : 先頭に表示する行 #-------------------------------------------------------------------------- def top_row=(row) row = 0 if row < 0 row = row_max - 1 if row > row_max - 1 self.oy = row * (WLH+12) end #-------------------------------------------------------------------------- # ● 1 ページに表示できる行数の取得 #-------------------------------------------------------------------------- def page_row_max return (self.height - 32) / (WLH+12) end #-------------------------------------------------------------------------- # ● 項目を描画する矩形の取得 # index : 項目番号 #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.width = (contents.width + @spacing) / @column_max - @spacing rect.height = (WLH+6) rect.x = index % @column_max * (rect.width + @spacing) rect.y = index / @column_max * (WLH+12) return rect end #----------------------------------------------------------------------------- # ● リフレッシュ #----------------------------------------------------------------------------- def refresh @item_max=COOKING::DISHES.size create_contents @item_max.times{|i| draw_item(i) } end #----------------------------------------------------------------------------- # ● 料理名の描画 #----------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) rect.x += 2 rect.width -= 4 member = cooking_can?(index) self.contents.clear_rect(rect) if member.size > 0 rect.x += 24 rect.width -= 24 id = COOKING::DISHES[index] draw_icon($data_items[id].icon_index, rect.x - 24, rect.y + 4, true) self.contents.draw_text(rect, $data_items[id].name, 1) else self.contents.draw_text(rect,"? ? ?",1) end @cooking_dishes_actors[index] = member end #----------------------------------------------------------------------------- # ● 料理をつくることができるのか? #----------------------------------------------------------------------------- def cooking_can?(index) member = [] for actor in $game_party.members next if actor.dead? member << actor if actor.cooking_enable[index] end return member end #-------------------------------------------------------------------------- # ● カーソルの更新 #-------------------------------------------------------------------------- def update_cursor super self.cursor_rect.y+=2 self.cursor_rect.height = WLH end end #=============================================================================== # □ Window_Cooking_Actor #------------------------------------------------------------------------------- # 料理画面でつくるActorを選択するウィンドウです。 #=============================================================================== class Window_Cooking_Actor < Window_Selectable #----------------------------------------------------------------------------- # ● 定数 #----------------------------------------------------------------------------- ACTOR_HEIGHT = 96 #アクター1人分の縦幅 ACTOR_WIDTH = 88 #アクター1人分の横幅 #----------------------------------------------------------------------------- # ● オブジェクト初期化 #----------------------------------------------------------------------------- def initialize super(160,56,248,360) self.z = 2000 @cooking_member = [] @cooking_index = 0 @column_max = 2 self.active = false end #-------------------------------------------------------------------------- # ● ウィンドウ内容の作成 #-------------------------------------------------------------------------- def create_contents self.contents.dispose self.contents = Bitmap.new(width - 32, [height - 32, row_max * (ACTOR_HEIGHT + 12)].max) end #-------------------------------------------------------------------------- # ● 先頭の行の取得 #-------------------------------------------------------------------------- def top_row return self.oy / (ACTOR_HEIGHT + 12) end #-------------------------------------------------------------------------- # ● 先頭の行の設定 # row : 先頭に表示する行 #-------------------------------------------------------------------------- def top_row=(row) super(row) self.oy = self.oy / WLH * (ACTOR_HEIGHT + 12) end #-------------------------------------------------------------------------- # ● 1 ページに表示できる行数の取得 #-------------------------------------------------------------------------- def page_row_max return (self.height - 32) / (ACTOR_HEIGHT + 12) end #-------------------------------------------------------------------------- # ● 項目を描画する矩形の取得 # index : 項目番号 #-------------------------------------------------------------------------- def item_rect(index) rect = super(index) rect.height = ACTOR_HEIGHT rect.width = ACTOR_WIDTH rect.y = index / @column_max * (ACTOR_HEIGHT + 12) return rect end #----------------------------------------------------------------------------- # ● 料理をつくることのできるメンバーを取得 #----------------------------------------------------------------------------- def cooking_member=(member) @cooking_member = member refresh end #----------------------------------------------------------------------------- # ● 料理の番号を取得 #----------------------------------------------------------------------------- def cooking_index=(index) @cooking_index = index end #----------------------------------------------------------------------------- # ● リフレッシュ #----------------------------------------------------------------------------- def refresh @item_max = @cooking_member.size create_contents draw_cooking_actor end #-------------------------------------------------------------------------- # ● 料理のできるキャラクターの描画 #-------------------------------------------------------------------------- def draw_cooking_actor self.contents.clear content_x = 43 content_y = 65 for actor in @cooking_member draw_actor_graphic(actor,content_x,content_y) self.contents.draw_text(content_x-41,content_y-64,88,WLH,actor.name,1) contents.font.color = text_color(14) text = COOKING::LEVEL[actor.cooking_level[@cooking_index]] self.contents.draw_text(content_x-41,content_y,88,WLH,text,1) contents.font.color = text_color(0) content_x+=124 if content_x > 270 content_x = 43 content_y += 108 end end end end #============================================================================== # □ Window_Dishes_Help #------------------------------------------------------------------------------ # 料理画面で選択している料理の説明を表示するウィンドウです。 #============================================================================== class Window_Dishes_Help < Window_Base #----------------------------------------------------------------------------- # ● オブジェクト初期化 #----------------------------------------------------------------------------- def initialize super(0, 0, 544, WLH + 32) self.z = 2000 end #----------------------------------------------------------------------------- # ● テキスト設定 # text : ウィンドウに表示する文字列 # align : アラインメント (0..左揃え、1..中央揃え、2..右揃え) #----------------------------------------------------------------------------- def set_text(text, align = 0) if text != @text or align != @align self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(4, 0, self.width - 40, WLH, text, align) @text = text @align = align end end end #============================================================================== # □ Window_Dishes_Recipe #------------------------------------------------------------------------------ # 料理画面で選択している料理の材料を表示するウィンドウです。 #============================================================================== class Window_Dishes_Recipe < Window_Selectable attr_accessor :dish attr_accessor :actor_add_material #----------------------------------------------------------------------------- # ● オブジェクト初期化 #----------------------------------------------------------------------------- def initialize super(408,56,136,360) self.z = 2000 self.active = false self.index = 0 @dish = -1 @actor_add_material = [] refresh end #-------------------------------------------------------------------------- # ● ウィンドウ内容の作成 #-------------------------------------------------------------------------- def create_contents self.contents.dispose self.contents = Bitmap.new((width - 32) * @column_max, height - 32) end #-------------------------------------------------------------------------- # ● 項目を描画する矩形の取得 # index : 項目番号 #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.width = contents.width / @column_max rect.height = contents.height rect.x = index * contents.width / @column_max rect.y = 0 return rect end #----------------------------------------------------------------------------- # ● リフレッシュ #----------------------------------------------------------------------------- def refresh @item_max = 1 add_material = [] cooking_add_material = $data_items[@dish].add_materials for material in cooking_add_material if material.actor_id == 0 add_material << material.materials else next end end @item_max += add_material.size @item_max += @actor_add_material.size @column_max = @item_max create_contents return unless @dish > 0 page = 0 recipe_list = COOKING::RECIPE[@dish] draw_material(page,"必須食材",recipe_list) if add_material.size > 0 page+=1 draw_material(page,"追加食材",add_material) end for material in @actor_add_material page+=1 draw_material(page,"追加食材",material) end end #----------------------------------------------------------------------------- # ● 料理の番号を取得 #----------------------------------------------------------------------------- def dish=(dish) @dish = dish refresh end #----------------------------------------------------------------------------- # ● アクター毎のcooknote #----------------------------------------------------------------------------- def actor_add_material=(actor_add_material) @actor_add_material= actor_add_material refresh end #----------------------------------------------------------------------------- # ● 食材を描画 #----------------------------------------------------------------------------- def draw_material(page,text,recipe_list) rect = item_rect(page) recipe = recipe_list.uniq self.contents.draw_text(rect.x,rect.y,rect.width,WLH,text) self.contents.font.size = 15 self.contents.draw_text(rect.x,rect.height-19,rect.width,WLH,"<< Y") if page != 0 self.contents.draw_text(rect.x,rect.height-19,rect.width,WLH,"X >>",2) if page != @column_max-1 contents_y = WLH recipe.size.times{|i| material = recipe[i] case material when Numeric self.contents.draw_text(rect.x,contents_y,rect.width*3/4,WLH,$data_items[material].name) has_number = $game_party.item_number($data_items[material]) self.contents.draw_text(rect.x,contents_y,rect.width,WLH,has_number,2) n = recipe_list.find_all{|item| item == material }.size contents_y+=19 if n > 1 self.contents.draw_text(rect.x,contents_y,rect.width,WLH,sprintf("×%d",n)) contents_y+=19 end when Array for array in material self.contents.draw_text(rect.x,contents_y,rect.width*3/4,WLH,$data_items[array].name) has_number = $game_party.item_number($data_items[array]) self.contents.draw_text(rect.x,contents_y,rect.width,WLH,has_number,2) contents_y+=19 end next unless material.size > 1 n = recipe_list.find_all{|item| item == material }.size self.contents.draw_text(rect.x,contents_y,rect.width,WLH,sprintf("うち%dつ",n)) contents_y+=19 end if i < recipe.size-1 self.contents.draw_text(rect.x,contents_y,rect.width,WLH,"+",1) contents_y+=WLH end } self.contents.font.size = 20 end #-------------------------------------------------------------------------- # ● カーソルの更新 #-------------------------------------------------------------------------- def update_cursor rect = item_rect(@index) self.ox = rect.x self.cursor_rect.empty # カーソルを無効とする end end #============================================================================== # □ Window_Cooking_Confirm #------------------------------------------------------------------------------ # 料理画面で選択している料理をつくるか確認するウィンドウです。 #============================================================================== class Window_Cooking_Confirm < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(152,194,240,WLH*2 + 32) @item_max = 2 @column_max = 2 self.active = false self.index = -1 refresh end #-------------------------------------------------------------------------- # ● 項目を描画する矩形の取得 # index : 項目番号 #-------------------------------------------------------------------------- def item_rect(index) rect = super(index) rect.y+=WLH return rect end #----------------------------------------------------------------------------- # ● リフレッシュ #----------------------------------------------------------------------------- def refresh create_contents self.contents.draw_text(0,0,contents.width,WLH,"Command") draw_command(0,"Make") draw_command(1,"Quit") end #----------------------------------------------------------------------------- # ● 項目の描画 #----------------------------------------------------------------------------- def draw_command(index,text) rect = item_rect(index) self.contents.draw_text(rect,text,1) end end #============================================================================== # □ Window_Cooking_Message #------------------------------------------------------------------------------ # 料理画面でメッセージを表示するウィンドウです #============================================================================== class Window_Cooking_Message < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0,0,544,416) self.active = false end #----------------------------------------------------------------------------- # ● リフレッシュ #----------------------------------------------------------------------------- def set_message(message) max_width = 0 height = 0 text = message.dup text.each_line{|line| line.gsub!(/(.*)\n/i) {$1} width = self.contents.text_size(line).width max_width = width if max_width < width height+=WLH } self.width = max_width + 32 self.height = height + 32 self.x = (Graphics.width - self.width) / 2 self.y = (Graphics.height - self.height) / 2 create_contents contents_y = 0 message.each_line{|line| line.gsub!(/(.*)\n/i) {$1} width = self.contents.text_size(line).width max_width = width if max_width < width self.contents.draw_text(0,contents_y,width,WLH,line) contents_y+=WLH } end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ # バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- alias cooking_start start def start $game_map.cooking_flag = true $game_variables[COOKING::Cooking_Actor_Variable] = 0 $game_variables[COOKING::Cooking_Dish_Variable] = 0 cooking_start end end #=============================================================================== # □ Scene_CookingForm #------------------------------------------------------------------------------- # 料理画面の処理を行うクラスです。 #=============================================================================== class Scene_CookingForm < Scene_Base #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- CAPTION_OFFSET = 40 # キャプションウィンドウの位置補正 HOST_MENU = 0 # 呼び出し元 : メニュー HOST_MAP = 1 # 呼び出し元 : マップ HOST_BATTLE = 2 # 呼び出し元 : 戦闘 #-------------------------------------------------------------------------- # ● オブジェクト初期化 # menu_index : コマンドのカーソル初期位置 # host_scene : 呼び出し元 (0..メニュー 1..マップ 2..戦闘) #-------------------------------------------------------------------------- def initialize(menu_index = 0, host_scene = HOST_MENU) @menu_index = menu_index @host_scene = host_scene @message = [] end #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super $game_map.cooking_flag = $game_map.cooking_flag == nil ? true : $game_map.cooking_flag create_menu_background create_windows create_confirm_window set_dish(0) end #-------------------------------------------------------------------------- # ○ ウィンドウの作成 #-------------------------------------------------------------------------- def create_windows @window_dishes_selectable = Window_Dishes_Selectable.new @window_cooking_actor = Window_Cooking_Actor.new @window_dishes_help = Window_Dishes_Help.new @window_dishes_recipe = Window_Dishes_Recipe.new @menuback_sprite.z = 1000 end #-------------------------------------------------------------------------- # ○ 確認ウィンドウの作成 #-------------------------------------------------------------------------- def create_confirm_window @window_message = Window_Message.new @window_cooking_confirm = Window_Cooking_Confirm.new @window_cooking_message = Window_Cooking_Message.new @window_message.active = false @window_message.visible = false end #-------------------------------------------------------------------------- # ● メニュー画面系の背景作成 #-------------------------------------------------------------------------- def create_menu_background super @menuback_sprite.z = 20000 end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- def terminate super dispose_menu_background @window_dishes_selectable.dispose @window_cooking_actor.dispose @window_dishes_help.dispose @window_dishes_recipe.dispose @window_message.dispose @window_cooking_confirm.dispose @window_cooking_message.dispose end #-------------------------------------------------------------------------- # ● 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene case @host_scene when HOST_MENU $scene = Scene_Menu.new(@menu_index) when HOST_MAP $scene = Scene_Map.new when HOST_BATTLE $scene = Scene_Battle.new end $game_player.refresh end #-------------------------------------------------------------------------- # ● 基本更新処理 # main : メインの update メソッドからの呼び出し #-------------------------------------------------------------------------- def update_basic(main = false) Graphics.update unless main # ゲーム画面を更新 Input.update unless main # 入力情報を更新 @window_message.update # メッセージウィンドウを更新 end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update super update_basic(true) update_menu_background update_window if $game_message.visible @window_message.visible = true if @window_cooking_message.active cooking_message end end unless $game_message.visible if @window_cooking_message.active cooking_message elsif @window_cooking_actor.active cooking_actor elsif @window_dishes_selectable.active dishes_selectable elsif @window_cooking_confirm.active cooking_confirm end end end #-------------------------------------------------------------------------- # ○ ウィンドウ更新 #-------------------------------------------------------------------------- def update_window @window_dishes_selectable.update @window_cooking_actor.update @window_dishes_help.update @window_dishes_recipe.update @window_message.update @window_cooking_confirm.update @window_cooking_message.update end #-------------------------------------------------------------------------- # ○ フレーム更新 (料理選択画面がアクティブの場合) #-------------------------------------------------------------------------- def dishes_selectable if Input.repeat?(Input::UP) Sound.play_cursor set_dish(@window_dishes_selectable.index) elsif Input.repeat?(Input::DOWN) Sound.play_cursor set_dish(@window_dishes_selectable.index) elsif Input.trigger?(Input::X) @window_dishes_recipe.index-=1 @window_dishes_recipe.index = [0,@window_dishes_recipe.index].max @window_dishes_recipe.update_cursor elsif Input.trigger?(Input::Y) @window_dishes_recipe.index+=1 @window_dishes_recipe.index = [@window_dishes_recipe.item_max-1,@window_dishes_recipe.index].min @window_dishes_recipe.update_cursor elsif Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) unless @window_dishes_selectable.cooking_dishes_actors[@window_dishes_selectable.index].size > 0 Sound.play_buzzer return end Sound.play_decision @window_dishes_selectable.active = false @window_cooking_actor.active = true @window_cooking_actor.index = 0 end end #-------------------------------------------------------------------------- # ○ 料理をセット #-------------------------------------------------------------------------- def set_dish(index) if @window_dishes_selectable.cooking_dishes_actors[index].size > 0 dish = COOKING::DISHES[index] @window_dishes_help.set_text($data_items[dish].description) @window_cooking_actor.cooking_index = index @window_cooking_actor.cooking_member = @window_dishes_selectable.cooking_dishes_actors[index] dish = COOKING::DISHES[index] @window_dishes_recipe.dish = dish @window_dishes_recipe.index = 0 else @window_dishes_recipe.dish = -1 @window_dishes_help.set_text("Still Can Not Create") @window_cooking_actor.cooking_index = index @window_cooking_actor.cooking_member = @window_dishes_selectable.cooking_dishes_actors[index] end end #----------------------------------------------------------------------------- # ○ フレーム更新 (アクター選択画面がアクティブの場合) #----------------------------------------------------------------------------- def cooking_actor check_actor_add_material(@window_dishes_selectable.index) if Input.trigger?(Input::UP) @window_dishes_recipe.index = 0 @window_dishes_recipe.update_cursor elsif Input.trigger?(Input::DOWN) @window_dishes_recipe.index = 0 @window_dishes_recipe.update_cursor elsif Input.trigger?(Input::LEFT) @window_dishes_recipe.index = 0 @window_dishes_recipe.update_cursor elsif Input.trigger?(Input::RIGHT) @window_dishes_recipe.index = 0 @window_dishes_recipe.update_cursor elsif Input.trigger?(Input::B) Sound.play_cancel @window_cooking_actor.active = false @window_cooking_actor.index = -1 @window_dishes_selectable.active = true @window_dishes_recipe.actor_add_material = [] @window_dishes_recipe.index = 0 @window_dishes_recipe.update_cursor elsif Input.trigger?(Input::C) unless $game_map.cooking_flag Sound.play_buzzer @window_cooking_message.set_message(Vocab.no_more_eat) @window_cooking_message.active = true @window_cooking_message.z = 3000 @window_cooking_actor.active = false return end if check_has_material Sound.play_decision @window_cooking_actor.active = false @window_cooking_confirm.active = true @window_cooking_confirm.z = 3000 @window_cooking_confirm.index = 0 else Sound.play_buzzer end elsif Input.trigger?(Input::X) @window_dishes_recipe.index-=1 @window_dishes_recipe.index = [0,@window_dishes_recipe.index].max @window_dishes_recipe.update_cursor elsif Input.trigger?(Input::Y) @window_dishes_recipe.index+=1 @window_dishes_recipe.index = [@window_dishes_recipe.item_max-1,@window_dishes_recipe.index].min @window_dishes_recipe.update_cursor end end #----------------------------------------------------------------------------- # 作る料理の必要な材料数を所持しているか? #----------------------------------------------------------------------------- def check_has_material recipe_list = COOKING::RECIPE[@window_dishes_recipe.dish] recipe = recipe_list.uniq recipe.size.times{|i| material = recipe[i] case material when Numeric has_number = $game_party.item_number($data_items[material]) n = recipe_list.find_all{|item| item == material }.size return false unless has_number >= n when Array has_number = 0 for ingredient in material has_number+=$game_party.item_number($data_items[ingredient]) end n = recipe_list.find_all{|item| item == material }.size return false unless has_number >= n end } return true end #-------------------------------------------------------------------------- # ○ フレーム更新 (確認画面がアクティブの場合) #-------------------------------------------------------------------------- def cooking_confirm if Input.trigger?(Input::B) Sound.play_cancel @window_cooking_confirm.active = false @window_cooking_confirm.index = -1 @window_cooking_confirm.z = 0 @window_cooking_actor.active = true elsif Input.trigger?(Input::C) if @window_cooking_confirm.index == 0 try_cooking(@window_dishes_selectable.index) $game_map.cooking_flag = false @window_dishes_recipe.refresh @window_cooking_actor.refresh @window_cooking_confirm.active = false @window_cooking_confirm.index = -1 @window_cooking_confirm.z = 0 @window_cooking_actor.active = true unless @window_cooking_message.active elsif @window_cooking_confirm.index == 1 Sound.play_cancel @window_cooking_confirm.active = false @window_cooking_confirm.index = -1 @window_cooking_confirm.z = 0 @window_cooking_actor.active = true end end end #----------------------------------------------------------------------------- # ● 材料を消費して料理をつくる #----------------------------------------------------------------------------- def try_cooking(index) recipe = COOKING::RECIPE[@window_dishes_recipe.dish] for material in recipe case material when Numeric $game_party.lose_item($data_items[material],1) when Array selected = [] for ingredient in material if $game_party.item_number($data_items[ingredient]) > 0 selected.push(ingredient) end end $game_party.lose_item($data_items[selected[rand(selected.size)]],1) end end actors = @window_dishes_selectable.cooking_dishes_actors[index] actor = actors[@window_cooking_actor.index] $game_variables[COOKING::Cooking_Actor_Variable] = actor.id rute = rand(100) if COOKING::Success[actor.id].nil? success_rate = COOKING::Default_Success[actor.cooking_level[index]] else success_rates = COOKING::Success[actor.id] success_rate = success_rates[actor.cooking_level[index]] end if COOKING::Now_Cooking @window_cooking_message.set_message(COOKING::Now_Cooking_Message) @window_cooking_message.active = true @window_cooking_message.z = 3000 Sound.now_cooking_play Graphics.wait(COOKING::Now_Cooking_Wait) end if rute <= success_rate Sound.cooking_success_play exp = COOKING::SUCCESS_EXP dish = $data_items[COOKING::DISHES[index]] result_display(sprintf("%sができました。", dish.name)) dish_hp_recovery_rate = dish.hp_recovery_rate dish_mp_recovery_rate = dish.mp_recovery_rate recovery_state = [] add_state = [] for add_material in dish.add_materials next if add_material.actor_id != actor.id && add_material.actor_id != 0 next if add_material.level > actor.cooking_level[index] materials = add_material.has_materials next unless materials.size > 0 $game_party.lose_item($data_items[materials[rand(materials.size)]],1) dish_hp_recovery_rate += add_material.hp_recovery_rate dish_mp_recovery_rate += add_material.mp_recovery_rate recovery_state.concat(add_material.recovery_state) add_state.concat(add_material.add_state) end if COOKING::Success_Message[actor.id].nil? message = COOKING::Default_Success_Message else message = COOKING::Success_Message[actor.id] end result_cooking_message(actor, message) execute_effect(dish, dish_hp_recovery_rate, dish_mp_recovery_rate, recovery_state, add_state) else Sound.cooking_failure_play if COOKING::Failure[actor.id].nil? failured_cooking = COOKING::Default_Failure else failured_cooking = COOKING::Failure[actor.id] end selected_dish = failured_cooking[rand(failured_cooking.size)] dish = $data_items[selected_dish] result_display(sprintf("%sになってしまった…\n", dish.name)) if COOKING::Failure_Message[actor.id].nil? message = COOKING::Default_Failure_Message else message = COOKING::Failure_Message[actor.id] end result_cooking_message( actor, message) @message.push(dish.description) unless dish.description.empty? execute_effect(dish, dish.hp_recovery_rate, dish.mp_recovery_rate) exp = COOKING::FAILURE_EXP end $game_variables[COOKING::Cooking_Dish_Variable] = dish.id maxlv = dish.actor_max_level[actor.id].nil? ? COOKING::Default_Next_EXP.size : dish.actor_max_level[actor.id] if actor.cooking_level[index] < maxlv cooking_level = actor.cooking_level[index] actor_cooking_exp = actor.cooking_next_exp[index] actor_cooking_exp -= exp while actor_cooking_exp < 0 cooking_level += 1 if cooking_level >= maxlv actor_cooking_exp = 0 break end if COOKING::Next_EXP[actor.id].nil? next_exp = COOKING::Default_Next_EXP[cooking_level] else actor_next_exp = COOKING::Next_EXP[actor.id] next_exp = actor_next_exp[cooking_level] end actor_cooking_exp = next_exp + actor_cooking_exp end actor.cooking_next_exp[index] = actor_cooking_exp actor.cooking_level[index] = cooking_level end end #----------------------------------------------------------------------------- # ● 結果表示 #----------------------------------------------------------------------------- def result_display(message) @window_cooking_message.set_message(message) @window_cooking_message.active = true @window_cooking_message.z = 3000 end #----------------------------------------------------------------------------- # ● 料理後のセリフ #----------------------------------------------------------------------------- def result_cooking_message( actor, text) return unless COOKING::MESSAGE_FLAG $game_message.texts.push(text) $game_message.face_name= actor.face_name $game_message.face_index = actor.face_index @window_message.z = 3000 @window_message.visible = true @window_message.open set_message_waiting end #----------------------------------------------------------------------------- # ● 効果の適用 #----------------------------------------------------------------------------- def execute_effect( dish, hp_recovery_rate = 100, mp_recovery_rate = 100, recovery_state = [], add_state = []) for member in $game_party.members dish_hp_recovery = (member.maxhp*hp_recovery_rate/100 + dish.hp_recovery).to_i dish_mp_recovery = (member.maxmp*mp_recovery_rate/100 + dish.mp_recovery).to_i recovery_state.concat(dish.minus_state_set) add_state.concat(dish.plus_state_set) member.cooking_effect(dish_hp_recovery,dish_mp_recovery,recovery_state,add_state) next if member.dead? if COOKING::EFFECT_MESSAGE_FLAG @message.push(sprintf(Vocab::ActorRecovery,member.name,"HP",dish_hp_recovery.to_s)) if dish_hp_recovery > 0 @message.push(sprintf(Vocab::ActorRecovery,member.name,"MP",dish_mp_recovery.to_s)) if dish_mp_recovery > 0 end end if COOKING::EFFECT_MESSAGE_FLAG return unless @message.size > 0 for text in @message $game_message.texts.push(text) end @window_message.z = 3000 @window_message.visible = true @window_message.open set_message_waiting end end #----------------------------------------------------------------------------- # ● アクター毎のcooknoteのチェック #----------------------------------------------------------------------------- def check_actor_add_material(index) dish = $data_items[COOKING::DISHES[index]] actors = @window_dishes_selectable.cooking_dishes_actors[index] actor = actors[@window_cooking_actor.index] add_materials = dish.add_materials add_material = [] for ingredient in add_materials next if actor.id != ingredient.actor_id next if actor.cooking_level[index] < ingredient.level add_material << ingredient.materials end return if @window_dishes_recipe.actor_add_material == add_material @window_dishes_recipe.actor_add_material = add_material end #-------------------------------------------------------------------------- # ● メッセージ待機中フラグおよびコールバックの設定 #-------------------------------------------------------------------------- def cooking_message if Input.trigger?(Input::B) || Input.trigger?(Input::C) @window_cooking_message.z = 0 @window_cooking_message.width = 544 @window_cooking_message.height = 416 if COOKING::MESSAGE_FLAG && $game_message.texts.empty? == false for text in @message $game_message.texts.push(text) end @window_message.z = 3000 @message = [] @window_message.visible = true @window_message.open set_message_waiting end @window_cooking_message.active = false @window_cooking_actor.active = true end end #-------------------------------------------------------------------------- # ● メッセージ表示が終わるまでウェイト #-------------------------------------------------------------------------- def set_message_waiting @window_message.update while $game_message.visible update_basic end end end
Francamente ho sempre adorato il sistema di cucina dei Tales of, e mi sono cercato lo script (lo cercavo per ACE, ma l'ho trovato solo per VX, per cui ho installato VX appositamente per poter vedere come funzionava, creo un nuovo progetto, metto lo script... e... neanche mi compare nel menu di gioco... controllo meglio lo script e vedo che utilizza il sistema di menu KGC Custom Menu Command, cerco lo script, lo trovo, lo installo... e non cambia niente, continuo a non aver nessuna opzioni per la cucina, qualcuno sa dirmi come risolvere questo problema?
No, non ditemi di metterlo sui un progetto nuovo, perché non avendo mai avuto un progetto su VX, lo ho provato UNICAMENTE su progetti nuovi...