查看: 3998|回复: 9

[已经解决] 合成腳本商店化

[复制链接]
梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
回帖
49
发表于 2013-8-15 16:05:09 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
1.合成腳本商店化
因為不同的事件(NPC)可合成的物品不同
所以想把合成腳本改成像「商店處理」一樣,可以選擇合成物品

2.因為我有用第二貨幣的腳本,所以在合成物品時,會擋到視窗,想更改視窗的大小,請問要怎麼更改
1.png

腳本如下
[pre lang="ruby" line="1"]# ★ 初期設定。
#    設置合成配方
#--------------------------------------------------------------------------
module WD_itemsynthesis_ini
  
  Cost_view =  true #費用(G)の表示(合成の費用が全て0Gの場合はfalseを推■)
  
  Category_i = true #查看項目“項目”類別中的窗口
  Category_w = true #查看項目類別窗口中的“武器”
  Category_a = true #查看項目類別窗口中的“鎧甲”
  Category_k = true #查看項目類別窗口中的“重要的東西”
  
  I_recipe = [] #この行は削除しないこと
  W_recipe = [] #この行は削除しないこと
  A_recipe = [] #この行は削除しないこと
  
  #以下、合成レシピ。
  #例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  #と記載した場合、ID3のアイテムの合成必要は、100G。
  #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個
  #となる。
  
  #物品合成
  I_recipe[58]  = [50,  ["I",53,5], ["I",55,5]]
  I_recipe[60]  = [50,  ["I",52,5], ["I",54,7]]
  I_recipe[61]  = [50,  ["I",52,3], ["I",54,3]]
  I_recipe[62]  = [50,  ["I",53,10], ["I",55,7]]
  I_recipe[64]  = [50,  ["I",52,13], ["I",53,10]]
  I_recipe[65]  = [50,  ["I",53,19], ["I",56,16]]
  I_recipe[67]  = [50,  ["I",52,14], ["I",54,18]]
  I_recipe[70]  = [50,  ["I",58,20], ["I",59,18]]
  I_recipe[71]  = [50,  ["I",58,21], ["I",59,16]]
  I_recipe[72]  = [50,  ["I",60,14], ["I",61,22]]
  I_recipe[73]  = [50,  ["I",61,17], ["I",62,19]]
  I_recipe[78]  = [50,  ["I",66,24], ["I",67,26]]
  I_recipe[79]  = [50,  ["I",64,27], ["I",65,25]]
  #I_recipe[3]  = [100, ["I",1,1], ["I",2,1]]
  #I_recipe[17] = [500, ["I",1,10]]

  #武器合成
  #W_recipe[6]  = [600,  ["W",3,1], ["I",17,0]]
  
  #防具合成
  #A_recipe[5]  = [400,  ["A",2,1], ["W",2,2], ["I",17,0]]
  
end


#==============================================================================
# ■ WD_itemsynthesis
#------------------------------------------------------------------------------
#  アイテム合成用の共通メソッドです。
#==============================================================================

module WD_itemsynthesis
  def i_recipe_switch_on(id)
    $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
    $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
    $game_system.i_rcp_sw[id] = true
  end
  def i_recipe_switch_off(id)
    $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
    $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
    $game_system.i_rcp_sw[id] = false
  end
  def i_recipe_switch_on?(id)
    $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
    $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
    return $game_system.i_rcp_sw[id]
  end
  def i_recipe_all_switch_on
    for i in 1..$data_items.size
      i_recipe_switch_on(i)
    end
  end
  def i_recipe_all_switch_off
    for i in 1..$data_items.size
      i_recipe_switch_off(i)
    end
  end
  def w_recipe_switch_on(id)
    $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
    $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
    $game_system.w_rcp_sw[id] = true
  end
  def w_recipe_switch_off(id)
    $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
    $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
    $game_system.w_rcp_sw[id] = false
  end
  def w_recipe_switch_on?(id)
    $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
    $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
    return $game_system.w_rcp_sw[id]
  end
  def w_recipe_all_switch_on
    for i in 1..$data_weapons.size
      w_recipe_switch_on(i)
    end
  end
  def w_recipe_all_switch_off
    for i in 1..$data_weapons.size
      w_recipe_switch_off(i)
    end
  end
  def a_recipe_switch_on(id)
    $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
    $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
    $game_system.a_rcp_sw[id] = true
  end
  def a_recipe_switch_off(id)
    $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
    $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
    $game_system.a_rcp_sw[id] = false
  end
  def a_recipe_switch_on?(id)
    $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
    $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
    return $game_system.a_rcp_sw[id]
  end
  def a_recipe_all_switch_on
    for i in 1..$data_armors.size
      a_recipe_switch_on(i)
    end
  end
  def a_recipe_all_switch_off
    for i in 1..$data_armors.size
      a_recipe_switch_off(i)
    end
  end
  def recipe_all_switch_on
    i_recipe_all_switch_on
    w_recipe_all_switch_on
    a_recipe_all_switch_on
  end
  def recipe_all_switch_off
    i_recipe_all_switch_off
    w_recipe_all_switch_off
    a_recipe_all_switch_off
  end

