collapse collapse

 Community


 User Info




Willkommen Gast. Bitte einloggen oder registrieren.

 Partnerseiten

rpgvx.net

Das Forum ist offline

Autor Thema: Alchemiescript?  (Gelesen 2744 mal)

Offline Kyoshiro

  • Global Mod
  • RPGVX-Forengott
  • ****
  • Beiträge: 1623
  • Stand up and fight!
    • Mein Blog
Alchemiescript?
« am: März 30, 2008, 12:25:32 »
Hallo Communitiy,

ich bin auf der Suche nach einem Alchemiescript bei dem man einfach zwei bis drei (können auch mehr sein) Gegenstände miteinander kombinieren kann und dann ein neuer entsteht.
Gibt es ein solches Script schon für den VX? Ich selber habe noch nichts gefunden.

Ich würde mich freuen wenn jmd mr da weiterhelfen könnte^^.

Kyo

Alchemiescript?

Offline Phi

  • Forscher
  • Eventmeister
  • ***
  • Beiträge: 368
  • Im Auftrag der Wissenschaft
Alchemiescript?
« Antwort #1 am: März 30, 2008, 15:13:42 »
das kann man doch auch total einfach mit events machen.
oder brauchst du  unbedingt ein script


EDIT:
hab grad gesehen das es ja nicht in der scriptabteilung ist o.0"
wenn ich Zeit hab mach ich zwei Tutorials, eins mit rezepten die abfragen ob man alles hat, und eins mit freier ausprobiererei die rezepte erstellen wenns erfolgreich war (wie VD2 das runenmenü nur nicht ganz so aufwendig)
« Letzte Änderung: März 30, 2008, 15:18:38 von derRofler »

Alchemiescript?

Offline Kyoshiro

  • Global Mod
  • RPGVX-Forengott
  • ****
  • Beiträge: 1623
  • Stand up and fight!
    • Mein Blog
Alchemiescript?
« Antwort #2 am: März 30, 2008, 15:20:09 »
Das weiß ich auch, nur leider werden das dann zu viele Events^^.
Zumindest wenn ich das so umsetze, wie ich das will.

Ich habe ein Script gefunden, leider nur auf japanisch wo ich nichts verstehe >.< .

Spoiler for Hiden:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ? ?????? - KGC_ComposeItem ? VX ?
#_/    ? Last update : 2008/01/25 ?
#_/----------------------------------------------------------------------------
#_/  ?????????????????????????????????
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ? ???????? - Customize ?
#==============================================================================

module KGC
module ComposeItem
  # ? ????????????????????
  #  ??????? ON ??????????????????????????
  COMPOSE_CALL_SWITCH = 2

  # ? ?????
  #  «??, "???:ID,??", ...»
  #  ? ?? ?????
  #  ???????????? (I..????  W..??  A..??)
  #  ?  ID  ??????ID (????)
  #  ? ?? ?????????
  #  "???:ID,??" ?????????????
  #  ??????? "???:ID" ?????????? 1 ????????
  #  ??? 0 ??????1 ????????????????????
  #  ??????????????·??·??ID?????????
  RECIPE_ITEM   = []  # ????
  RECIPE_WEAPON = []  # ??
  RECIPE_ARMOR  = []  # ??
  # ????????????????
  #  <???>
  #  ????ID:8 ??????
  #  ????ID 2, 4, 7 ? 1 ?????????
  RECIPE_ITEM[8] = [0, "I:2", "I:4", "I:7"]
  #  ??ID:16 ??????
  #  ??ID:10 ? 1??????ID:16 ? 2 ????800 G?
  RECIPE_WEAPON[16] = [800, "W:10", "I:16,2"]

  # ? ???????
  #  "????" ???????????????
  #  ? ???????? [Vocab] ??????
  VOCAB_COMPOSE_ITEM = "????"
  # ? ???????????????
  #  ?????? <--> ?????(?????)???????????
  #  ???????? nil ????
  SWITCH_INFO_BUTTON = Input::X

  # ? ????????????????
  #  ????????? true ????????
  COMPACT_MATERIAL_LIST = true
  # ? ???????????????
  #  XP ???????????????
  HIDE_COMMAND_WINDOW   = false
  # ? ??????????????
  #  HIDE_COMMAND_WINDOW ? false ????????????
  HIDE_GOLD_WINDOW      = false
  # ? ????? 0 ????????????
  HIDE_ZERO_COST        = true

  # ? ??·??????????????
  #  ?????????????????????????
  HIDE_SHORTAGE_RECIPE     = false
  # ? ?????????????????????
  MASK_UNKNOWN_RECIPE_NAME = true
  # ? ???????????????????
  #  1????????????????????????????
  UNKNOWN_NAME_MASK        = "?"
  # ? ???????????????????
  HIDE_UNKNOWN_RECIPE_HELP = true
  # ? ????????????????????
  UNKNOWN_RECIPE_HELP      = "????????????"
end
end

#???????????????????????????????????????

$imported = {} if $imported == nil
$imported["ComposeItem"] = true

module KGC::ComposeItem
  # ???????
  module Regexp
    # ???
    RECIPE = /([IWA])[ ]*:[ ]*(\d+)([ ]*,[ ]*\d+)?/i
  end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Vocab
#==============================================================================

module Vocab
  # ????
  ComposeItem = KGC::ComposeItem::VOCAB_COMPOSE_ITEM
end

#???????????????????????????????????????

