Menu
Eclipso logo
Merry Christmas !
23/04/2024 19:53:25

Une Princesse sans amour est une Princesse oubliée - Brandobscure

Falcao Mmrpg Alchemy

Daster

Amateur
Daster
  • Messages : 74

Falcao Mmrpg Alchemy


ven. 08 août 2014 - 15h05

Voilà, j'aimerais utiliser le script d'alchimie/Extraction de Falcao: [url]http://www.eclipso.fr/bibliotheque.php?page=view&id=27&element=530[/url] [spoiler][code] #==============================================================================# # #*****************# # # #*** By Falcao ***# * Falcao Mmorpg Alchemy and Extraction System # # #*****************# This script allows the player to learn two new # # skills, Alchemy and extraction, both of them # # RMVXACE used to create Items. Date: March 25 2013 # # # # Falcao RGSS site: http://falcaorgss.wordpress.com # # Falcao Forum site: http://makerpalace.com # # Traduction : LightNox # #==============================================================================# #------------------------------------------------------------------------------- # Qu'est ce que c'est? # # - L'alchimie est un système qui vous permet de créer des objets, armes et # armures a partir d'une liste d'ingrédients. # - L'extraction est un système qui vous permet de récolter des ingrédients # a partir de plantes, rocher, ect... # # Aussi appeller le crafting #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # * Features # # - Full Alchemy skill system # - Full Extraction skill system # - Alchemy and extraction Leveling system # - Full alchemy and extraction variance system # - Alchemy can create Weapons, Armors and Items # - In game maximun Alchemy and extraction levels enabled # - Alchemy Support up to 20 ingredients mix # - Alchemy and Extraction, speed, quantity, chance enabled # - Recipes levels enabled # - Extraction plants levels enabled # - Extractions plants respawn enabled # - Recipes system # - Flexible and easy recipe creation # - Easy to use #------------------------------------------------------------------------------- # * Terms and license # - Do credit me Falcao as the creator of this system # - You can modify anything you want # - You are allowed to distribute this material in any webpage # - Do not remove the header of any script shelf # - You are free to use this script in non-comercial projects, for comercial # projects contact me falmc99@gmail.com =begin =============================================================================== Changer l'acces dans le menu l: 228 Changer le nom dans le menu l: 1032 =============================================================================== * Script Manual ************************* * Alchemy skill set up * Use the following script call to display the alchemy GUI SceneManager.call(Scene_Alchemy) You will see an empty GUI, the first thing you have to do is create a recipe in the database item section using the following notetags - Here a normal recipe set up - Tags explanation Type de l'élément produit ( Item, Weapon, Armor ) Id de l'élément produit Chance d'obtenir l'élément (en %) Quantité de l'élémént produit Vitesse de production, support les decimales Niveau de la recette Ingredients requis Quantité d'Items à mélanger pour produire l'Item sortant. Dans ce cas, il faut 3x l'Item 17, 2x l'Item 18 et 2x l'Item19. * IMPORTANT Once the game party gets the Item recipe, the game player has to learn the recipe from the inventory menu in order to be displayed in the alchemy GUI ------------------------------------- * Extraction skill set up * In order to extract items plants, rocks or whatever you need, create an event with the following comment tags. Here a regular plant creation Id de l'item à extraire. Quantité extraite. Chance d'extraction en %. Vitesse de l'extraction. Niveau d'extraction Nombre d'extraction possible Temps en secondes avant respawn. Tags explanation Id de l'item à extraire. Quantité extraite. Chance d'extraction en %. Vitesse de l'extraction, (it support decimals). item extraction level, if player extraction skill is below this level it cannot be extracted How many times you want this plant to be extracted before dissapear? Temps en secondes avant respawn. IMPORTANT NOTE! I strongly recomend to see this script demo examples for the correct usage of this complex system =end #=============================================================================== # * Alchemy skill settings #=============================================================================== module FalcaoAlchemy # After how many production times get a chance to level up ProductionTimesLevelUp = 3 # Chance to level up when the production times match AlchemyLevelUpChance = 70 # After how many party alchemy skill level above of Recipe level have a chance # to level up the alchemy skill. Example: Alchemy level = 20 # Recipe level = 9, there are 11 levels above so party can not level up skill SeparateLevel = 10 # Default alchemy maximun level (can be changed in game) DefaultMaxLevel = 30 # Sound played when succes produce an item SuccesProduceSe = "Decision2" # Sound played when fail producing an item FailProduceSe = "Stare" # Sound played when succes level up the alchemy skill AlchemyLevelUpSe = "Raise1" end #=============================================================================== # * Extraction skill settings #=============================================================================== module FalExtract # After how many extraction times get a chance to level up ExtracTimesLevelUp = 4 # Chance to level up when the production times match ExtracLevelUpChance = 80 # After how many party extraction skill level above of Plant level have a # chance to level up the extraction skill. Example: Extraction level = 20 # Plant level = 9, there are 11 levels above so party can not level up skill SeparateLevell = 5 # Default extraction maximun level (can be changed in game) DefaultMaxLevel = 40 # Animation id played while extracting ExAnimation = 114 # Sound played when succes extrac an item SuccesExtractSe = "Item3" # Sound played when fail extract an item FailExtractSe = "Down1" # Sound played when level up extraction skill AlchemyLevelUpSe = "Raise1" #----------------------------------------------- def self.check_extracted_ones $game_map.events.values.each do |event| break if $game_party.ev_extdata[$game_map.map_id].nil? if !$game_party.ev_extdata[$game_map.map_id][event.id].nil? event.erase if $game_party.ev_extdata[$game_map.map_id][event.id][2] end end end end # Faire aparaître l'option alchimie dans le menu FalcaoRGSS_AddAlchemy_to_menu = true #----------------------------------------------------------------------------- # * Script calls # # Use this script call only if you want to change the extraction and alchemy # levels manually # # $game_party.alchemy_maxlv(x) If you want to change the alchemy maximun level # in game change x for the new maximun level # $game_party.alchemy_lv = x if you want to change the current alchemy level # change x for the new level # $game_party.extraction_maxlv(x) Extraction max level, change x for the new # maximun level # $game_party.extract_lv = x Extraction current level, change x for any # integer #------------------------------------------------------------------------------- ($imported ||= {})['Falcao Mmorpg Alchemy And Extraction'] = 1.0 #=============================================================================== # * Falcao Alchemy skill END OF SETINGS #=============================================================================== class RecipeData attr_accessor :recipes def initialize @recipes = {} @ingredients = {} register_values end def register_values for item in $data_items next if item.nil? id = item.recipedata("/i return $1.to_f if f return s ? $1.to_i : $1.to_s.sub("\r","") end end def costitem if @costitemm.nil? @costitemm = {} if @note =~ //i key = $1.to_s.sub("\r","").split(",").map { |s| s.to_i } end if @note =~ //i value = $1.to_s.sub("\r","").split(",").map { |s| s.to_i } end if key != nil index = 0 key.each {|k| @costitemm[k] = value[index] index += 1} end return @costitemm else return @costitemm end end end class Game_Party < Game_Unit attr_reader :recipes attr_accessor :extract_data, :extract_lv, :extrat_count, :ev_extdata attr_accessor :alchemy_lv, :alchemy_count, :pop_windowdata attr_accessor :al_maxlv, :ex_maxlv alias falcaoalchemy_ini initialize def initialize @recipes = [] @extract_lv = 1 @extrat_count = 0 @ev_extdata = {} @alchemy_lv = 1 @alchemy_count = 0 @al_maxlv = FalcaoAlchemy::DefaultMaxLevel @ex_maxlv = FalExtract::DefaultMaxLevel falcaoalchemy_ini end def alchemy_maxlv(lv) @al_maxlv = lv if lv >= @al_maxlv end def extraction_maxlv(lv) @ex_maxlv = lv if lv >= @ex_maxlv end def add_recipe(id) @recipes.push(id) unless @recipes.include?(id) end def pop_w(time, name, text) return unless @pop_windowdata.nil? @pop_windowdata = [time, text, name] end end class Game_Battler < Game_BattlerBase alias falcaoalchemy_mm_item consume_item def consume_item(item) if item.is_a?(RPG::Item) and !item.recipedata("= level $game_party.add_recipe(item.id) $game_party.pop_w( 180, 'Alchimie', "La recette: #{item.name} as bien était apprise!") else $game_party.gain_item(item, 1) $game_party.pop_w( 180,'Alchimie',"Le niveau d'alchimie #{level} est requis pour apprendre cette recette!") Sound.play_buzzer end end falcaoalchemy_mm_item(item) end end #------------------------------------------------------------------------------- class Window_AlRecipes < Window_Selectable def initialize(x, y, w, h, rdata) super(x, y, w, h) @rdata = rdata refresh ; select(0) end def item() return @data[self.index] end def refresh self.contents.clear if self.contents != nil @data = [] @rdata.recipes.each {|id, recipe| @data.push(recipe) if $game_party.recipes.include?(id)} @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 26) for i in 0...@item_max draw_item(i) end end end def draw_item(index) item = @data[index] x, y = index % col_max * (90), index / col_max * 24 self.contents.font.size = 18 draw_icon($data_items[item[7]].icon_index, x, y) contents.draw_text(x + 25, y, self.width, 32, item[0]) end def item_max return @item_max.nil? ? 0 : @item_max end end class Window_StartProducing < Window_HorzCommand def initialize(dark) @darked = dark super(200, 0) end def window_width() return 344 end def window_height() return 60 end def col_max return 2 end def make_command_list add_command("Start", :start, @darked.items_ready?) add_command("Stop", :stop) end def process_cancel @darked.meter > 0 ? return : super end end class FalcaoExtraction include FalExtract def initialize @col = [Color.new(180, 225, 245), Color.new(20, 160, 225), Color.new(0,0,0)] @running = false @anitimer = 0 end def update update_extraction_trigger if Input.trigger?(:C) update_display_window if $game_party.extract_data != nil update_respawn end def update_respawn return if $game_party.ev_extdata[$game_map.map_id].nil? $game_map.events.values.each do |event| break if $game_party.ev_extdata[$game_map.map_id].nil? if !$game_party.ev_extdata[$game_map.map_id][event.id].nil? if $game_party.ev_extdata[$game_map.map_id][event.id][2] $game_party.ev_extdata[$game_map.map_id][event.id][1] -= 1 if $game_party.ev_extdata[$game_map.map_id][event.id][1] > 0 if $game_party.ev_extdata[$game_map.map_id][event.id][1] == 0 event.fading = [:fade_out, 60] $game_party.ev_extdata[$game_map.map_id].delete(event.id) if $game_party.ev_extdata[$game_map.map_id].empty? $game_party.ev_extdata.delete($game_map.map_id) end next end end end end end def update_display_window create_window if $game_party.extract_data[5] > 0 $game_party.extract_data[5] -= 1 if $game_party.extract_data[5] == 0 $game_party.extract_data = nil dispose_window @running = false return end end return if $game_party.extract_data[5] > 0 if @running if $game_party.extract_data[5] == 0 refresh_contents $game_party.extract_data[4] += 1 end if $game_party.extract_data[4] >= $game_party.extract_data[3] * 60 $game_party.extract_data[5] = 60 refresh_contents end end end def create_window return if !@ext_window.nil? @ext_window = Window_Base.new(544 / 2 - 200 / 2, 0, 200, 66) if $game_party.extract_lv >= $game_party.extract_data[6] @running = true end refresh_contents end def refresh_contents @ext_window.contents.clear @ext_window.contents.fill_rect(0, 10, 26, 38, Color.new(0, 0, 0, 60)) item = $game_party.extract_data[0] @ext_window.draw_icon(item.icon_index, 1, 11) @ext_window.contents.font.size = 18 @ext_window.contents.font.color = @ext_window.normal_color @ext_window.contents.font.shadow = true string = "Niv #{$game_party.extract_data[6]} " + item.name @ext_window.draw_text(-4, -6, @ext_window.width, 32, string, 1) @ext_window.contents.font.size = 15 @ext_window.draw_text(0, 22, 26, 32, $game_party.extract_data[1].to_s, 1) @ext_window.contents.font.size = 18 if @running if $game_party.extract_data[5] == 60 r = rand(101) @ext_window.contents.font.color = Color.new(255, 120, 0, 255) if r <= $game_party.extract_data[2] $game_party.gain_item($game_party.extract_data[0], $game_party.extract_data[1]) RPG::SE.new(SuccesExtractSe, 80,).play @ext_window.draw_text(-75, 9, @ext_window.width, 32, 'Réussite', 2) if $game_party.extrat_count == ExtracTimesLevelUp - 1 r2 = rand(101) if r2 <= ExtracLevelUpChance leveling = true unless stop_growing? apply_extraction_growing end else $game_party.extrat_count += 1 end @anitimer = 0 else RPG::SE.new(FailExtractSe, 80,).play @ext_window.draw_text(-85, 9, @ext_window.width, 32, 'Echec', 2) end apply_variance @running = false end run_extractor if leveling.nil? else @ext_window.draw_text(0, 16, @ext_window.width, 32, "Ext lv #{$game_party.extract_data[6]} requis", 1) Sound.play_buzzer s = "Compétence d'extraction niveau #{$game_party.extract_data[6]} requis" $game_party.pop_w(180, 'Alchimie', s) $game_party.extract_data[5] = 120 end end def stop_growing? lv = $game_party.extract_data[6] return true if $game_party.extract_lv == $game_party.ex_maxlv return true unless $game_party.extract_lv <= lv + SeparateLevell - 1 return false end # growing def apply_extraction_growing return if stop_growing? RPG::SE.new(AlchemyLevelUpSe, 80,).play $game_party.extract_lv += 1 $game_party.extrat_count = 0 @ext_window.draw_text(30, 20, @ext_window.width, 32, "Compétence niveau #{$game_party.extract_lv}!") end def apply_variance $game_party.ev_extdata[$game_map.map_id] = {} if $game_party.ev_extdata[$game_map.map_id].nil? event = $game_party.extract_data[7] times = event.check_ext(" 0 next unless $game_player.in_front_ext?(event) item = event.check_ext("/i end end return 0 end alias falcaoexts_ini initialize def initialize(map_id, event) @fading = [:fade_in, time=0] falcaoexts_ini(map_id, event) end alias falcaoexts_up update def update if @fading[1] > 0 @fading[1] -= 1 if @fading[0] == :fade_in @opacity -= 4 if @opacity >= 0 erase if @fading[1] == 0 elsif @fading[0] == :fade_out if @erased @erased = false refresh ; @opacity = 0 end @opacity += 4 if @opacity <= 255 end end falcaoexts_up end end class Game_Player < Game_Character attr_accessor :pattern def in_front_ext?(target) return true if @direction == 2 and @x == target.x and (@y+1) == target.y return true if @direction == 4 and (@x-1) == target.x and @y == target.y return true if @direction == 6 and (@x+1) == target.x and @y == target.y return true if @direction == 8 and @x == target.x and (@y-1) == target.y return false end def update_anime_pattern return if !$game_party.extract_data.nil? super end alias falcaoextraction_mov movable? def movable? return false if $game_party.extract_data != nil falcaoextraction_mov end alias falcaoext_perform_transfer perform_transfer def perform_transfer falcaoext_perform_transfer FalExtract.check_extracted_ones if $game_map.map_id != @new_map_id end end class << DataManager alias falcaoalchemy_mmo_load load_normal_database def DataManager.load_normal_database falcaoalchemy_mmo_load for item in $data_items next if item.nil? if item.recipedata("= cost[item.id] enable ? apply_color(1) : apply_color(2) @ingredients.draw_icon(item.icon_index, x, y, enable) @ingredients.contents.font.size = 15 number = $game_party.item_number(item) @ingredients.draw_text(x - 2, y + 6, 32, 32, number.to_s, 1) @ingredients.contents.font.size = 18 @ingredients.draw_text(x + 24, y,212,32, item.name + " X#{cost[item.id]}") end end def items_ready? return false if @meter > 0 combi = ingredients ; item = [] ; combi = [] if combi.nil? combi.each {|i| it =$data_items[i]; item << i if $game_party.item_number(it) >= cost[it.id]} item.size == combi.size end def apply_color(c) @ingredients.contents.font.color = @ingredients.normal_color if c == 1 @ingredients.contents.font.color = Color.new(255,255,255,128) if c == 2 end def ingredients return @rdata.ingredients[@recipe.last] end def dispose @ingredients.dispose end def update_index(recipe_index) @recipe_index = recipe_index end def cost return $data_items[@recipe_index].costitem end end #---------- class Scene_Alchemy < Scene_MenuBase include FalcaoAlchemy def start super recipedata = RecipeData.new @col = [Color.new(180, 225, 245), Color.new(20, 160, 225), Color.new(0,0,0)] @meter = 0 @infow = Window_Base.new(0, 0, 200, 60) @alstatus = Window_Base.new(0, 326, 200, 90) refresh_alstatus @infow.contents.font.size = 20 @infow.draw_text(-16, 0, @infow.width, 32, 'Recettes', 1) @recipes = Window_AlRecipes.new(0, 60, 200, 266, recipedata) @ngrewindow = AlIngredients.new(recipedata) update_rindex @oven = Window_Base.new(200, 326, 344, 90) @pop_timer = 0 update_recipe @start_window = Window_StartProducing.new(@ngrewindow) update_cancel @start_window.set_handler(:start, method(:update_start)) @start_window.set_handler(:stop, method(:update_stop)) @start_window.set_handler(:cancel, method(:update_cancel)) end def refresh_alstatus @alstatus.contents.clear @alstatus.contents.font.size = 18; w = @alstatus.width ; g = $game_party @alstatus.draw_icon(218, 0, 16) ; arr = [g.al_maxlv.to_s, g.ex_maxlv.to_s] @alstatus.draw_icon(482, 0, 40) @alstatus.draw_text(-16, -8, w, 32, 'Niveau de compétence', 1) @alstatus.draw_text(26, 16, w, 32,"Alchimie: #{g.alchemy_lv}/" + arr[0]) @alstatus.draw_text(26, 40, w, 32,"Extraction: #{g.extract_lv}/" + arr[1]) end def update_start @ngrewindow.meter = 1 end def update_stop @ngrewindow.meter = 0 @start_window.refresh @start_window.activate refresh_oven end def output_item item = @recipes.item kind = $data_items[item[2]] if item[1]=='Item' || item[1]=='item' kind = $data_weapons[item[2]] if item[1]=='Weapon' || item[1]=='weapon' kind = $data_armors[item[2]] if item[1]=='Armor' || item[1]=='armor' kind end def update_cancel @start_window.unselect @start_window.deactivate @recipes.activate end def refresh_ingredients @ngrewindow.refresh(@recipes.item) end def refresh_oven @oven.contents.clear @oven.contents.font.size = 18 @oven.contents.fill_rect(0, 31, 31, 36, Color.new(0, 0, 0, 60)) @oven.draw_text(-16, -6, @oven.width, 32, 'Four', 1) if @pop_timer > 0 @oven.contents.font.color = Color.new(255, 120, 0, 255) @oven.draw_text(0, -6, @oven.width, 32, @type) end @oven.contents.font.color = @oven.normal_color @oven.draw_icon(output_item.icon_index, 4, 34) @oven.contents.font.size = 15 @oven.draw_text(0, 45, 33, 32, @recipes.item[4], 1) @oven.contents.font.size = 18 @oven.draw_text(34, 23, 250, 32, output_item.name) @oven.draw_text(-26, 23, @oven.width, 32, 'Chance', 2) @oven.draw_text(-26, 40, @oven.width, 32, @recipes.item[3].to_s + '%', 2) x, y = 33, 52 @oven.contents.fill_rect(x, y, 150, 12, @col[2]) max = @recipes.item[5] * 60 @oven.contents.fill_rect(x+1, y+1, 152 *@ngrewindow.meter / max, 5, @col[0]) @oven.contents.fill_rect(x+1, y+6, 152 *@ngrewindow.meter / max, 5, @col[1]) end def update_rindex @ngrewindow.update_index(@recipes.item[7]) unless @recipes.item.nil? end def update super update_rindex update_recipe SceneManager.return if Input.trigger?(:B) and @recipes.active update_selection if Input.trigger?(:C) and @recipes.active and !@recipes.item.nil? update_meter end def update_meter if @pop_timer > 0 @pop_timer -= 1 refresh_oven if @pop_timer == 0 end if @ngrewindow.meter != 0 @start_window.refresh if @ngrewindow.meter == 1 @start_window.activate if @ngrewindow.meter == 1 @ngrewindow.meter += 1 refresh_oven if @ngrewindow.meter >= @recipes.item[5] * 60 @ngrewindow.meter = 0 random = rand(101) random <= @recipes.item[3] ? success_producing : fail_producing end end end def success_producing RPG::SE.new(SuccesProduceSe, 80,).play $game_party.gain_item(output_item, @recipes.item[4]) @type = 'Succès!' ; @pop_timer = 50 destroy_items apply_alchemy_growing end def apply_alchemy_growing return if $game_party.alchemy_lv == $game_party.al_maxlv return unless $game_party.alchemy_lv <= @recipes.item[6] + SeparateLevel - 1 if $game_party.alchemy_count == ProductionTimesLevelUp - 1 r2 = rand(101) if r2 <= AlchemyLevelUpChance $game_party.alchemy_lv += 1 RPG::SE.new(AlchemyLevelUpSe, 80,).play $game_party.alchemy_count = 0 refresh_alstatus end else $game_party.alchemy_count += 1 end end def fail_producing RPG::SE.new(FailProduceSe, 80,).play @type = 'Echec!' ; @pop_timer = 50 destroy_items end def destroy_items c = $data_items[@recipes.item[7]].costitem @ngrewindow.ingredients.each {|i|$game_party.lose_item($data_items[i],c[i])} refresh_ingredients refresh_oven @ngrewindow.items_ready? ? update_start : @start_window.refresh end def update_selection Sound.play_ok @start_window.select(0) @start_window.activate @recipes.deactivate end def update_recipe return if @recipes.item.nil? if @recipe_index != @recipes.index @recipe_index = @recipes.index refresh_ingredients @start_window.refresh if !@start_window.nil? refresh_oven end end def terminate super @recipes.dispose @infow.dispose @ngrewindow.dispose @start_window.dispose @oven.dispose @alstatus.dispose end end # Input module update engine class << Input alias falcaoalchemy_mmo_update update def Input.update update_popwindow2 if !$game_party.nil? and !$game_party.pop_windowdata.nil? falcaoalchemy_mmo_update end # pop window global def update_popwindow2 $game_party.pop_windowdata[0] -= 1 if $game_party.pop_windowdata[0] > 0 if @temp_window.nil? tag = $game_party.pop_windowdata[2] string = $game_party.pop_windowdata[1] + tag width = (string.length * 9) - 10 x, y = Graphics.width / 2 - width / 2, Graphics.height / 2 - 64 / 2 @temp_window = Window_Base.new(x, y, width, 64) @temp_window.contents.font.size = 20 @temp_window.z = 9999 @temp_window.draw_text(-10, -6, width, 32, tag, 1) @temp_window.draw_text(-10,14, width, 32, $game_party.pop_windowdata[1],1) @current_scene = SceneManager.scene.class end if $game_party.pop_windowdata[0] == 0 || @current_scene != SceneManager.scene.class @temp_window.dispose @temp_window = nil $game_party.pop_windowdata = nil end end end if FalcaoRGSS_AddAlchemy_to_menu class Window_MenuCommand < Window_Command alias falcaoadd_alchemy add_original_commands def add_original_commands add_command('Alchimie', :alchemy, main_commands_enabled) falcaoadd_alchemy end end class Scene_Menu < Scene_MenuBase alias falcao_alchemy_command create_command_window def create_command_window falcao_alchemy_command @command_window.set_handler(:alchemy, method(:call_alchemy_scene)) end def call_alchemy_scene SceneManager.call(Scene_Alchemy) end end end[/code][/spoiler] Mais je n'arrive pas à créer une recette. Quelqu'un pourrait-t-il n'expliquer les étapes? J'ai bien essayé de traduire, mais cela ne m'aide pas beaucoup. EDIT: c'est bon. On m'a donné la réponse.