end

class Game_Interpreter
  include WD_itemsynthesis
end

class Game_System
  #--------------------------------------------------------------------------
  # ● 公開インスタンス■數
  #--------------------------------------------------------------------------
  attr_accessor :i_rcp_sw
  attr_accessor :w_rcp_sw
  attr_accessor :a_rcp_sw
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias wd_orig_initialize004 initialize
  def initialize
    wd_orig_initialize004
    @i_rcp_sw = []
    @w_rcp_sw = []
    @a_rcp_sw = []
  end
end


#==============================================================================
# ■ Scene_ItemSynthesis
#------------------------------------------------------------------------------
#  合成畫面■管理
#==============================================================================

class Scene_ItemSynthesis < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 開始管理
  #--------------------------------------------------------------------------
  def start
    super
    create_help_window
    create_dummy_window
    create_number_window
    create_status_window
    create_material_window
    create_list_window
    create_category_window
    create_gold_window
    create_change_window
  end
  #--------------------------------------------------------------------------
  # ● ゴールドウィンドウの作成
  #--------------------------------------------------------------------------
  def create_gold_window
    @gold_window = Window_Gold.new
    @gold_window.viewport = @viewport
    @gold_window.x = Graphics.width - @gold_window.width
    @gold_window.y = @help_window.height
    @gold_window.hide
  end
  #--------------------------------------------------------------------------
  # ● 切り替え表示ウィンドウの作成
  #--------------------------------------------------------------------------
  def create_change_window
    wx = 0
    wy = @gold_window.y
    ww = Graphics.width - @gold_window.width
    wh = @gold_window.height
    @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
    @change_window.viewport = @viewport
    @change_window.hide
  end
  #--------------------------------------------------------------------------
  # ● ダミーウィンドウの作成
  #--------------------------------------------------------------------------
  def create_dummy_window
    wy = @help_window.y + @help_window.height + 48
    wh = Graphics.height - wy
    @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
    @dummy_window.viewport = @viewport
  end
  #--------------------------------------------------------------------------
  # ● 創建切換顯示窗口
  #--------------------------------------------------------------------------
  def create_number_window
    wy = @dummy_window.y
    wh = @dummy_window.height
    @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
    @number_window.viewport = @viewport
    @number_window.hide
    @number_window.set_handler(:ok,     method(:on_number_ok))
    @number_window.set_handler(:cancel, method(:on_number_cancel))
  end
  #--------------------------------------------------------------------------
  # ● ステータスウィンドウの作成
  #--------------------------------------------------------------------------
  def create_status_window
    wx = @number_window.width
    wy = @dummy_window.y
    ww = Graphics.width - wx
    wh = @dummy_window.height
    @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
    @status_window.viewport = @viewport
    @status_window.hide
  end
  #--------------------------------------------------------------------------
  # ● 創建一個狀態窗口
  #--------------------------------------------------------------------------
  def create_material_window
    wx = @number_window.width
    wy = @dummy_window.y
    ww = Graphics.width - wx
    wh = @dummy_window.height
    @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
    @material_window.viewport = @viewport
    @material_window.hide
    @number_window.material_window = @material_window
  end
  #--------------------------------------------------------------------------
  # ● 創建一個合成項目列表窗口
  #--------------------------------------------------------------------------
  def create_list_window
    wy = @dummy_window.y
    wh = @dummy_window.height
    @list_window = Window_ItemSynthesisList.new(0, wy, wh)
    @list_window.viewport = @viewport
    @list_window.help_window = @help_window
    @list_window.status_window = @status_window
    @list_window.material_window = @material_window
    @list_window.hide
    @list_window.set_handler(:ok,     method(:on_list_ok))
    @list_window.set_handler(:cancel, method(:on_list_cancel))
    @list_window.set_handler(:change_window, method(:on_change_window))   
  end
  #--------------------------------------------------------------------------
  # ● 創建類別窗口
  #--------------------------------------------------------------------------
  def create_category_window
    @category_window = Window_ItemSynthesisCategory.new
    @category_window.viewport = @viewport
    @category_window.help_window = @help_window
    @category_window.y = @help_window.height
    @category_window.activate
    @category_window.item_window = @list_window
    @category_window.set_handler(:ok,     method(:on_category_ok))
    @category_window.set_handler(:cancel, method(:return_scene))
  end
  #--------------------------------------------------------------------------
  # ● 合成アイテムリストウィンドウのアクティブ化
  #--------------------------------------------------------------------------
  def activate_list_window
    @list_window.money = money
    @list_window.show.activate
  end
  #--------------------------------------------------------------------------
  # ● 合成[決定]
  #--------------------------------------------------------------------------
  def on_list_ok
    @item = @list_window.item
    @list_window.hide
    @number_window.set(@item, max_buy, buying_price, currency_unit)
    @number_window.show.activate
  end
  #--------------------------------------------------------------------------
  # ● 合成[キャンセル]
  #--------------------------------------------------------------------------
  def on_list_cancel
    @category_window.activate
    @category_window.show
    @dummy_window.show
    @list_window.hide
    @status_window.hide
    @status_window.item = nil
    @material_window.hide
    @material_window.set(nil, nil)
    @gold_window.hide
    @change_window.hide
    @help_window.clear
  end
  #--------------------------------------------------------------------------
  # ● 表示切替
  #--------------------------------------------------------------------------
  def on_change_window
    if @status_window.visible
      @status_window.hide
      @material_window.show
    else
      @status_window.show
      @material_window.hide
    end
  end
  #--------------------------------------------------------------------------
  # ● カテゴリ[決定]
  #--------------------------------------------------------------------------
  def on_category_ok
    activate_list_window
    @gold_window.show
    @change_window.show
    @material_window.show
    @category_window.hide
    @list_window.select(0)
  end
  #--------------------------------------------------------------------------
  # ● 個數入力[決定]
  #--------------------------------------------------------------------------
  def on_number_ok
    Sound.play_shop
    do_syntetic(@number_window.number)
    end_number_input
    @gold_window.refresh
  end
  #--------------------------------------------------------------------------
  # ● 個數入力[キャンセル]
  #--------------------------------------------------------------------------
  def on_number_cancel
    Sound.play_cancel
    end_number_input
  end
  #--------------------------------------------------------------------------
  # ● 合成の■行
  #--------------------------------------------------------------------------
  def do_syntetic(number)
    $game_party.lose_gold(number * buying_price)
    $game_party.gain_item(@item, number)
   
      @recipe = @list_window.recipe(@item)
      for i in 1...@recipe.size
        kind = @recipe[0]
        id   = @recipe[1]
        num  = @recipe[2]
        if kind == "I"
          item = $data_items[id]
        elsif kind == "W"
          item = $data_weapons[id]
        elsif kind == "A"
          item = $data_armors[id]
        end
        $game_party.lose_item(item, num*number)
      end
  end
  #--------------------------------------------------------------------------
  # ● 個數入力の終了
  #--------------------------------------------------------------------------
  def end_number_input
    @number_window.hide
    activate_list_window
  end
  #--------------------------------------------------------------------------
  # ● 最大購入可能個數の取得
  #--------------------------------------------------------------------------
  def max_buy
    max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
   
    @recipe = @list_window.recipe(@item)
      for i in 1...@recipe.size
        kind = @recipe[0]
        id   = @recipe[1]
        num  = @recipe[2]
        if kind == "I"
          item = $data_items[id]
        elsif kind == "W"
          item = $data_weapons[id]
        elsif kind == "A"
          item = $data_armors[id]
        end
        if num > 0
          max_buf = $game_party.item_number(item)/num
        else
          max_buf = 999
        end
        max = [max, max_buf].min
      end
      
    buying_price == 0 ? max : [max, money / buying_price].min

  end
  #--------------------------------------------------------------------------
  # ● 所持金の取得
  #--------------------------------------------------------------------------
  def money
    @gold_window.value
  end
  #--------------------------------------------------------------------------
  # ● 通貨單位の取得
  #--------------------------------------------------------------------------
  def currency_unit
    @gold_window.currency_unit
  end
  #--------------------------------------------------------------------------
  # ● 合成費用の取得
  #--------------------------------------------------------------------------
  def buying_price
    @list_window.price(@item)
  end