#==============================================================================
# ¦ RPG::BaseItem
#==============================================================================

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  @@__masked_name =
    KGC::ComposeItem::UNKNOWN_NAME_MASK  # ????
  @@__expand_masked_name = false         # ???????????

  if @@__masked_name != nil
    @@__expand_masked_name = (@@__masked_name.scan(/./).size == 1)
  end
  #--------------------------------------------------------------------------
  # ? ??????????????
  #--------------------------------------------------------------------------
  def create_compose_item_cache
    @__compose_cost = 0
    @__compose_materials = []

    # ?????
    recipe = nil
    case self
    when RPG::Item    # ????
      recipe = KGC::ComposeItem::RECIPE_ITEM[self.id]
    when RPG::Weapon  # ??
      recipe = KGC::ComposeItem::RECIPE_WEAPON[self.id]
    when RPG::Armor   # ??
      recipe = KGC::ComposeItem::RECIPE_ARMOR[self.id]
    end
    return if recipe == nil
    recipe = recipe.dup

    @__compose_cost = recipe.shift
    # ????????
    recipe.each { |r|
      if r =~ KGC::ComposeItem::Regexp::RECIPE
        material = Game_ComposeMaterial.new
        material.kind = $1.upcase                    # ????????
        material.id = $2.to_i                        # ??? ID ???
        if $3 != nil
          material.number = [$3[/\d+/].to_i, 0].max  # ??????
        end
        @__compose_materials << material
      end
    }
  end
  #--------------------------------------------------------------------------
  # ? ????
  #--------------------------------------------------------------------------
  def masked_name
    if KGC::ComposeItem::MASK_UNKNOWN_RECIPE_NAME
      if @@__expand_masked_name
        # ???????????
        return @@__masked_name * self.name.scan(/./).size
      else
        return @@__masked_name
      end
    else
      return self.name
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  def compose_cost
    create_compose_item_cache if @__compose_cost == nil
    return @__compose_cost
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def compose_materials
    create_compose_item_cache if @__compose_materials == nil
    return @__compose_materials
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def is_compose?
    return !compose_materials.empty?
  end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Game_Party
#==============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # ? ???????????
  #--------------------------------------------------------------------------
  def clear_composed_flag
    @item_composed = {}
    @weapon_composed = {}
    @armor_composed = {}
  end
  #--------------------------------------------------------------------------
  # ? ???????????????
  #     item : ????
  #     flag : true..????  false..???
  #--------------------------------------------------------------------------
  def set_item_composed(item, flag = true)
    return false unless item.is_a?(RPG::BaseItem)  # ??????
    return false unless item.is_compose?           # ????????

    # ???????????????????
    clear_composed_flag if @item_composed == nil

    # ???????????
    case item
    when RPG::Item    # ????
      @item_composed[item.id] = flag
    when RPG::Weapon  # ??
      @weapon_composed[item.id] = flag
    when RPG::Armor   # ??
      @armor_composed[item.id] = flag
    end
  end
  #--------------------------------------------------------------------------
  # ? ???????????
  #     item : ????
  #--------------------------------------------------------------------------
  def item_composed?(item)
    return false unless item.is_a?(RPG::BaseItem)  # ??????
    return false unless item.is_compose?           # ????????

    # ???????????????????
    clear_composed_flag if @item_composed == nil

    # ??????
    case item
    when RPG::Item    # ????
      return @item_composed[item.id]
    when RPG::Weapon  # ??
      return @weapon_composed[item.id]
    when RPG::Armor   # ??
      return @armor_composed[item.id]
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ? ???????????
  #     item : ????
  #--------------------------------------------------------------------------
  def item_can_compose?(item)
    return false unless item.is_a?(RPG::BaseItem)  # ?????????
    return false unless item.is_compose?           # ???????????

    return false if gold < item.compose_cost       # ????????

    item.compose_materials.each { |material|
      num = item_number(material.item)
      # ????????
      return false if num < material.number || num == 0
    }
    return true
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #     item : ????
  #--------------------------------------------------------------------------
  def number_of_composable(item)
    return 0 unless item.is_a?(RPG::BaseItem)  # ??????
    return 0 unless item.is_compose?           # ????????

    number = ($imported["LimitBreak"] ? item.number_limit : 99)
    if item.compose_cost > 0
      number = [number, gold / item.compose_cost].min
    end
    # ?????
    item.compose_materials.each { |material|
      next if material.number == 0  # ??? 0 ???
      n = item_number(material.item) / material.number
      number = [number, n].min
    }
    return number
  end
end

#???????????????????????????????????????

#==============================================================================
# ? Game_ComposeMaterial
#------------------------------------------------------------------------------
#   ??????????????????
#==============================================================================

class Game_ComposeMaterial
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  attr_accessor :kind                     # ??????? (/[IWA]/)
  attr_accessor :id                       # ????? ID
  attr_accessor :number                   # ???
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def initialize
    @kind = "I"
    @id = 0
    @number = 1
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def item
    case @kind
    when "I"  # ????
      return $data_items[@id]
    when "W"  # ??
      return $data_weapons[@id]
    when "A"  # ??
      return $data_armors[@id]
    else
      return nil
    end
  end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Window_Base
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ? ??????????
  #     item    : ???? (????????????)
  #     x       : ??? X ??
  #     y       : ??? Y ??
  #     enabled : ??????false ?????????
  #--------------------------------------------------------------------------
  def draw_compose_item_name(item, x, y, enabled = true)
    return if item == nil

    draw_icon(item.icon_index, x, y, enabled)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(x + 24, y, 172, WLH,
      $game_party.item_composed?(item) ? item.name : item.masked_name)
  end
end
  
#???????????????????????????????????????

#==============================================================================
# ? Window_ComposeNumber
#------------------------------------------------------------------------------
#   ??????????????????????????????
#==============================================================================

class Window_ComposeNumber < Window_ShopNumber
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    y = 96
    self.contents.clear
    draw_compose_item_name(@item, 0, y)
    self.contents.font.color = normal_color
    self.contents.draw_text(212, y, 20, WLH, "×")
    self.contents.draw_text(248, y, 20, WLH, @number, 2)
    self.cursor_rect.set(244, y, 28, WLH)
    if !KGC::ComposeItem::HIDE_ZERO_COST || @price > 0
      draw_currency_value(@price * @number, 4, y + WLH * 2, 264)
    end
  end
end

#???????????????????????????????????????

#==============================================================================
# ? Window_ComposeItem
#------------------------------------------------------------------------------
#   ?????????????????????????????
#==============================================================================