end


#==============================================================================
# ■ Window_ItemSynthesisList
#------------------------------------------------------------------------------
#  合成畫面で、合成可能なアイテムの一■を表示するウィンドウです。
#==============================================================================

class Window_ItemSynthesisList < Window_Selectable
  include WD_itemsynthesis
  #--------------------------------------------------------------------------
  # ● 公開インスタンス■數
  #--------------------------------------------------------------------------
  attr_reader   :status_window            # ステータスウィンドウ
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y, height)
    super(x, y, window_width, height)
   
    @shop_goods = []
    @shop_recipes = []
   
    for i in 1..WD_itemsynthesis_ini::I_recipe.size
      recipe = WD_itemsynthesis_ini::I_recipe
      if recipe
        good = [0, i, recipe[0]]
        if i_recipe_switch_on?(i)
          @shop_goods.push(good)
          @shop_recipes.push(recipe)
        end
      end
    end
    for i in 1..WD_itemsynthesis_ini::W_recipe.size
      recipe = WD_itemsynthesis_ini::W_recipe
      if recipe
        good = [1, i, recipe[0]]
        if w_recipe_switch_on?(i)
          @shop_goods.push(good)
          @shop_recipes.push(recipe)
        end
      end
    end
    for i in 1..WD_itemsynthesis_ini::A_recipe.size
      recipe = WD_itemsynthesis_ini::A_recipe
      if recipe
        good = [2, i, recipe[0]]
        if a_recipe_switch_on?(i)
          @shop_goods.push(good)
          @shop_recipes.push(recipe)
        end
      end
    end
   
    @Money = 0
    refresh
    select(0)
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ幅の取得
  #--------------------------------------------------------------------------
  def window_width
    return 304
  end
  #--------------------------------------------------------------------------
  # ● 項目數の取得
  #--------------------------------------------------------------------------
  def item_max
    @data ? @data.size : 1
  end
  #--------------------------------------------------------------------------
  # ● アイテムの取得
  #--------------------------------------------------------------------------
  def item
    @data[index]
  end
  #--------------------------------------------------------------------------
  # ● 所持金の設定
  #--------------------------------------------------------------------------
  def money=(money)
    @money = money
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 選■項目の有■狀態を取得
  #--------------------------------------------------------------------------
  def current_item_enabled?
    enable?(@data[index])
  end
  #--------------------------------------------------------------------------
  # ● 合成費用を取得
  #--------------------------------------------------------------------------
  def price(item)
    @price[item]
  end
  #--------------------------------------------------------------------------
  # ● 合成可否を取得
  #--------------------------------------------------------------------------
  def enable?(item)
    @makable[item]
  end
  #--------------------------------------------------------------------------
  # ● レシピを取得
  #--------------------------------------------------------------------------
  def recipe(item)
    @recipe[item]
  end
  #--------------------------------------------------------------------------
  # ● アイテムを許可狀態で表示するかどうか
  #--------------------------------------------------------------------------
  def have_mat?(recipe)
    flag = true
    if @money >= recipe[0]
      for i in 1...recipe.size
        kind = recipe[0]
        id   = recipe[1]
        num  = recipe[2]
        if kind == "I"
          item = $data_items[id]
        elsif kind == "W"
          item = $data_weapons[id]
        elsif kind == "A"
          item = $data_armors[id]
        end
        if $game_party.item_number(item) < [num, 1].max
          flag = false
        end
      end
    else
      flag = false
    end
    return flag
  end
  #--------------------------------------------------------------------------
  # ● カテゴリの設定
  #--------------------------------------------------------------------------
  def category=(category)
    return if @category == category
    @category = category
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    make_item_list
    create_contents
    draw_all_items
  end
  #--------------------------------------------------------------------------
  # ● アイテムをリストに含めるかどうか
  #--------------------------------------------------------------------------
  def include?(item)
    case @category
    when :item
      item.is_a?(RPG::Item) && !item.key_item?
    when :weapon
      item.is_a?(RPG::Weapon)
    when :armor
      item.is_a?(RPG::Armor)
    when :key_item
      item.is_a?(RPG::Item) && item.key_item?
    else
      false
    end
  end
  #--------------------------------------------------------------------------
  # ● アイテムリストの作成
  #--------------------------------------------------------------------------
  def make_item_list
    @data = []
    @price = {}
    @makable = {}
    @recipe = {}
    for i in 0...@shop_goods.size
      goods = @shop_goods
      recipe = @shop_recipes
      case goods[0]
      when 0;  item = $data_items[goods[1]]
      when 1;  item = $data_weapons[goods[1]]
      when 2;  item = $data_armors[goods[1]]
      end
      if item
        if include?(item)
          @data.push(item)
          @price[item] = goods[2]
          @makable[item] = have_mat?(recipe)
          @recipe[item] = recipe
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 項目の描畫
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    rect = item_rect(index)
    draw_item_name(item, rect.x, rect.y, enable?(item))
    rect.width -= 4
    draw_text(rect, price(item), 2)  if WD_itemsynthesis_ini::Cost_view
  end
  #--------------------------------------------------------------------------
  # ● ステータスウィンドウの設定
  #--------------------------------------------------------------------------
  def status_window=(status_window)
    @status_window = status_window
    call_update_help
  end
  #--------------------------------------------------------------------------
  # ● 素材ウィンドウの設定
  #--------------------------------------------------------------------------
  def material_window=(material_window)
    @material_window = material_window
    call_update_help
  end
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_item(item) if @help_window
    @status_window.item = item if @status_window
    @material_window.set(item, recipe(item)) if @material_window
  end
  #--------------------------------------------------------------------------
  # ● ←→ ボタン(表示切替)が押されたときの■理
  #--------------------------------------------------------------------------
  def process_change_window
    Sound.play_cursor
    Input.update
    call_handler(:change_window)
  end
  #--------------------------------------------------------------------------
  # ● 決定やキャンセルなどのハンドリング■理
  #--------------------------------------------------------------------------
  def process_handling
    super
    if active
      return process_change_window if handle?(:change_window) && Input.trigger?(:X)
      return process_change_window if handle?(:change_window) && Input.trigger?(:Y)
    end
  end