class Window_ComposeItem < Window_ShopBuy
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for goods_item in @shop_goods
      case goods_item[0]
      when 0
        item = $data_items[goods_item[1]]
      when 1
        item = $data_weapons[goods_item[1]]
      when 2
        item = $data_armors[goods_item[1]]
      end
      # ??????????
      @data.push(item) if include?(item)
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # ? ????????????????
  #     item : ????
  #--------------------------------------------------------------------------
  def include?(item)
    return false if item == nil                # ????? nil ??????
    return false unless item.is_compose?       # ???????????????
    if KGC::ComposeItem::HIDE_SHORTAGE_RECIPE  # ??·?????????
      if !$game_party.item_composed?(item) && !enable?(item)
        return false  # ???????????????
      end
    end

    return true
  end
  #--------------------------------------------------------------------------
  # ? ??????????????????
  #     item : ????
  #--------------------------------------------------------------------------
  def enable?(item)
    return $game_party.item_can_compose?(item)
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #     index : ????
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item)
    limit = ($imported["LimitBreak"] ? item.number_limit : 99)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_compose_item_name(item, rect.x, rect.y, enable?(item))
    # ?????
    if !KGC::ComposeItem::HIDE_ZERO_COST || item.compose_cost > 0
      rect.width -= 4
      self.contents.draw_text(rect, item.compose_cost, 2)
    end
  end

  if KGC::ComposeItem::HIDE_UNKNOWN_RECIPE_HELP
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def update_help
    item = (index >= 0 ? @data[index] : nil)
    if item == nil || $game_party.item_composed?(item)
      # ????? nil ???????? [Window_ShopBuy] ????
      super
    else
      @help_window.set_text(KGC::ComposeItem::UNKNOWN_RECIPE_HELP)
    end
  end
  end
end

#???????????????????????????????????????

#==============================================================================
# ? Window_ComposeStatus
#------------------------------------------------------------------------------
#  ?????????????????????????????
#==============================================================================

class Window_ComposeStatus < Window_ShopStatus
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  MODE_MATERIAL = 0  # ?????
  MODE_STATUS   = 1  # ??????????
  #--------------------------------------------------------------------------
  # ? ?????????
  #     x : ?????? X ??
  #     y : ?????? Y ??
  #--------------------------------------------------------------------------
  def initialize(x, y)
    @mode = MODE_MATERIAL
    super(x, y)
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  def change_mode
    case @mode
    when MODE_MATERIAL
      @mode = MODE_STATUS
    when MODE_STATUS
      @mode = MODE_MATERIAL
    end
    self.oy = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  def create_contents
    if @mode == MODE_STATUS
      super
      return
    end

    self.contents.dispose
    ch = height - 32
    if @item != nil
      mag = (KGC::ComposeItem::COMPACT_MATERIAL_LIST ? 1 : 2)
      ch = [ch, WLH * (mag + @item.compose_materials.size * mag)].max
    end
    self.contents = Bitmap.new(width - 32, ch)
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    create_contents
    self.contents.font.size = Font.default_size
    case @mode
    when MODE_MATERIAL
      draw_material_list
    when MODE_STATUS
      super
    end
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def draw_material_list
    return if @item == nil
    number = $game_party.item_number(@item)
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 200, WLH, number, 2)
    self.contents.font.size = 16 if KGC::ComposeItem::COMPACT_MATERIAL_LIST
    mag = (KGC::ComposeItem::COMPACT_MATERIAL_LIST ? 1 : 2)
    @item.compose_materials.each_with_index { |material, i|
      y = WLH * (mag + i * mag)
      draw_material_info(0, y, material)
    }
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def draw_material_info(x, y, material)
    m_item = material.item
    return if m_item == nil
    number = $game_party.item_number(m_item)
    enabled = (number > 0 && number >= material.number)
    draw_item_name(m_item, x, y, enabled)
    if KGC::ComposeItem::COMPACT_MATERIAL_LIST
      m_number = (material.number == 0 ? "-" : sprintf("%d", material.number))
      self.contents.draw_text(x, y, width - 32, WLH,
        sprintf("%s/%d", m_number, number), 2)
    else
      m_number = (material.number == 0 ? "-" : sprintf("%2d", material.number))
      self.contents.draw_text(x, y + WLH, width - 32, WLH,
        sprintf("%2s/%2d", m_number, number), 2)
    end
  end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ? ????????????
  #--------------------------------------------------------------------------
  alias call_shop_KGC_ComposeItem call_shop
  def call_shop
    # ????????????
    if $game_switches[KGC::ComposeItem::COMPOSE_CALL_SWITCH]
      # ???????
      $game_temp.next_scene = nil
      $game_switches[KGC::ComposeItem::COMPOSE_CALL_SWITCH] = false
      $scene = Scene_ComposeItem.new
    else
      call_shop_KGC_ComposeItem
    end
  end
end

#???????????????????????????????????????

#==============================================================================
# ? Scene_ComposeItem
#------------------------------------------------------------------------------
#  ????????????????
#==============================================================================

class Scene_ComposeItem < Scene_Shop
  #--------------------------------------------------------------------------
  # ? ????
  #--------------------------------------------------------------------------
  def start
    super
    # ????????????
    if KGC::ComposeItem::HIDE_COMMAND_WINDOW
      @command_window.visible = false
      @gold_window.y = Graphics.height - @gold_window.height
      @gold_window.z = @status_window.z + 100
      @gold_window.visible = !KGC::ComposeItem::HIDE_GOLD_WINDOW

      @dummy_window.y = @command_window.y
      @dummy_window.height += @command_window.height
    end

    # [Scene_Shop] ????????????? @buy_window ???
    @buy_window.dispose
    @buy_window = Window_ComposeItem.new(0, @dummy_window.y)
    @buy_window.height = @dummy_window.height
    @buy_window.active = false
    @buy_window.visible = false
    @buy_window.help_window = @help_window

    # ?????????????
    @number_window.dispose
    @number_window = Window_ComposeNumber.new(0, @buy_window.y)
    @number_window.height = @buy_window.height
    @number_window.create_contents
    @number_window.active = false
    @number_window.visible = false

    @status_window.dispose
    @status_window = Window_ComposeStatus.new(@buy_window.width, @buy_window.y)
    @status_window.height = @buy_window.height
    @status_window.create_contents
    @status_window.visible = false

    # ????????????????????????????
    if KGC::ComposeItem::HIDE_COMMAND_WINDOW
      @command_window.active = false
      @dummy_window.visible = false
      @buy_window.active = true
      @buy_window.visible = true
      @buy_window.update_help
      @status_window.visible = true
      @status_window.item = @buy_window.item
    end
  end
  #--------------------------------------------------------------------------
  # ? ????????????
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::ComposeItem
    s2 = Vocab::ShopSell
    s3 = Vocab::ShopCancel
    @command_window = Window_Command.new(384, [s1, s2, s3], 3)
    @command_window.y = 56
    if $game_temp.shop_purchase_only
      @command_window.draw_item(1, false)
    end
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def update
    super
    if KGC::ComposeItem::SWITCH_INFO_BUTTON != nil &&
        Input.trigger?(KGC::ComposeItem::SWITCH_INFO_BUTTON)
      Sound.play_cursor
      @status_window.change_mode
    end
  end
  #--------------------------------------------------------------------------
  # ? ???????????
  #--------------------------------------------------------------------------
  def update_buy_selection
    # ????????????? B ??????????
    if KGC::ComposeItem::HIDE_COMMAND_WINDOW && Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
      return
    end

    @status_window.item = @buy_window.item
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      # ?????????????
      if @item == nil
        Sound.play_buzzer
        return
      end

      # ????? or ??????????????????
      number = $game_party.item_number(@item)
      limit = ($imported["LimitBreak"] ? @item.number_limit : 99)
      if !$game_party.item_can_compose?(@item) || number == limit
        Sound.play_buzzer
        return
      end

      # ?????????
      Sound.play_decision
      max = $game_party.number_of_composable(@item)
      max = [max, limit - number].min
      @buy_window.active = false
      @buy_window.visible = false
      @number_window.set(@item, max, @item.compose_cost)
      @number_window.active = true
      @number_window.visible = true
      return
    end

    super
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def decide_number_input
    if @command_window.index != 0  # ????????
      super
      return
    end

    Sound.play_shop
    @number_window.active = false
    @number_window.visible = false
    # ????
    operation_compose
    @gold_window.refresh
    @buy_window.refresh
    @status_window.refresh
    @buy_window.active = true
    @buy_window.visible = true
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  def operation_compose
    $game_party.lose_gold(@number_window.number * @item.compose_cost)
    $game_party.gain_item(@item, @number_window.number)
    # ??????
    @item.compose_materials.each { |material|
      $game_party.lose_item(material.item,
        material.number * @number_window.number)
    }
    # ???????
    $game_party.set_item_composed(@item)
  end
end

Wenn ich das auf Englisch hätte wäre mein Problem ja gelöst^^'' .

Alchemiescript?

ERZENGEL

  • Gast
Alchemiescript?
« Antwort #3 am: März 30, 2008, 15:36:25 »
Hier ist ne englische Übersetzung:
Spoiler for Hiden:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/    ?                Synthesize Items - KGC_ComposeItem               ? VX ?
#_/    ?                     Last Update: 2008/01/25                          ?
#_/    ?                  Translation by Mr. Anonymous                        ?
#_/    ?                Special credit to Moon for Testing                    ?
#_/-----------------------------------------------------------------------------
#_/  This script opens the ability for the designer to allow items, weapons, &
#_/   armor to be created by the player through specified "recipies". It also
#_/   extends the normal shop event into becoming a Synthesize Shop, controlled
#_/   by a simple ON/OFF switch.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

#==============================================================================#
#                            ? Customization ?                                 #
#==============================================================================#