end


#==============================================================================
# ■ Window_ItemSynthesisMaterial
#------------------------------------------------------------------------------
#  合成畫面で、合成に必要な素材を表示するウィンドウです。
#==============================================================================

class Window_ItemSynthesisMaterial < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super(x, y, width, height)
    @item = nil
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_possession(4, 0)
    draw_material_info(0, line_height * 2)
  end
  #--------------------------------------------------------------------------
  # ● アイテムの設定
  #--------------------------------------------------------------------------
  def set(item, recipe)
    @item = item
    @recipe = recipe
    @make_number = 1
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 作成個數の設定
  #--------------------------------------------------------------------------
  def set_num(make_number)
    @make_number = make_number
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 所持數の描畫
  #--------------------------------------------------------------------------
  def draw_possession(x, y)
    rect = Rect.new(x, y, contents.width - 4 - x, line_height)
    change_color(system_color)
    draw_text(rect, Vocab::Possession)
    change_color(normal_color)
    draw_text(rect, $game_party.item_number(@item), 2)
  end
  #--------------------------------------------------------------------------
  # ● 素材情報の描畫
  #--------------------------------------------------------------------------
  def draw_material_info(x, y)
    rect = Rect.new(x, y, contents.width, line_height)
    change_color(system_color)
    contents.font.size = 18
    draw_text(rect, "必要素材", 0)
    if @recipe
      for i in 1...@recipe.size
        kind = @recipe[0]
        id   = @recipe[1]
        num  = @recipe[2]
        if kind == "I"
          item = $data_items[id]
        elsif kind == "W"
          item = $data_weapons[id]
        elsif kind == "A"
          item = $data_armors[id]
        end
        rect = Rect.new(x, y + line_height*i, contents.width, line_height)
        enabled = true
        enabled = false if [num*@make_number, 1].max  > $game_party.item_number(item)
        draw_item_name(item, rect.x, rect.y, enabled)
        change_color(normal_color, enabled)
        if num > 0
          draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)
        end
      end
    end
    change_color(normal_color)
    contents.font.size = 24
  end
end


#==============================================================================
# ■ Window_ItemSynthesisNumber
#------------------------------------------------------------------------------
#  合成畫面で、合成するアイテムの個數を入力するウィンドウです。
#==============================================================================

class Window_ItemSynthesisNumber < Window_ShopNumber
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_item_name(@item, 0, item_y)
    draw_number
    draw_total_price if WD_itemsynthesis_ini::Cost_view
  end
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def material_window=(material_window)
    @material_window = material_window
    call_update_help
  end
  #--------------------------------------------------------------------------
  # ● 作成個數の■更
  #--------------------------------------------------------------------------
  def change_number(amount)
    @number = [[@number + amount, @max].min, 1].max
    call_update_help #追加
  end
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def call_update_help
    @material_window.set_num(@number) if @material_window
  end
end


#==============================================================================
# ■ Window_ItemSynthesisCategory
#------------------------------------------------------------------------------
#  合成畫面で、通常アイテムや裝備品の分類を選■するウィンドウです。
#==============================================================================

class Window_ItemSynthesisCategory < Window_ItemCategory
  #--------------------------------------------------------------------------
  # ● 桁數の取得
  #--------------------------------------------------------------------------
  def col_max
    i = 0
    i += 1 if WD_itemsynthesis_ini::Category_i
    i += 1 if WD_itemsynthesis_ini::Category_w
    i += 1 if WD_itemsynthesis_ini::Category_a
    i += 1 if WD_itemsynthesis_ini::Category_k
    return i
  end
  #--------------------------------------------------------------------------
  # ● コマンドリストの作成
  #--------------------------------------------------------------------------
  def make_command_list
    add_command(Vocab::item,     :item)     if WD_itemsynthesis_ini::Category_i
    add_command(Vocab::weapon,   :weapon)   if WD_itemsynthesis_ini::Category_w
    add_command(Vocab::armor,    :armor)    if WD_itemsynthesis_ini::Category_a
    add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
  end