module KGC
 module ComposeItem
  #                       ? Compose Shop Switch ?
  #  This allows you to assign which SwitchID (Event Commands, Page 1 "Game
  #   Progression", Control Switch) you wish to control the Synthesis Shop on.
  #  When that switch is turned ON, the Synthesis Shop replaces the normal
  #  shop screen. When OFF, the shop is normal.
  COMPOSE_CALL_SWITCH = 2

  #                          ? Recipe Tables ?
  #  The following lines allow you to create recipe tables of synthesizable
  #   items, weapons, and other equipment. Please do note overwrite:
  #           RECIPE_ITEM   = []  # Item
  #           RECIPE_WEAPON = []  # Weapon
  #           RECIPE_ARMOR  = []  # Armor
  #   Instead, add your custom recipes tables after those lines.
  #
  #  ? Format
  #   RECIPE_TYPE[ItemID] = [Cost, "Type:ID",Quantity]
  #
  #  ? Key
  #   Cost:     Amount of money charged.
  #   Type:     (I.Items  W.Weapons  A.Armor)
  #   ID:       The ID number for the above specified material type.
  #   Quantity: The required amount of materials used.
  #
  #  "Type:ID,Quantity" can be used multiple times for multiple items with their
  #   corresponding quantity. Also, the must be no space between the comma and
  #   the given quantity.
  #  The required quantity of an item is treated as 1 if quantity is omitted.
  #  Untested: It seems if you set Quantity to 0, the item is still required,
  #            but not 'consumed' or used.
  #  Also note that the item to be synthesized can be written as an array,
  #   allowing you to create multiple items of the same type that can be
  #   synthesized from the same recipe.
  RECIPE_ITEM   = []  # Item
  RECIPE_WEAPON = []  # Weapon
  RECIPE_ARMOR  = []  # Armor
  #                  ? Custom Recipe Tables Inserted Below ?
  #   Examples:
  #     *Note: I use the default database items for these examples.
  #  Recipe for ItemID:8 (Elixer)
  #   Requirements: ItemID 2 (High potion), 4 (Magic water), 7 (Dispel herb)
  #   with a quantity of 1 for each(because it's omitted), at a cost of 0.
  RECIPE_ITEM[8] = [0, "I:2", "I:4", "I:7"] # This can be replaced/removed.
  #  Recipe for WeaponID:16 (Flamberge)
  #   Requirements: WeaponID:10 (Bastard Sword)x1, ItemID:16 (Flame scroll)x2
  #   at a cost of 800 gold.
  RECIPE_WEAPON[16] = [800, "W:10", "I:16,2"] # This can be replaced/removed.
  #  Recipe for ArmorID:29 (Life Ring) AND ArmorID:30 (Sage's Ring)
  #   Requirements: ArmorID:23 (Fire Ring)x1, ItemID:9 (Life up)x1,
  #                 ItemID:10 (Mana up)x1, ItemID:4 (Magic water)x5
  #   at a cost of 1,000 gold.
  RECIPE_ARMOR[29, 30] = [1000, "A:23", "I:09", "I:10", "I:4,5"] # Removable

  #                     ? Recipes For the Demo Only ?
  # The following recipes are for items used in the demo. You may remove these.
  RECIPE_ITEM[2]    = [0, "I:1,2"]
  RECIPE_ITEM[3]    = [0, "I:1,3"]
  RECIPE_ITEM[9]    = [0, "I:3,3", "I:4,3"]
  RECIPE_WEAPON[32] = [0, "W:30", "I:9,2"]
  RECIPE_WEAPON[33] = [0, "W:7,2", "A:9"]
  RECIPE_WEAPON[34] = [0, "W:22", "I:23", "I:16"]
  RECIPE_ARMOR[38]  = [0, "A:16", "I:10,2"]
  RECIPE_ARMOR[39]  = [0, "A:20", "I:9,2"]
  RECIPE_ARMOR[40]  = [0, "A:21", "W:6"]
  RECIPE_ARMOR[41]  = [0, "A:22", "I:24"]
  RECIPE_ARMOR[43]  = [0, "A:38", "I:25"]
  RECIPE_ARMOR[45]  = [0, "A:7", "A:46"]
  RECIPE_ARMOR[46]  = [0, "A:10", "A:12", "A:30", "I:16"]
  
  # ? Synthetic command name
  #  It is displayed at the position of the "Buy" command
  VOCAB_COMPOSE_ITEM = "Synthesize"
  # ? Synthetic item information switch button
  #  Button that switches "Material List <--> parameter change
  #  (Only the equipment goods :)
  #  Nil is specified when not using it
  SWITCH_INFO_BUTTON = Input::X

  # ? COMPACT_MATERIAL_LIST
  #  Please make it to true when there are a lot of numbers ofmaterials in which the necessary material list is compactly done
  COMPACT_MATERIAL_LIST = true
  #  Hide Command Window Toggle
  #   true = command window is hidden
  #   false = command window is shown
  HIDE_COMMAND_WINDOW   = false
  #  Hide Gold Window Toggle
  #   true = Hides the Gold/Money window.
 #    false = Disply the Gold/Money window.
  #  *Note: If HIDE_COMMAND_WINDOW = false, The gold window is always displayed.
  HIDE_GOLD_WINDOW      = false
  #  Hide Zero Cost Toggle
  #   true = When a synthesis recipe has a cost of 0, the cost is not displayed.
  #   false = When a synthesis recipe has a cost of 0, the cost is displayed.
  HIDE_ZERO_COST        = true

  #  Hide Recipe Requirements Toggle
  #   true = Hide recipe costs and items required when you lack the items needed
  #   false = Show recipe requirements when you lack the items needed.
  HIDE_SHORTAGE_RECIPE     = false
  #  Unknown Recipe Toggle
  #   true = Hides the names of recipes that cannot be synthesized.
  #   false = All recipe names are visible.
  MASK_UNKNOWN_RECIPE_NAME = true
  #  Text Displayed on Masked Recipes
  #   If only one character is specified, it extends the length of the recipe
  #   name. Example: If UNKNOWN_NAME_MASK = "?", and let's say the recipe is
  #    for a Long Sword, then the displayed text would be "??????????"
  UNKNOWN_NAME_MASK        = "Unknown Item"
  #  This toggle allows you to mask the text displayed in the "Help" (topmost)
  #   window of a recipe that the player doesn't meet the requirements to make.
  #   true = mask the recipe's help text
  #   false = display the text normally
  HIDE_UNKNOWN_RECIPE_HELP = true
  #  This allows you to change the text displayed in the "Help" (topmost) window
  #   of an unknown recipe. (When HIDE_UNKNOWN_RECIPE_HELP = true)
  UNKNOWN_RECIPE_HELP      = "What does this recipe create? Who knows!"
end
end

# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #

$imported = {} if $imported == nil
$imported["ComposeItem"] = true

# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
#  Unless you know what you're doing, it's best not to alter anything beyond  #
#  this point, as this only affects the tags used for "Notes" in database.    #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
#  Whatever word(s) are after the separator ( | ) in the following lines are
#   what are used to determine what is searched for in the "Notes" section.

module KGC::ComposeItem
  # Regular expression defined.
  module Regexp
    # Recipe tag string.
    RECIPE = /([IWA])[ ]*:[ ]*(\d+)([ ]*,[ ]*\d+)?/i
  end
end

#==============================================================================
# ¦ Vocab
#==============================================================================

module Vocab
  # ????
  ComposeItem = KGC::ComposeItem::VOCAB_COMPOSE_ITEM
end