end


#==============================================================================
# ■ Window_ItemSynthesisNumber
#------------------------------------------------------------------------------
#  合成畫面で、切替を表示するウィンドウです。
#==============================================================================

class Window_ItemSynthesisChange < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super(x, y, width, height)
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    text = "合成"
    draw_text(0, 0, contents_width, line_height, text, 1)
  end
end
[/pre]

点评

改216行 wy = @help_window.y + @help_window.height + 72  发表于 2013-8-15 17:13
梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
回帖
49
 楼主| 发表于 2013-8-18 00:40:48 | 显示全部楼层
回點評:
在上一個窗口時變成這樣

1.jpg
回复

使用道具 举报

梦石
0
星屑
1564
在线时间
209 小时
注册时间
2013-6-19
回帖
123
发表于 2013-8-19 01:08:10 | 显示全部楼层
本帖最后由 a0936459772 于 2013-8-19 01:29 编辑
ji3rul4coco 发表于 2013-8-18 00:40
回點評:
在上一個窗口時變成這樣


如果是改變貨幣顯示的窗口大小的話
在你的第二貨幣腳本中的約28行做修改
28.jpg
逗點左邊為寬,右邊為高
直接用常數代入即可


如果是改變顯示"合成"的那個窗口的話
請在你的物品合成腳本851行做修改
物品合成.jpg
[pre lang="ruby" line="1"]super(x, y, width, height-24) #改成這樣就能正常顯示[/pre]



我本身也有用第二貨幣腳本
根據我的需求,我把它改成普通商店時金錢窗口只顯示金錢
第二貨幣商店時只顯示第二貨幣
而且金錢窗口也能正常顯示

如果樓主要實現這個功能的話
就回覆或點評一下吧

点评