#==============================================================================
# ¦ RPG::BaseItem
#==============================================================================

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  @@__masked_name =
    KGC::ComposeItem::UNKNOWN_NAME_MASK  # ????
  @@__expand_masked_name = false         # ???????????

  if @@__masked_name != nil
    @@__expand_masked_name = (@@__masked_name.scan(/./).size == 1)
  end
  #--------------------------------------------------------------------------
  # ? ??????????????
  #--------------------------------------------------------------------------
  def create_compose_item_cache
    @__compose_cost = 0
    @__compose_materials = []

    # ?????
    recipe = nil
    case self
    when RPG::Item    # ????
      recipe = KGC::ComposeItem::RECIPE_ITEM[self.id]
    when RPG::Weapon  # ??
      recipe = KGC::ComposeItem::RECIPE_WEAPON[self.id]
    when RPG::Armor   # ??
      recipe = KGC::ComposeItem::RECIPE_ARMOR[self.id]
    end
    return if recipe == nil
    recipe = recipe.dup

    @__compose_cost = recipe.shift
    # ????????
    recipe.each { |r|
      if r =~ KGC::ComposeItem::Regexp::RECIPE
        material = Game_ComposeMaterial.new
        material.kind = $1.upcase                    # ????????
        material.id = $2.to_i                        # ??? ID ???
        if $3 != nil
          material.number = [$3[/\d+/].to_i, 0].max  # ??????
        end
        @__compose_materials << material
      end
    }
  end
  #--------------------------------------------------------------------------
  # ? ????
  #--------------------------------------------------------------------------
  def masked_name
    if KGC::ComposeItem::MASK_UNKNOWN_RECIPE_NAME
      if @@__expand_masked_name
        # ???????????
        return @@__masked_name * self.name.scan(/./).size
      else
        return @@__masked_name
      end
    else
      return self.name
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  def compose_cost
    create_compose_item_cache if @__compose_cost == nil
    return @__compose_cost
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def compose_materials
    create_compose_item_cache if @__compose_materials == nil
    return @__compose_materials
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def is_compose?
    return !compose_materials.empty?
  end
end

#==============================================================================
# ¦ Game_Party
#==============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # ? ???????????
  #--------------------------------------------------------------------------
  def clear_composed_flag
    @item_composed = {}
    @weapon_composed = {}
    @armor_composed = {}
  end
  #--------------------------------------------------------------------------
  # ? ???????????????
  #     item : ????
  #     flag : true..????  false..???
  #--------------------------------------------------------------------------
  def set_item_composed(item, flag = true)
    return false unless item.is_a?(RPG::BaseItem)  # ??????
    return false unless item.is_compose?           # ????????

    # ???????????????????
    clear_composed_flag if @item_composed == nil

    # ???????????
    case item
    when RPG::Item    # ????
      @item_composed[item.id] = flag
    when RPG::Weapon  # ??
      @weapon_composed[item.id] = flag
    when RPG::Armor   # ??
      @armor_composed[item.id] = flag
    end
  end
  #--------------------------------------------------------------------------
  # ? ???????????
  #     item : ????
  #--------------------------------------------------------------------------
  def item_composed?(item)
    return false unless item.is_a?(RPG::BaseItem)  # ??????
    return false unless item.is_compose?           # ????????

    # ???????????????????
    clear_composed_flag if @item_composed == nil

    # ??????
    case item
    when RPG::Item    # ????
      return @item_composed[item.id]
    when RPG::Weapon  # ??
      return @weapon_composed[item.id]
    when RPG::Armor   # ??
      return @armor_composed[item.id]
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ? ???????????
  #     item : ????
  #--------------------------------------------------------------------------
  def item_can_compose?(item)
    return false unless item.is_a?(RPG::BaseItem)  # ?????????
    return false unless item.is_compose?           # ???????????

    return false if gold < item.compose_cost       # ????????

    item.compose_materials.each { |material|
      num = item_number(material.item)
      # ????????
      return false if num < material.number || num == 0
    }
    return true
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #     item : ????
  #--------------------------------------------------------------------------
  def number_of_composable(item)
    return 0 unless item.is_a?(RPG::BaseItem)  # ??????
    return 0 unless item.is_compose?           # ????????

    number = ($imported["LimitBreak"] ? item.number_limit : 99)
    if item.compose_cost > 0
      number = [number, gold / item.compose_cost].min
    end
    # ?????
    item.compose_materials.each { |material|
      next if material.number == 0  # ??? 0 ???
      n = item_number(material.item) / material.number
      number = [number, n].min
    }
    return number
  end
end

#==============================================================================
# ? Game_ComposeMaterial
#------------------------------------------------------------------------------
#   ??????????????????
#==============================================================================

class Game_ComposeMaterial
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  attr_accessor :kind                     # ??????? (/[IWA]/)
  attr_accessor :id                       # ????? ID
  attr_accessor :number                   # ???
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def initialize
    @kind = "I"
    @id = 0
    @number = 1
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def item
    case @kind
    when "I"  # Item
      return $data_items[@id]
    when "W"  # Weapon
      return $data_weapons[@id]
    when "A"  # Armor
      return $data_armors[@id]
    else
      return nil
    end
  end
end

#==============================================================================
# ¦ Window_Base
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ? ??????????
  #     item    : ???? (????????????)
  #     x       : ??? X ??
  #     y       : ??? Y ??
  #     enabled : ??????false ?????????
  #--------------------------------------------------------------------------
  def draw_compose_item_name(item, x, y, enabled = true)
    return if item == nil

    draw_icon(item.icon_index, x, y, enabled)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(x + 24, y, 172, WLH,
      $game_party.item_composed?(item) ? item.name : item.masked_name)
  end
end

#==============================================================================
# ? Window_ComposeNumber
#------------------------------------------------------------------------------
#   ??????????????????????????????
#==============================================================================

class Window_ComposeNumber < Window_ShopNumber
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    y = 96
    self.contents.clear
    draw_compose_item_name(@item, 0, y)
    self.contents.font.color = normal_color
    self.contents.draw_text(212, y, 20, WLH, "×")
    self.contents.draw_text(248, y, 20, WLH, @number, 2)
    self.cursor_rect.set(244, y, 28, WLH)
    if !KGC::ComposeItem::HIDE_ZERO_COST || @price > 0
      draw_currency_value(@price * @number, 4, y + WLH * 2, 264)
    end
  end
end

#==============================================================================
# ? Window_ComposeItem
#------------------------------------------------------------------------------
#   ?????????????????????????????
#==============================================================================