求大大改的腳本(第二貨幣那個)~~拜託了(上次看太快沒看到)((雙手合十  发表于 2013-8-22 17:58
回复

使用道具 举报

梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
回帖
49
 楼主| 发表于 2013-8-19 16:17:00 | 显示全部楼层
本帖最后由 ji3rul4coco 于 2013-8-19 16:18 编辑
a0936459772 发表于 2013-8-19 01:08
如果是改變貨幣顯示的窗口大小的話
在你的第二貨幣腳本中的約28行做修改


非常感謝ㄋㄟ~

對了,關於第1個問題,我在想是不是可以用開關控制腳本,在呼出合成腳本前設定開關
用開關來達成不同事件有不同合成物的功能

例如說:

if(XXXXXXXXXXXXX)開關[0001]=on
I_recipe[2]  = [30,  ["I",29,5]]
I_recipe[3]  = [30,  ["I",30,5]]
I_recipe[4]  = [30,  ["I",31,5]]
I_recipe[5]  = [30,  ["I",32,5]]
I_recipe[6]  = [30,  ["I",33,5]]

if(XXXXXXXXXXXXX)開關[0002]=on
I_recipe[10]  = [30,  ["I",37,5]]
I_recipe[11]  = [30,  ["I",38,5]]
I_recipe[12]  = [30,  ["I",39,5]]
I_recipe[13]  = [30,  ["I",40,5]]
I_recipe[14]  = [30,  ["I",41,5]]


之類的(至於if甚麼的...就不是我能寫得出來的了....)
回复

使用道具 举报

梦石
0
星屑
1564
在线时间
209 小时
注册时间
2013-6-19
回帖
123
发表于 2013-8-19 19:51:01 | 显示全部楼层
本帖最后由 a0936459772 于 2013-8-19 19:52 编辑
ji3rul4coco 发表于 2013-8-19 16:17
非常感謝ㄋㄟ~

對了,關於第1個問題,我在想是不是可以用開關控制腳本,在呼出合成腳 ...


其實你的要求用事件就可以達成
範例.jpg

你的合成腳本應該是這個沒錯
http://izumiwhite.web.fc2.com/rgss3/rgss3_004.html

它裡面有寫
[pre lang="ruby" line="1"]recipe_all_switch_off #全てのレシピを削除[/pre]
用來刪除所有已記錄的配方

那麼就在事件裡加入該商店的配方,叫出合成畫面,然後再把所有配方刪除即可(參考圖片)。

点评

補問個問題:因為已經有別的鍛造腳本了,所以想請大大幫忙,能否把合成武器與防具的部分修掉,只專門合成物品?  发表于 2013-8-22 17:15
回复

使用道具 举报

梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
回帖
49
 楼主| 发表于 2013-8-21 16:34:16 | 显示全部楼层
a0936459772 发表于 2013-8-19 19:51
其實你的要求用事件就可以達成

非~~常感謝!
回复

使用道具 举报

梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
回帖
49
 楼主| 发表于 2013-8-21 16:50:49 | 显示全部楼层
a0936459772 发表于 2013-8-19 19:51
其實你的要求用事件就可以達成

非~~常感謝!

点评

不用了,直接拿吧。  发表于 2013-8-23 13:31
把你的第二貨幣腳本貼上來,我幫你改  发表于 2013-8-23 04:13
回复

使用道具 举报

梦石
0
星屑
1564
在线时间
209 小时
注册时间
2013-6-19
回帖
123
发表于 2013-8-22 23:14:27 | 显示全部楼层
本帖最后由 a0936459772 于 2013-8-22 23:17 编辑
ji3rul4coco 发表于 2013-8-21 16:50
非~~常感謝!


在你的物品合成腳本中
找到
[pre lang="ruby" line="1"]  Category_w = true #カテゴリウィンドウに「武器」の項目を表示
  Category_a = true #カテゴリウィンドウに「防具」の項目を表示[/pre]
改成
[pre lang="ruby" line="1"]  Category_w = false #カテゴリウィンドウに「武器」の項目を表示
  Category_a = false #カテゴリウィンドウに「防具」の項目を表示[/pre]
回复

使用道具 举报

梦石
0
星屑
1564
在线时间
209 小时
注册时间
2013-6-19
回帖
123
发表于 2013-8-23 13:31:05 | 显示全部楼层
本帖最后由 a0936459772 于 2013-8-23 13:55 编辑
ji3rul4coco 发表于 2013-8-21 16:50
非~~常感謝!


注意:
此腳本只會在遊戲菜單中同時顯示兩個貨幣
其餘狀況則根據通貨的開關決定顯示的貨幣
關閉時顯示第一貨幣
打開時顯示第二貨幣
效果圖
菜單中.jpg
第一通貨商店.jpg
第二通貨商店.jpg

直接覆蓋你原本的第二貨幣腳本即可
記得把用語和開關ID改回來

[pre lang="ruby" line="1"]# by 杂兵天下的马甲
# 2013.8.23 由a0936459772 修改
# 因為這是根據私人需求而修改的客製化腳本,若出現任何bug或是腳本衝突,本熊一概沒有任何責任。

#第二货币设置
$SECOND_CURRENCY_SWITCH = 10  #打開某號開關後,金錢的增減全變為第二貨幣
$SECOND_CURRENCY_NAME = "結晶" #在道具備註裡打上<第二通貨價格:1>,則道具可以用1第二通貨購買
#第二货币方法
class Game_Party < Game_Unit
  attr_reader    :spegold
  alias initialize_normal_sc initialize
  def initialize
    initialize_normal_sc
    @spegold = 0
  end
  alias gain_gold_normal_sc gain_gold
  def gain_gold(amount)
    if $game_switches[$SECOND_CURRENCY_SWITCH]
      @spegold = [[@spegold + amount, 0].max, max_gold].min
    else
      gain_gold_normal_sc(amount)
    end
  end
end

#第二货币的显示

class Window_Gold < Window_Base
  #覆盖方法!可能引起冲突
  #--------------------------------------------------------------------------
  # ● 初始化                  
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, window_height)
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 獲取窗口的高度
  #--------------------------------------------------------------------------
  def window_height
    SceneManager.scene_is?(Scene_Menu) ? fitting_height(2) : fitting_height(1)
  end
#alias refresh_normal_sc refresh
  #--------------------------------------------------------------------------
  # ● 刷新                     
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    #refresh_normal_sc
    if SceneManager.scene_is?(Scene_Menu)
      draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
      draw_currency_value($game_party.spegold, $SECOND_CURRENCY_NAME, 4, 24, contents.width - 8)
    elsif $game_switches[$SECOND_CURRENCY_SWITCH]
      draw_currency_value($game_party.spegold, $SECOND_CURRENCY_NAME, 4, 0, contents.width - 8)
    else
      draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
    end
  end
end

#战斗胜利不获得第二货币

module BattleManager
  #覆盖方法!可能引起冲突
  def self.gain_gold
    if $game_troop.gold_total > 0
      text = sprintf(Vocab::ObtainGold, $game_troop.gold_total)
      $game_message.add('\.' + text)
      $game_party.gain_gold_normal_sc($game_troop.gold_total)
    end
    wait_for_message
  end
end

#用第二货币买东西
module RPG
  class Item
    def price
      if $game_switches[$SECOND_CURRENCY_SWITCH]
        note.split(/[\r\n]+/).each { |line|
          case line
          when /<第二通貨價格:(\d+)>/i
            return $1.to_i
          end
        }
        return 0
      else
        return @price
      end
    end
  end
end

#商店中购买灵魄物品显示灵魄

class Window_ShopNumber < Window_Selectable
  alias draw_total_price_normal_sc draw_total_price
  def draw_total_price
    if $game_switches[$SECOND_CURRENCY_SWITCH]
      @currency_unit = $SECOND_CURRENCY_NAME
    end
    draw_total_price_normal_sc
  end
end

class Scene_Shop < Scene_MenuBase
  alias money_normal_sc money
  def money
    if $game_switches[$SECOND_CURRENCY_SWITCH]
      return $game_party.spegold
    else
      return money_normal_sc
    end
  end
  alias create_gold_window_normal_sc create_gold_window
  def create_gold_window
    create_gold_window_normal_sc
   #@gold_window.y -= 24
  end
end

[/pre]

点评

太謝謝了~  发表于 2013-8-26 21:28

评分

参与人数 1梦石 +2 收起 理由
Sion + 2 认可答案

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部