class Window_ComposeItem < Window_ShopBuy
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for goods_item in @shop_goods
      case goods_item[0]
      when 0
        item = $data_items[goods_item[1]]
      when 1
        item = $data_weapons[goods_item[1]]
      when 2
        item = $data_armors[goods_item[1]]
      end
      # ??????????
      @data.push(item) if include?(item)
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # ? ????????????????
  #     item : ????
  #--------------------------------------------------------------------------
  def include?(item)
    return false if item == nil                # ????? nil ??????
    return false unless item.is_compose?       # ???????????????
    if KGC::ComposeItem::HIDE_SHORTAGE_RECIPE  # ??·?????????
      if !$game_party.item_composed?(item) && !enable?(item)
        return false  # ???????????????
      end
    end

    return true
  end
  #--------------------------------------------------------------------------
  # ? ??????????????????
  #     item : ????
  #--------------------------------------------------------------------------
  def enable?(item)
    return $game_party.item_can_compose?(item)
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #     index : ????
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item)
    limit = ($imported["LimitBreak"] ? item.number_limit : 99)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_compose_item_name(item, rect.x, rect.y, enable?(item))
    # ?????
    if !KGC::ComposeItem::HIDE_ZERO_COST || item.compose_cost > 0
      rect.width -= 4
      self.contents.draw_text(rect, item.compose_cost, 2)
    end
  end

  if KGC::ComposeItem::HIDE_UNKNOWN_RECIPE_HELP
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def update_help
    item = (index >= 0 ? @data[index] : nil)
    if item == nil || $game_party.item_composed?(item)
      # ????? nil ???????? [Window_ShopBuy] ????
      super
    else
      @help_window.set_text(KGC::ComposeItem::UNKNOWN_RECIPE_HELP)
    end
  end
  end
end

#==============================================================================
# ? Window_ComposeStatus
#------------------------------------------------------------------------------
#  ?????????????????????????????
#==============================================================================

class Window_ComposeStatus < Window_ShopStatus
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  MODE_MATERIAL = 0  # ?????
  MODE_STATUS   = 1  # ??????????
  #--------------------------------------------------------------------------
  # ? ?????????
  #     x : ?????? X ??
  #     y : ?????? Y ??
  #--------------------------------------------------------------------------
  def initialize(x, y)
    @mode = MODE_MATERIAL
    super(x, y)
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  def change_mode
    case @mode
    when MODE_MATERIAL
      @mode = MODE_STATUS
    when MODE_STATUS
      @mode = MODE_MATERIAL
    end
    self.oy = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  def create_contents
    if @mode == MODE_STATUS
      super
      return
    end

    self.contents.dispose
    ch = height - 32
    if @item != nil
      mag = (KGC::ComposeItem::COMPACT_MATERIAL_LIST ? 1 : 2)
      ch = [ch, WLH * (mag + @item.compose_materials.size * mag)].max
    end
    self.contents = Bitmap.new(width - 32, ch)
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    create_contents
    self.contents.font.size = Font.default_size
    case @mode
    when MODE_MATERIAL
      draw_material_list
    when MODE_STATUS
      super
    end
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def draw_material_list
    return if @item == nil
    number = $game_party.item_number(@item)
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 200, WLH, number, 2)
    self.contents.font.size = 16 if KGC::ComposeItem::COMPACT_MATERIAL_LIST
    mag = (KGC::ComposeItem::COMPACT_MATERIAL_LIST ? 1 : 2)
    @item.compose_materials.each_with_index { |material, i|
      y = WLH * (mag + i * mag)
      draw_material_info(0, y, material)
    }
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def draw_material_info(x, y, material)
    m_item = material.item
    return if m_item == nil
    number = $game_party.item_number(m_item)
    enabled = (number > 0 && number >= material.number)
    draw_item_name(m_item, x, y, enabled)
    if KGC::ComposeItem::COMPACT_MATERIAL_LIST
      m_number = (material.number == 0 ? "-" : sprintf("%d", material.number))
      self.contents.draw_text(x, y, width - 32, WLH,
        sprintf("%s/%d", m_number, number), 2)
    else
      m_number = (material.number == 0 ? "-" : sprintf("%2d", material.number))
      self.contents.draw_text(x, y + WLH, width - 32, WLH,
        sprintf("%2s/%2d", m_number, number), 2)
    end
  end
end

#==============================================================================
# ¦ Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ? ????????????
  #--------------------------------------------------------------------------
  alias call_shop_KGC_ComposeItem call_shop
  def call_shop
    # ????????????
    if $game_switches[KGC::ComposeItem::COMPOSE_CALL_SWITCH]
      # ???????
      $game_temp.next_scene = nil
      $game_switches[KGC::ComposeItem::COMPOSE_CALL_SWITCH] = false
      $scene = Scene_ComposeItem.new
    else
      call_shop_KGC_ComposeItem
    end
  end
end

#==============================================================================
# ? Scene_ComposeItem
#------------------------------------------------------------------------------
# ComposeItem Shop Screen Class Processing
#==============================================================================

class Scene_ComposeItem < Scene_Shop
  #--------------------------------------------------------------------------
  # ? Begin Processing
  #--------------------------------------------------------------------------
  def start
    super
    # Hide Command Window
    if KGC::ComposeItem::HIDE_COMMAND_WINDOW
      @command_window.visible = false
      @gold_window.y = Graphics.height - @gold_window.height
      @gold_window.z = @status_window.z + 100
      @gold_window.visible = !KGC::ComposeItem::HIDE_GOLD_WINDOW

      @dummy_window.y = @command_window.y
      @dummy_window.height += @command_window.height
    end

    # In [Scene_Shop] the @buy_window is replaced with the Compose Item option
    @buy_window.dispose
    @buy_window = Window_ComposeItem.new(0, @dummy_window.y)
    @buy_window.height = @dummy_window.height
    @buy_window.active = false
    @buy_window.visible = false
    @buy_window.help_window = @help_window

    # Other windows are recomposed
    @number_window.dispose
    @number_window = Window_ComposeNumber.new(0, @buy_window.y)
    @number_window.height = @buy_window.height
    @number_window.create_contents
    @number_window.active = false
    @number_window.visible = false

    @status_window.dispose
    @status_window = Window_ComposeStatus.new(@buy_window.width, @buy_window.y)
    @status_window.height = @buy_window.height
    @status_window.create_contents
    @status_window.visible = false

    # Switch the hidden command window with the compose item option
    if KGC::ComposeItem::HIDE_COMMAND_WINDOW
      @command_window.active = false
      @dummy_window.visible = false
      @buy_window.active = true
      @buy_window.visible = true
      @buy_window.update_help
      @status_window.visible = true
      @status_window.item = @buy_window.item
    end
  end
  #--------------------------------------------------------------------------
  # ? Establishing the Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::ComposeItem
    s2 = Vocab::ShopSell
    s3 = Vocab::ShopCancel
    # This allows you to change the commands in the ComposeItem Shop command
    # window. I've set it to only display the Synthsize option, but...
    # Default @command_window = Window_Command.new(384, [s1, s2, s3], 3)
    @command_window = Window_Command.new(150, [s1], 1)
    @command_window.y = 56
    if $game_temp.shop_purchase_only
      @command_window.draw_item(1, false)
    end
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def update
    super
    if KGC::ComposeItem::SWITCH_INFO_BUTTON != nil &&
        Input.trigger?(KGC::ComposeItem::SWITCH_INFO_BUTTON)
      Sound.play_cursor
      @status_window.change_mode
    end
  end
  #--------------------------------------------------------------------------
  # ? ???????????
  #--------------------------------------------------------------------------
  def update_buy_selection
    # ????????????? B ??????????
    if KGC::ComposeItem::HIDE_COMMAND_WINDOW && Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
      return
    end

    @status_window.item = @buy_window.item
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      # ?????????????
      if @item == nil
        Sound.play_buzzer
        return
      end

      # ????? or ??????????????????
      number = $game_party.item_number(@item)
      limit = ($imported["LimitBreak"] ? @item.number_limit : 99)
      if !$game_party.item_can_compose?(@item) || number == limit
        Sound.play_buzzer
        return
      end

      # ?????????
      Sound.play_decision
      max = $game_party.number_of_composable(@item)
      max = [max, limit - number].min
      @buy_window.active = false
      @buy_window.visible = false
      @number_window.set(@item, max, @item.compose_cost)
      @number_window.active = true
      @number_window.visible = true
      return
    end

    super
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def decide_number_input
    if @command_window.index != 0  # ????????
      super
      return
    end

    Sound.play_shop
    @number_window.active = false
    @number_window.visible = false
    # ????
    operation_compose
    @gold_window.refresh
    @buy_window.refresh
    @status_window.refresh
    @buy_window.active = true
    @buy_window.visible = true
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  def operation_compose
    $game_party.lose_gold(@number_window.number * @item.compose_cost)
    $game_party.gain_item(@item, @number_window.number)
    # ??????
    @item.compose_materials.each { |material|
      $game_party.lose_item(material.item,
        material.number * @number_window.number)
    }
    # ???????
    $game_party.set_item_composed(@item)
  end
end
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/  The original untranslated version of this script can be found here:
# http://f44.aaa.livedoor.jp/~ytomy/tkool/rpgtech/php/tech.php?tool=VX&cat=tech_vx/item&tech=compose_item
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

Alchemiescript?

Offline Kyoshiro

  • Global Mod
  • RPGVX-Forengott
  • ****
  • Beiträge: 1623
  • Stand up and fight!
    • Mein Blog
Alchemiescript?
« Antwort #4 am: März 30, 2008, 16:15:05 »
TRAUMHAFT!!!!!!!!!!!

Vielen Dank, das Script ist echt klasse und dank deiner Hilfe kann ich es auch nutzen^^.
Dann bin ich dem Ziel mein Projekt zu verwirklichen ein Stück näher gekommen  happy.gif\" style=\"vertical-align:middle\" emoid=\"^_^\" border=\"0\" alt=\"happy.gif\" /] .

Nochmals Danke.

Alchemiescript?

Cege

  • Gast
Alchemiescript?
« Antwort #5 am: März 31, 2008, 10:39:43 »
So ein Skript is schon cool =)

Bei mir kommt nur eine Fehlermeldung in der "Window_ShopBuy" Datei in line 30 wenn ich das skript starten will....

28 def refresh
29    @data = []
30    for goods_item in @shop_goods
31      case goods_item[0]
32      when 0

Hmmm... -.-

Re: Alchemiescript?

Afenishakur

  • Gast
Re: Alchemiescript?
« Antwort #6 am: Juli 15, 2008, 23:48:36 »
Wie ruft man denn dieses Script im Spiel dann auf, bzw was fürn Script Code muss ich eigeben?

ne kleine Demo doer so wäre nice xD komme damit nich klar

MfG Afeni

Re: Alchemiescript?

Bah4mut

  • Gast
Re: Alchemiescript?
« Antwort #7 am: Juli 24, 2008, 21:48:57 »
Du must schauen welcher switch denn shop ändert bei dem den du hier runterladen kannst ist das der 2. Switch kannst aber auch ändern packste einfach auf 50 oder so bevor du den shop dann aufrufst must du den switch aktivieren beenden tut er sich von alleine

mfg Bah4mut

 


 Bild des Monats

rooftop party

Views: 3894
By: papilion

 Umfrage

  • Wer soll das BdM gewinnen?
  • Dot Kandidat 1
  • 3 (25%)
  • Dot Kandidat 2
  • 1 (8%)
  • Dot Kandidat 3
  • 2 (16%)
  • Dot Kandidat 4
  • 0 (0%)
  • Dot Kandidat 5
  • 6 (50%)
  • Stimmen insgesamt: 12
  • View Topic

 Schnellsuche





SimplePortal 2.3.3 © 2008-2010, SimplePortal