collapse collapse

 Community


 User Info




Willkommen Gast. Bitte einloggen oder registrieren.

 Partnerseiten

rpgvx.net

Das Forum ist offline

Autor Thema: Kleine Fragen, schnelle Antwort?  (Gelesen 194927 mal)

Offline Galadriela

  • Event-Jongleur
  • **
  • Beiträge: 57
    • Meine Bücher
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1725 am: März 14, 2011, 19:35:25 »
danke das du so schnell geantwortet hast, AAABER ich habe es unter der suchenfunktion gesucht und nicht gefunden oder muß ich danach googlen?  :sad:

Re: Kleine Fragen, schnelle Antwort?

Offline Kyoshiro

  • Global Mod
  • RPGVX-Forengott
  • ****
  • Beiträge: 1623
  • Stand up and fight!
    • Mein Blog
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1726 am: März 14, 2011, 19:59:09 »
Das Script es auf alle Fälle auf rpgmakervx.com...und da fällt mir gerade ein, dass ich die KGC-Demo sogar auf dem Rechner habe, darum kann ich es direkt posten.

Spoiler for Hiden:

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/   ?              Unlimit Parameters - KGC_LimitBreak                 ? VX ?
#_/   ?                   Last update : 2008/01/09                            ?
#_/   ?                 Translatation by Touchfuzzy                           ?
#_/   ? KGC Site:                                                             ?
#_/   ? http://f44.aaa.livedoor.jp/~ytomy/                                    ?
#_/-----------------------------------------------------------------------------
#_/  Installation: Because this script overwrites many classes(given its nature)
#_/   it must be inserted as at top of all other custom scripts.
#_/=============================================================================
#_/  This script allows you to go beyond the game's set limit of levels, stats
#_/   various parameters of enemies, money in hand, and possessed items.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

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

module KGC
 module LimitBreak
  # 0. Levels 1-99 are determined normally, all levels after 99 are determined
  # by the equation used in PARAMETER_CALC_EXP.

  # 1. The stats listed in the database are only used as variables in the
  # following equations:
  #    ax^2 + bx + c
  #    a = What is set in the Database as the level 1 score of the
  #    corresponding stat.
  #    b = What is set in the Database as the level 2 score of the
  #    corresponding stat.
  #    c = What is set in the Database as the level 3 score of the
  #    corresponding stat.
  #    x = characters current level.

  # 2. The stats listed in the database are only used as variables in the
  # following equations:
  #    bx + c
  #    b = What is set in the Database as the level 2 score of the
  #    corresponding stat.
  #    c = What is set in the Database as the level 3 score of the
  #    corresponding stat.
  #    x = characters current level.

  PARAMETER_CALC_METHOD = 0

  # The following is the equation used for level 100 up if you are using
  # PARAMETER_CALC_METHOD = 0.  The following uses the difference between the
  #  stat at level 98 and level 99 at level 100 and each level afterwords.
  PARAMETER_CALC_EXP = "(param[99] - param[98]) * (level - 99)"

  # CHARACTER MAX LEVELS
  ACTOR_FINAL_LEVEL = []  # ? DO NOT REMOVE.
  # Put in the level max you wish for individual characters here
  #   ACTOR_FINAL_LEVEL[actor ID] = max level
  # ? This sets the max level of Actor 1 to 999
  ACTOR_FINAL_LEVEL[1] = 999

  # This sets the max for any character who is not specifically set in the
  # above section.
  ACTOR_FINAL_LEVEL_DEFAULT = 999
  # This sets the max amount of experience a character can earn.
  ACTOR_EXP_LIMIT = 99999999

  # This sets the Max HP a character can gain.
  ACTOR_MAXHP_LIMIT     = 99999
  # This sets the Max MP a character can gain.
  ACTOR_MAXMP_LIMIT     = 99999
  # This sets the max a character gain in Attack, Defense, Spirit, and Agility.
  ACTOR_PARAMETER_LIMIT = 9999

  # This sets the Max HP an enemy can have.
  ENEMY_MAXHP_LIMIT     = 9999999
  # This sets the Max MP an enemy can have.
  ENEMY_MAXMP_LIMIT     = 9999999
  # This sets the max an enemy can have in Attack, Defense, Spirit, and Agility
  ENEMY_PARAMETER_LIMIT = 9999

  # Since you cannot put stats higher than the old maxes in the database this
  # allows you to increase the numbers written in the database.
  # Each as written as a percentage so if you wanted to multiply Max HP by 10
  # then you would enter ENEMY_MAXHP_RATE = 1000
  ENEMY_MAXHP_RATE = 100  # MaxHP
  ENEMY_MAXMP_RATE = 100  # MaxMP
  ENEMY_ATK_RATE   = 100  # Attack
  ENEMY_DEF_RATE   = 100  # Defense
  ENEMY_SPI_RATE   = 100  # Spirit
  ENEMY_AGI_RATE   = 100  # Agility

  # This sets the Max gold a character can have.
  GOLD_LIMIT = 99999999

  # This sets the Max number of items of the same kind a character can carry
  ITEM_NUMBER_LIMIT = 99

  module_function

  # The following lets you set specific stats of enemies individually.

  def set_enemy_parameters
    # Examples
    #  Enemy ID:10 Set MaxHP to 2000000
    # $data_enemies[10].maxhp = 2000000
    #  Enemy ID:16 Set Attack to 5000
    # $data_enemies[16].atk = 5000
    #  Enemy ID:20 Multiply current Defense by 2
    # $data_enemies[20].def *= 2
  end
 end
end

#------------------------------------------------------------------------------#

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

module KGC::LimitBreak
  # Regular Expression Module.
  module Regexp
    # Base Item Module
    module BaseItem
      # Number Limit tag string
      NUMBER_LIMIT = /^<(?:NUMBER_LIMIT|numberlimit)[ ]*(\d+)>/i
    end
  end

  module_function
  #--------------------------------------------------------------------------
  # ? Enemy's ability correction is applied.
  #--------------------------------------------------------------------------
  def revise_enemy_parameters
    (1...$data_enemies.size).each { |i|
      enemy = $data_enemies[i]
      enemy.maxhp = enemy.maxhp * ENEMY_MAXHP_RATE / 100
      enemy.maxmp = enemy.maxmp * ENEMY_MAXMP_RATE / 100
      enemy.atk   = enemy.atk   * ENEMY_ATK_RATE   / 100
      enemy.def   = enemy.def   * ENEMY_DEF_RATE   / 100
      enemy.spi   = enemy.spi   * ENEMY_SPI_RATE   / 100
      enemy.agi   = enemy.agi   * ENEMY_AGI_RATE   / 100
    }
  end
end

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

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # ? Generate Cache: limit Break
  #--------------------------------------------------------------------------
  def create_limit_break_cache
    @__number_limit = KGC::LimitBreak::ITEM_NUMBER_LIMIT

    @note.split(/[\r\n]+/).each { |line|
      if line =~ KGC::LimitBreak::Regexp::BaseItem::NUMBER_LIMIT
        # ?????
        @__number_limit = $1.to_i
      end
    }
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def number_limit
    create_limit_break_cache if @__number_limit == nil
    return @__number_limit
  end
end

#==================================End Class===================================#

#==============================================================================
# ¦ Game_Battler
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # ? MaxHP ??????
  #--------------------------------------------------------------------------
  def maxhp_limit
    return KGC::LimitBreak::ENEMY_MAXHP_LIMIT
  end
  #--------------------------------------------------------------------------
  # ? MaxMP ??????
  #--------------------------------------------------------------------------
  def maxmp_limit
    return KGC::LimitBreak::ENEMY_MAXMP_LIMIT
  end
  #--------------------------------------------------------------------------
  # ? MaxMP ???
  #--------------------------------------------------------------------------
  def maxmp
    return [[base_maxmp + @maxmp_plus, 0].max, maxmp_limit].min
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #--------------------------------------------------------------------------
  def parameter_limit
    return KGC::LimitBreak::ENEMY_PARAMETER_LIMIT
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def atk
    n = [base_atk + @atk_plus, 1].max
    states.each { |state| n *= state.atk_rate / 100.0 }
    n = [[Integer(n), 1].max, parameter_limit].min
    return n
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def def
    n = [base_def + @def_plus, 1].max
    states.each { |state| n *= state.def_rate / 100.0 }
    n = [[Integer(n), 1].max, parameter_limit].min
    return n
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def spi
    n = [base_spi + @spi_plus, 1].max
    states.each { |state| n *= state.spi_rate / 100.0 }
    n = [[Integer(n), 1].max, parameter_limit].min
    return n
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def agi
    n = [base_agi + @agi_plus, 1].max
    states.each { |state| n *= state.agi_rate / 100.0 }
    n = [[Integer(n), 1].max, parameter_limit].min
    return n
  end
  #--------------------------------------------------------------------------
  # ? MaxHP ???
  #     new_maxhp : ??? MaxHP
  #--------------------------------------------------------------------------
  def maxhp=(new_maxhp)
    @maxhp_plus += new_maxhp - self.maxhp
    @maxhp_plus = [[@maxhp_plus, -maxhp_limit].max, maxhp_limit].min
    @hp = [@hp, self.maxhp].min
  end
  #--------------------------------------------------------------------------
  # ? MaxMP ???
  #     new_maxmp : ??? MaxMP
  #--------------------------------------------------------------------------
  def maxmp=(new_maxmp)
    @maxmp_plus += new_maxmp - self.maxmp
    @maxmp_plus = [[@maxmp_plus, -maxmp_limit].max, maxmp_limit].min
    @mp = [@mp, self.maxmp].min
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #     new_atk : ??????
  #--------------------------------------------------------------------------
  def atk=(new_atk)
    @atk_plus += new_atk - self.atk
    @atk_plus = [[@atk_plus, -parameter_limit].max, parameter_limit].min
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #     new_def : ??????
  #--------------------------------------------------------------------------
  def def=(new_def)
    @def_plus += new_def - self.def
    @def_plus = [[@def_plus, -parameter_limit].max, parameter_limit].min
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #     new_spi : ??????
  #--------------------------------------------------------------------------
  def spi=(new_spi)
    @spi_plus += new_spi - self.spi
    @spi_plus = [[@spi_plus, -parameter_limit].max, parameter_limit].min
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #     agi : ??????
  #--------------------------------------------------------------------------
  def agi=(new_agi)
    @agi_plus += new_agi - self.agi
    @agi_plus = [[@agi_plus, -parameter_limit].max, parameter_limit].min
  end
end

#==================================End Class===================================#

#==============================================================================
# ¦ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  def make_exp_list
    @exp_list = Array.new(final_level + 2)
    @exp_list[1] = @exp_list[final_level + 1] = 0
    m = actor.exp_basis
    n = 0.75 + actor.exp_inflation / 200.0
    (2..final_level).each { |i|
      @exp_list[i] = @exp_list[i-1] + Integer(m)
      m *= 1 + n
      n *= 0.9
    }
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def final_level
    n = KGC::LimitBreak::ACTOR_FINAL_LEVEL[self.id]
    return (n != nil ? n : KGC::LimitBreak::ACTOR_FINAL_LEVEL_DEFAULT)
  end
  #--------------------------------------------------------------------------
  # ? MaxHP ??????
  #--------------------------------------------------------------------------
  def maxhp_limit
    return KGC::LimitBreak::ACTOR_MAXHP_LIMIT
  end
  #--------------------------------------------------------------------------
  # ? MaxMP ??????
  #--------------------------------------------------------------------------
  def maxmp_limit
    return KGC::LimitBreak::ACTOR_MAXMP_LIMIT
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #--------------------------------------------------------------------------
  def parameter_limit
    return KGC::LimitBreak::ACTOR_PARAMETER_LIMIT
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def exp_limit
    return KGC::LimitBreak::ACTOR_EXP_LIMIT
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #     exp  : ??????
  #     show : ???????????
  #--------------------------------------------------------------------------
  def change_exp(exp, show)
    last_level = @level
    last_skills = skills
    @exp = [[exp, exp_limit].min, 0].max
    while @exp >= @exp_list[@level+1] && @exp_list[@level+1] > 0
      level_up
    end
    while @exp < @exp_list[@level]
      level_down
    end
    @hp = [@hp, maxhp].min
    @mp = [@mp, maxmp].min
    if show && @level > last_level
      display_level_up(skills - last_skills)
    end
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #     level : ??????
  #     show  : ???????????
  #--------------------------------------------------------------------------
  def change_level(level, show)
    level = [[level, final_level].min, 1].max
    change_exp(@exp_list[level], show)
  end
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  def base_parameter(type)
    case KGC::LimitBreak::PARAMETER_CALC_METHOD
    when 0  # ????
      if @level >= 100
        calc_text = KGC::LimitBreak::PARAMETER_CALC_EXP.dup
        calc_text.gsub!(/level/i) { "@level" }
        calc_text.gsub!(/param\[(\d+)\]/i) {
          "actor.parameters[type, #{$1.to_i}]"
        }
        return actor.parameters[type, 99] + eval(calc_text)
      end
    when 1  # ????
      a = actor.parameters[type, 1]
      b = actor.parameters[type, 2]
      c = actor.parameters[type, 3]
      return ((a * @level + b) * @level + c)
    when 2  # ????
      b = actor.parameters[type, 2]
      c = actor.parameters[type, 3]
      return (b * @level + c)
    end
    return actor.parameters[type, @level]
  end
  #--------------------------------------------------------------------------
  # ? ?? MaxHP ???
  #--------------------------------------------------------------------------
  def base_maxhp
    return base_parameter(0)
  end
  #--------------------------------------------------------------------------
  # ? ?? MaxMP ???
  #--------------------------------------------------------------------------
  def base_maxmp
    return base_parameter(1)
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def base_atk
    n = base_parameter(2)
    equips.compact.each { |item| n += item.atk }
    return n
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def base_def
    n = base_parameter(3)
    equips.compact.each { |item| n += item.def }
    return n
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def base_spi
    n = base_parameter(4)
    equips.compact.each { |item| n += item.spi }
    return n
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def base_agi
    n = base_parameter(5)
    equips.compact.each { |item| n += item.agi }
    return n
  end
end

#==================================End Class===================================#

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

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def gold_limit
    return KGC::LimitBreak::GOLD_LIMIT
  end
  #--------------------------------------------------------------------------
  # ? ??????? (??)
  #     n : ??
  #--------------------------------------------------------------------------
  def gain_gold(n)
    @gold = [[@gold + n, 0].max, gold_limit].min
  end
  #--------------------------------------------------------------------------
  # ? ??????? (??)
  #     item          : ????
  #     n             : ??
  #     include_equip : ???????
  #--------------------------------------------------------------------------
  def gain_item(item, n, include_equip = false)
    number = item_number(item)
    case item
    when RPG::Item
      @items[item.id] = [[number + n, 0].max, item.number_limit].min
    when RPG::Weapon
      @weapons[item.id] = [[number + n, 0].max, item.number_limit].min
    when RPG::Armor
      @armors[item.id] = [[number + n, 0].max, item.number_limit].min
    end
    n += number
    if include_equip && n < 0
      members.each { |actor|
        while n < 0 && actor.equips.include?(item)
          actor.discard_equip(item)
          n += 1
        end
      }
    end
  end
end

#==================================End Class===================================#

#==============================================================================
# ¦ Window_ShopBuy
#==============================================================================

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # ? ?????
  #     index : ????
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item)
    enabled = (item.price <= $game_party.gold && number < item.number_limit)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_item_name(item, rect.x, rect.y, enabled)
    rect.width -= 4
    self.contents.draw_text(rect, item.price, 2)
  end
end

#==================================End Class===================================#

#==============================================================================
# ¦ Scene_Title
#==============================================================================

class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  alias load_database_KGC_LimitBreak load_database
  def load_database
    load_database_KGC_LimitBreak

    set_enemy_parameters
  end
  #--------------------------------------------------------------------------
  # ? ????????????????
  #--------------------------------------------------------------------------
  alias load_bt_database_KGC_LimitBreak load_bt_database
  def load_bt_database
    load_bt_database_KGC_LimitBreak

    set_enemy_parameters
  end
  #--------------------------------------------------------------------------
  # ? ???????????
  #--------------------------------------------------------------------------
  def set_enemy_parameters
    KGC::LimitBreak.revise_enemy_parameters
    KGC::LimitBreak.set_enemy_parameters
  end
end

#==================================End Class===================================#

#==============================================================================
# ¦ Scene_File
#==============================================================================

class Scene_File < Scene_Base
  #--------------------------------------------------------------------------
  # ? ???????????
  #     file : ??????????????? (??????)
  #--------------------------------------------------------------------------
  alias read_save_data_KGC_LimitBreak read_save_data
  def read_save_data(file)
    read_save_data_KGC_LimitBreak(file)

    (1...$data_actors.size).each { |i|
      actor = $game_actors[i]
      actor.make_exp_list
      # ?????????
      if actor.level > actor.final_level
        while actor.level > actor.final_level
          actor.level_down
        end
        # ???? HP ????????????????
        actor.change_level(actor.final_level, false)
      end
    }
  end
end

#==================================End Class===================================#

#==============================================================================
# ¦ Scene_Shop
#==============================================================================

class Scene_Shop < Scene_Base
  #--------------------------------------------------------------------------
  # ? ???????????
  #--------------------------------------------------------------------------
  def update_buy_selection
    @status_window.item = @buy_window.item
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      number = $game_party.item_number(@item)
      if @item == nil || @item.price > $game_party.gold ||
          number == @item.number_limit
        Sound.play_buzzer
      else
        Sound.play_decision
        max = (@item.price == 0 ?
          @item.number_limit : $game_party.gold / @item.price)
        max = [max, @item.number_limit - number].min
        @buy_window.active = false
        @buy_window.visible = false
        @number_window.set(@item, max, @item.price)
        @number_window.active = true
        @number_window.visible = true
      end
    end
  end
end

#==================================End Class===================================#

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/  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/special_system&tech=limit_break
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_


Re: Kleine Fragen, schnelle Antwort?

Offline Franky

  • Blutiger Fortgeschrittener
  • Eventmeister
  • ***
  • Beiträge: 390
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1727 am: März 14, 2011, 20:02:39 »
Ich suche animierte Charactergrafiken, frei für das Spiel, vor allem in Szenen (evtl. auch selbst gestaltete Kämpfe per Szenenevents!).

Re: Kleine Fragen, schnelle Antwort?

Offline Domin0e

  • Leaf in the Wind
  • Mr. MACK-Tile
  • ***
  • Beiträge: 237
    • Mein kleiner Blog~
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1728 am: März 25, 2011, 21:02:24 »
Hat zufällig wer das YERD-Sythezise Skirpt und könnte mir das geben?
Leider hat Yanfly das ja weder auf Pockethouse, noch gibt es das noch in
einem der englischen Foren.. :/

Gruß, Domi
"Twelve highlanders and a bagpipe make a rebellion." - Scottish Proverb

Mein kleiner Blog

Re: Kleine Fragen, schnelle Antwort?

Offline FlipelyFlip

  • Will sein Alter nicht verraten xD
  • Administrator
  • VX-Großmeister
  • ****
  • Beiträge: 884
  • Heyho (=
    • Flips Musik Kariere auf Facebook xD
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1729 am: März 25, 2011, 21:14:43 »
Spoiler for Hiden:
[code]#===============================================================================
#
# Yanfly Engine RD - Actor Item Synthesis
# Last Date Updated: 2009.06.23
# Level: Hard
#
# This item synthesis script is influenced after Gust RPG's famous synthesizing
# systems. To synthesize an item, one would need a recipe and the required actor
# in your party. Different actors can yield different outcomes, but they all
# possess and use the same ingredients.
#
# Another thing this script will provide (for the player) is that any items that
# were synthesized through the shop's recipes can then be bought without need
# to synthesize them again. The need to constantly resynthesize items to get
# more of them becomes rather tedious and that really isn't something we should
# put the player through.
#
# This script also allows playing events after item creation similar to that of
# the Gust RPG's. There you can play out little skits and such or even unlock
# certain parts of the game for synthesizing a particular item.
#
#===============================================================================
# Updates:
# ----------------------------------------------------------------------------
# o 2009.06.23 - Compatibility fix with KGC Help Extension
# o 2009.06.21 - Compatibility update with Display Item Query
# o 2009.06.14 - Bug fix for Synth Listing
# o 2009.06.10 - Added <synth unbuyable>
# o 2009.06.04 - Added <synth block actor x>
#              - Common events are played only once per actor now
#              - Added <replay event> to replay common events more than once
#              - Added <synth exp x> and <synth exp x:y>
# o 2009.06.03 - Finished script
# o 2009.06.02 - Started script
#===============================================================================
# Instructions
#===============================================================================
#
# These go into the recipe's notebox. Recipes can be items, weapons, or armours
# but they must contain the following information before they can be recipes:
# -----------------------------------------------------------------------------
#
# <synth actor a b:c>
# a is the ID of the actor that can use the recipe. If the ID is 0, all actors
# can user the recipe. b has to be either I, W, or A. This will determine what
# type of item will be produced, an item, weapon, or armour. c is the ID of the
# item type to be created. <synth actor 3 I:8> means if actor 3 uses this recipe
# then actor 3 will create Item ID 8.
#
# <synth cost n>
# This is how much synthesizing the recipe will cost. If this isn't included,
# the synthesis is considered to be free.
#
# <ingredients a:b> or <ingredients a:b xc>
# This determines what ingredients are needed. a has to be either I, W, or A to
# determine what type of item is being used. b determines the item ID of the
# item type to be used. Should you decide to use the second tag, c is how many
# of the item is needed for the recipe to be made.
#
# -----------------------------------------------------------------------------
# The following are optional tags you may place in a recipe's notebox.
# -----------------------------------------------------------------------------
#
# <synth block actor x> or <synth block actor x,x>
# This will prevent actors from being able to perform the synthesis at all,
# even if actor 0 is listed for <synth actor>. To block multiple actors, just
# add more of the tags or use the <synth block actor x,x> version.
#
# <synth actor a event:b>
# For those that want to play a common event after a synthesis, set b to the ID
# of the common event desired. a is the actor set to play after that actor makes
# an item. If a is 0, it is set for all actors.
#
# <replay event>
# This will allow the common event to be replayable after viewing once.
#
# <consume recipe> or <not consume recipe>
# This will override the default rules set for consuming recipes. The first will
# always consume the recipe regardless of the rulesetting and the second one
# will prevent the recipe from being consumed.
#
# <synth exp x> or <synth exp x:y>
# This determines how much experience the actor synthesizing the item gains
# from performing the synthesis. The first time through, the actor will gain x
# experience. On follow-up synthesis sessions, the actor will not gain any exp
# unless the second tag is used. Only y exp will be gained on follow up any
# follow-up sessions. But no matter how much experience the actor gains, the
# actor cannot level up from synthesizing items (to prevent bugs from occuring).
#
# <synth unbuyable>
# This makes the item unable to be bought even after synthesizing it. This tag
# can be used in either the item to be bought or the recipe. If it's on the
# item to be bought, then only that item is is disabled from the recipe. If the
# tag is on the recipe, all items created by that recipe cannot be bought.
#
#===============================================================================
#
# Compatibility
# - Works With: KGC's LimitBreak, Help Extension
# - Works With: Yanfly's Variable Controlled Discounts
# - Alias: Scene_Map: call_shop
#
#===============================================================================

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

module YE
  module SYNTH
   
    # This is the switch required to be on before the shop can be called out.
    # Remember to turn off your switches beforehand.
    SYNTH_SWITCH = 72
   
    # The following determines the various settings for the synthesis shop.
    SYNTH_TEXT   = "Synth"             # Synthesis option for shop commands.
    SYNTH_INCOMP = "Incompatible"      # Text for incompatible actors.
    SYNTH_INCOLR = 10                  # Colour for incompatible actors.
    SYNTH_INGRED = "Ingredients"       # Text used for ingredients.
    SYNTH_OUTCOM = "Outcome"           # Text used for ingredients.
    SYNTH_FSIZE  = 16                  # Font size for smaller text.
    SYNTH_OFFSET = 48                  # X offset for text next to actor sprite.
    SYNTH_TOTAL  = "Recipes Known: %d" # Total recipes done by actor.
    SYNTH_COST   = "Synth Cost"        # Text for synthesis cost.
    SYNTH_C_ICON = 205                 # Icon for synthesis cost.
    SYNTH_T_COST = "%d %s"             # Text format used for synth amount.
    SYNTH_AMT    = "%d/%d"             # Ingredients required over possessed.
    SYNTH_HIDE_0 = true                # This will hide amount needed if zero.
    SYNTH_UNICON = 144                 # Icon used for unknown items.
    SYNTH_UNMASK = "Unknown"           # Mask used for unknown items.
   
    # The following determines the rules for recipe consumption. This will
    # govern whether or not you would want recipes to be used up after synthing
    # an item. If it's set to true, recipes will be included in the ingredients
    # listing. The number consumed depends on how many items were synthesized
    # from the recipe.
    CONSUME_RECIPE_ITEM   = false  # If recipe is an item, consume item.
    CONSUME_RECIPE_WEAPON = true   # If recipe is an weapon, consume weapon.
    CONSUME_RECIPE_ARMOUR = true   # If recipe is an armour, consume armour.
   
    # The following determines the rules governing common events. Note that if
    # common events are played outside of the shop, the player will not return
    # to the shop after the event is done.
    EVENT_IN_SHOP = true    # Stay inside the shop for common events.
    FADE_TIME     = 30      # The amount of frames of fade in between events.
   
  end
end

#===============================================================================
# Editting anything past this point may potentially result in causing computer
# damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
# Therefore, edit at your own risk.
#===============================================================================

module YE
module REGEXP
module SYNTH
     
  ACTOR = /<(?:SYNTH_ACTOR|synth actor)[ ]*(\d+)[ ]\s*([IWA]):(\d+)?>/i
  EVENT = /<(?:SYNTH_ACTOR|synth actor)[ ]*(\d+)[ ](?:EVENT|event):(\d+)?>/i
  BLOCK = /<(?:SYNTH_BLOCK_ACTOR|synth block actor)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  COST  = /<(?:SYNTH_COST|synth cost)[ ]*(\d+)>/i
  INGRE = /<(?:INGREDIENT|ingredients)\s*([IWA]):(\d+)?>/i
  INGRX = /<(?:INGREDIENT|ingredients)\s*([IWA]):(\d+)[ ]x(\d+)?>/i
  CONSUME = /<(?:CONSUME|consume recipe)>/i
  NOTCONSUME = /<(?:NOT_CONSUME|not consume recipe|not consume)>/i
  REPLAY = /<(?:REPLAY_EVENT|replay event)>/i
  UNBUYABLE = /<(?:SYNTH_UNBUYABLE|synth unbuyable)>/i
  EXP1 = /<(?:SYNTH_EXP|synth exp)[ ]*(\d+)>/i
  EXP2 = /<(?:SYNTH_EXP|synth exp)[ ]*(\d+):(\d+)>/i
     
end # BASEITEM
end # REGEXP
end # YE

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

class RPG::BaseItem

  #--------------------------------------------------------------------------
  # Yanfly_Cache_BaseItem_AIS
  #--------------------------------------------------------------------------
  def yanfly_cache_baseitem_ais
    @recipe = false; @synth_actor = {}; @ingredients = {}; @synth_cost = 0
    @synth_consume = false; @synth_event = {}; @synth_block = []
    @replay_event = false; @synth_exp1 = 0; @synth_exp2 = 0
    @synth_unbuyable = false
   
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when YE::REGEXP::SYNTH::ACTOR
        case $2.upcase
        when "I"
          @synth_actor[$1.to_i] = $data_items[$3.to_i]
          @synth_consume = YE::SYNTH::CONSUME_RECIPE_ITEM
        when "W"
          @synth_actor[$1.to_i] = $data_weapons[$3.to_i]
          @synth_consume = YE::SYNTH::CONSUME_RECIPE_WEAPON
        when "A"
          @synth_actor[$1.to_i] = $data_armors[$3.to_i]
          @synth_consume = YE::SYNTH::CONSUME_RECIPE_ARMOUR
        end
      when YE::REGEXP::SYNTH::EVENT
        @synth_event[$1.to_i] = $2.to_i
      when YE::REGEXP::SYNTH::BLOCK
        $1.scan(/\d+/).each { |num|
        if num.to_i > 0
          @synth_block.push(num.to_i)
        end }
      when YE::REGEXP::SYNTH::COST
        @synth_cost = $1.to_i
      when YE::REGEXP::SYNTH::INGRE
        case $1.upcase
        when "I"
          @ingredients[$data_items[$2.to_i]] = 1
        when "W"
          @ingredients[$data_weapons[$2.to_i]] = 1
        when "A"
          @ingredients[$data_armors[$2.to_i]] = 1
        end
      when YE::REGEXP::SYNTH::INGRX
        case $1.upcase
        when "I"
          @ingredients[$data_items[$2.to_i]] = $3.to_i
        when "W"
          @ingredients[$data_weapons[$2.to_i]] = $3.to_i
        when "A"
          @ingredients[$data_armors[$2.to_i]] = $3.to_i
        end
      when YE::REGEXP::SYNTH::REPLAY
        @replay_event = true
      when YE::REGEXP::SYNTH::EXP1
        @synth_exp1 = $1.to_i
      when YE::REGEXP::SYNTH::EXP2
        @synth_exp1 = $1.to_i
        @synth_exp2 = $2.to_i
      when YE::REGEXP::SYNTH::UNBUYABLE
        @synth_unbuyable = true
      end
    }
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when YE::REGEXP::SYNTH::CONSUME
        @synth_consume = true
      when YE::REGEXP::SYNTH::NOTCONSUME
        @synth_consume = false
      end
    }
   
    if @synth_actor != {} and @ingredients != {}
      @recipe = true
    end
  end
 
  #--------------------------------------------------------------------------
  # definitions
  #--------------------------------------------------------------------------
  def recipe?
    yanfly_cache_baseitem_ais if @recipe == nil
    return @recipe
  end
  def synth_actor
    yanfly_cache_baseitem_ais if @synth_actor == nil
    return @synth_actor
  end
  def synth_event
    yanfly_cache_baseitem_ais if @synth_event == nil
    return @synth_event
  end
  def synth_block
    yanfly_cache_baseitem_ais if @synth_block == nil
    return @synth_block
  end
  def synth_cost
    yanfly_cache_baseitem_ais if @synth_cost == nil
    return @synth_cost
  end
  def synth_consume?
    yanfly_cache_baseitem_ais if @synth_consume == nil
    return @synth_consume
  end
  def ingredients
    yanfly_cache_baseitem_ais if @ingredients == nil
    return @ingredients
  end
  def replay_event?
    yanfly_cache_baseitem_ais if @replay_event == nil
    return @replay_event
  end
  def synth_exp1
    yanfly_cache_baseitem_ais if @synth_exp1 == nil
    return @synth_exp1
  end
  def synth_exp2
    yanfly_cache_baseitem_ais if @synth_exp2 == nil
    return @synth_exp2
  end
  def synth_unbuyable
    yanfly_cache_baseitem_ais if @synth_unbuyable == nil
    return @synth_unbuyable
  end
 
end # RPG::BaseItem

#===============================================================================
# Game_Actor
#===============================================================================

class Game_Actor < Game_Battler
 
  #--------------------------------------------------------------------------
  # Next Exp - The experience needed for the next level.
  #--------------------------------------------------------------------------
  def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
 
  #--------------------------------------------------------------------------
  # learn_recipe
  #--------------------------------------------------------------------------
  def learn_recipe(item)
    if item.is_a?(RPG::Item)
      unless synth_items.include?(item.id)
        synth_items.push(item.id)
        exp = [[item.synth_exp1, next_exp - 1].min, 0].max
        gain_exp(exp, false)
      else
        exp = [[item.synth_exp2, next_exp - 1].min, 0].max
        gain_exp(exp, false)
      end
    elsif item.is_a?(RPG::Weapon)
      unless synth_weapons.include?(item.id)
        synth_weapons.push(item.id)
        exp = [[item.synth_exp1, next_exp - 1].min, 0].max
        gain_exp(exp, false)
      else
        exp = [[item.synth_exp2, next_exp - 1].min, 0].max
        gain_exp(exp, false)
      end
    elsif item.is_a?(RPG::Armor)
      unless synth_armours.include?(item.id)
        synth_armours.push(item.id)
        exp = [[item.synth_exp1, next_exp - 1].min, 0].max
        gain_exp(exp, false)
      else
        exp = [[item.synth_exp2, next_exp - 1].min, 0].max
        gain_exp(exp, false)
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # synth_events
  #--------------------------------------------------------------------------
  def synth_events
    @synth_events = [] if @synth_events == nil
    return @synth_events
  end
 
  #--------------------------------------------------------------------------
  # synth_items
  #--------------------------------------------------------------------------
  def synth_items
    @synth_items = [] if @synth_items == nil
    return @synth_items
  end
 
  #--------------------------------------------------------------------------
  # synth_weapons
  #--------------------------------------------------------------------------
  def synth_weapons
    @synth_weapons = [] if @synth_weapons == nil
    return @synth_weapons
  end
 
  #--------------------------------------------------------------------------
  # synth_armours
  #--------------------------------------------------------------------------
  def synth_armours
    @synth_armours = [] if @synth_armours == nil
    return @synth_armours
  end
 
end # Game_Actor

#===============================================================================
# Spriteset_Menu
#===============================================================================

class Spriteset_Menu
  unless method_defined?(:create_viewports)
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize
    create_viewports
    create_pictures
    update
  end
 
  def create_viewports
    @viewport1 = Viewport.new(0, 0, 544, 416)
    @viewport2 = Viewport.new(0, 0, 544, 416)
    @viewport3 = Viewport.new(0, 0, 544, 416)
    @viewport2.z = 50
    @viewport3.z = 100
  end
 
  def create_pictures
    @picture_sprites = []
    for i in 1..20
      @picture_sprites.push(Sprite_Picture.new(@viewport2,
      $game_map.screen.pictures))
    end
  end
 
  #--------------------------------------------------------------------------
  # dispose
  #--------------------------------------------------------------------------
  def dispose
    dispose_pictures
    dispose_viewports
  end
 
  def dispose_pictures
    for sprite in @picture_sprites
      sprite.dispose
    end
  end
   
  def dispose_viewports
    @viewport1.dispose
    @viewport2.dispose
    @viewport3.dispose
  end
 
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    update_pictures
    update_viewports
  end
 
  def update_pictures
    for sprite in @picture_sprites
      sprite.update
    end
  end
 
  def update_viewports
    @viewport1.tone = $game_map.screen.tone
    @viewport1.ox = $game_map.screen.shake
    @viewport2.color = $game_map.screen.flash_color
    @viewport3.color.set(0, 0, 0, 255 - $game_map.screen.brightness)
    @viewport1.update
    @viewport2.update
    @viewport3.update
  end
  end
end # Spriteset_Menu

#===============================================================================
# Scene_Map
#===============================================================================

class Scene_Map < Scene_Base
 
  #--------------------------------------------------------------------------
  # alias call_shop
  #--------------------------------------------------------------------------
  alias call_shop_ais call_shop unless $@
  def call_shop
    if $game_switches[YE::SYNTH::SYNTH_SWITCH]
      $game_temp.next_scene = nil
      $game_switches[YE::SYNTH::SYNTH_SWITCH] = false
      $scene = Scene_Synthesis.new
    else
      call_shop_ais
    end
  end
 
end # Scene_Map

#===============================================================================
# Scene_Synthesis
#===============================================================================

class Scene_Synthesis < Scene_Base
 
  #--------------------------------------------------------------------------
  # start
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    @actor_index = 0
    @actor_id = $game_party.members[@actor_index].id
    @interpreter = Game_Interpreter.new
    @common_event = 0
    @spriteset = Spriteset_Menu.new
    @running = false
    @help_window = Window_Help.new
    @gold_window = Window_Gold.new(384, @help_window.height)
    create_command_window
    adjust_window_size
    dy = @help_window.height + @gold_window.height
    dw = Graphics.width - 304
    dh = Graphics.height - dy
    @buy_window = Window_SynthBuy.new(0, dy, 304, dh)
    @buy_window.help_window = @help_window
    @number_window = Window_ShopNumber.new(0, 112)
    @number_window.active = false
    @number_window.visible = false
    @status_window = Window_ShopStatus.new(304, dy)
    @status_window.height = dh
    @status_window.create_contents
    @synth_list = Window_SynthList.new(0, dy, 304, dh)
    @synth_list.help_window = @help_window
    @ingre_list = Window_Ingredients.new(304, dy, dw, dh)
    @synth_number = Window_SynthNumber.new(0, 112)
    @synth_number.visible = false
    @synth_number.active = false
    @message_window = Window_Message.new
    @help_window.set_text("")
    setup_display_item_query if $imported["DisplayItemQuery"]
  end
 
  #--------------------------------------------------------------------------
  # adjust_window_size
  #--------------------------------------------------------------------------
  def adjust_window_size
    return unless $imported["HelpExtension"]
    @help_window.row_max = KGC::HelpExtension::ROW_MAX
    @command_window.y = @help_window.height
    @gold_window.y = @help_window.height
    dy = @help_window.height + @command_window.height
  end
 
  #--------------------------------------------------------------------------
  # terminate
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @spriteset.dispose if @spriteset != nil
    @help_window.dispose if @help_window != nil
    @gold_window.dispose if @gold_window != nil
    @buy_window.dispose if @buy_window != nil
    @number_window.dispose if @number_window != nil
    @status_window.dispose if @status_window != nil
    @synth_list.dispose if @synth_list != nil
    @ingre_list.dispose if @ingre_list != nil
    @command_window.dispose if @command_window != nil
    @synth_number.dispose if @synth_number != nil
    @message_window.dispose if @message_window != nil
  end
 
  #--------------------------------------------------------------------------
  # create_command_window
  #--------------------------------------------------------------------------
  def create_command_window
    carray = []
    carray.push(Vocab::ShopBuy)
    carray.push(YE::SYNTH::SYNTH_TEXT)
    carray.push(Vocab::ShopCancel)
    @command_window = Window_Command.new(384, carray, 3)
    @command_window.y = @help_window.height
  end
 
  #--------------------------------------------------------------------------
  # setup_display_item_query
  #--------------------------------------------------------------------------
  def setup_display_item_query
    sdx = 0
    sdy = @buy_window.y
    sdw = 272
    sdh = @buy_window.height
    @item_data_window = Window_Item_Data.new(0, sdy, 272, sdh)
    @item_data_window.visible = false
    @item_data_window.active = false
  end
 
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    update_basic
    update_ingredients_window
    return if @interpreter.running?
    return if $game_message.visible
    if $imported["DisplayItemQuery"] and @item_data_window != nil and
    @item_data_window.active
      update_item_data_window
    elsif @command_window.active
      update_command_window
    elsif @buy_window.active
      @last_index = @buy_window.index + 1
      update_buy_selection
    elsif @synth_list.active
      update_synth_list
    elsif @number_window.active
      update_number_input
    elsif @synth_number.active
      update_synth_number
    end
  end
 
  #--------------------------------------------------------------------------
  # update_basic
  #--------------------------------------------------------------------------
  def update_basic
    update_menu_background
    update_interpreter
    $game_map.update
    @interpreter.update
    @spriteset.update
    @message_window.update
  end
 
  #--------------------------------------------------------------------------
  # update_interpreter
  #--------------------------------------------------------------------------
  def update_interpreter
    if !@interpreter.running? and @running
      Graphics.fadeout(YE::SYNTH::FADE_TIME)
      @command_window.visible = true
      @gold_window.visible = true
      @help_window.visible = true
      @synth_list.visible = true
      @ingre_list.visible = true
      @synth_list.update
      Graphics.fadein(YE::SYNTH::FADE_TIME)
      @running = false
    elsif @interpreter.running? and !@running
      Graphics.fadeout(YE::SYNTH::FADE_TIME)
      @command_window.visible = false
      @gold_window.visible = false
      @help_window.visible = false
      @synth_list.visible = false
      @ingre_list.visible = false
      Graphics.fadein(YE::SYNTH::FADE_TIME)
      @running = true
    end
    if @common_event > 0
      @interpreter.setup($data_common_events[@common_event].list)
      @common_event = 0
      return
    end
  end
 
  #--------------------------------------------------------------------------
  # update_ingredients_window
  #--------------------------------------------------------------------------
  def update_ingredients_window
    return unless @ingre_list.visible
    return if @ingre_list.item == @synth_list.item
    @ingre_list.item = @synth_list.item
    @ingre_list.refresh(@actor_index)
  end
 
  #--------------------------------------------------------------------------
  # update_item_data_window
  #--------------------------------------------------------------------------
  def update_item_data_window
    @item_data_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @item_data_window.disappear
      @buy_window.active = true
    elsif Input.trigger?(Input::LEFT) or Input.trigger?(Input::UP)
      @item_data_window.previous_page
    elsif Input.trigger?(Input::RIGHT) or Input.trigger?(Input::DOWN)
      @item_data_window.next_page
    elsif Input.trigger?(Input::L)
      @item_data_window.top_page
    elsif Input.trigger?(Input::R)
      @item_data_window.bottom_page
    end
  end
 
  #--------------------------------------------------------------------------
  # update_command_window
  #--------------------------------------------------------------------------
  def update_command_window
    @command_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      case @command_window.index
      when 0
        Sound.play_decision
        @command_window.active = false
        @buy_window.index = 0 if @buy_window.index < 0
        @buy_window.active = true
        @buy_window.refresh
        @status_window.visible = true
      when 1
        @synth_list.active = true
        @synth_list.visible = true
        @ingre_list.visible = true
        @synth_list.refresh(@actor_index)
        @buy_window.visible = false
        @status_window.visible = false
        @command_window.active = false
      when 2
        $scene = Scene_Map.new
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # update_buy_selection
  #--------------------------------------------------------------------------
  def update_buy_selection
    if @last_index != @buy_window.index
      @last_index = @buy_window.index
      @status_window.item = @buy_window.item
    end
    @buy_window.update
    if $imported["DisplayItemQuery"] and
    Input.trigger?(YE::MENU::ITEM::ITEM_QUERY_SHOP_BUTTON)
      @item = @buy_window.item
      if @item == nil
        Sound.play_buzzer
      else
        Sound.play_decision
        @item = @buy_window.item
        @item_data_window.appear(@item, @buy_window, 2)
        @buy_window.active = false
      end
    elsif Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @buy_window.active = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    elsif Input.trigger?(Input::C)
      @item = @buy_window.item
      if @item == nil
        Sound.play_buzzer
        return
      end
      number = $game_party.item_number(@item)
      limit = $imported["LimitBreak"] ? @item.number_limit : 99
      if $imported["VariableControlledDiscounts"]
        price = @item.price * $game_variables[YE::EVENT::VARIABLE::PERCENT_BUY]
        price /= YE::EVENT::VARIABLE::PERCENT_DIVISOR
      else
        price = @item.price
      end
      if @item == nil or price > $game_party.gold or number == limit
        Sound.play_buzzer
      else
        Sound.play_decision
        if $imported["LimitBreak"]
          max = (price == 0 ? @item.number_limit : $game_party.gold / price)
          max = [max, @item.number_limit - number].min
        else
          max = price == 0 ? 99 : $game_party.gold / price
          max = [max, 99 - number].min
          end
        @buy_window.active = false
        @buy_window.visible = false
        @number_window.set(@item, max, price)
        @number_window.active = true
        @number_window.visible = true
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # update_synth_list
  #--------------------------------------------------------------------------
  def update_synth_list
    @synth_list.update
    @help_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @command_window.visible = true
      @synth_list.active = false
      @synth_list.visible = false
      @ingre_list.visible = false
      @buy_window.visible = true
      @buy_window.refresh
      @status_window.visible = true
      @help_window.set_text("")
    elsif Input.trigger?(Input::C)
      item = @synth_list.item
      unless enabled?(item)
        Sound.play_buzzer
      else
        Sound.play_decision
        synthesize_item(item)
      end
    elsif Input.trigger?(Input::LEFT)
      Sound.play_cursor
      if @actor_index == 0
        @actor_index = $game_party.members.size - 1
      else
        @actor_index -= 1
      end
      @actor_id = $game_party.members[@actor_index].id
      @synth_list.refresh(@actor_index)
      @ingre_list.refresh(@actor_index)
    elsif Input.trigger?(Input::RIGHT)
      Sound.play_cursor
      if @actor_index == $game_party.members.size - 1
        @actor_index = 0
      else
        @actor_index += 1
      end
      @actor_id = $game_party.members[@actor_index].id
      @synth_list.refresh(@actor_index)
      @ingre_list.refresh(@actor_index)
    end
  end
 
  #--------------------------------------------------------------------------
  # update_number_input
  #--------------------------------------------------------------------------
  def update_number_input
    @number_window.update
    if Input.trigger?(Input::B)
      Sound.play_decision
      @buy_window.active = true
      @buy_window.visible = true
      @buy_window.refresh
      @number_window.active = false
      @number_window.visible = false
    elsif Input.trigger?(Input::C)
      Sound.play_shop
      if $imported["VariableControlledDiscounts"]
        price = @item.price * $game_variables[YE::EVENT::VARIABLE::PERCENT_BUY]
        price /= YE::EVENT::VARIABLE::PERCENT_DIVISOR
      else
        price = @item.price
      end
      $game_party.lose_gold(@number_window.number * price)
      $game_party.gain_item(@item, @number_window.number)
      @gold_window.refresh
      @buy_window.refresh
      @status_window.refresh
      @buy_window.active = true
      @buy_window.visible = true
      @buy_window.refresh
      @number_window.active = false
      @number_window.visible = false
    end
  end
 
  #--------------------------------------------------------------------------
  # update_synth_number
  #--------------------------------------------------------------------------
  def update_synth_number
    @synth_number.update
    if Input.trigger?(Input::B)
      Sound.play_decision
      @synth_list.active = true
      @synth_list.visible = true
      @synth_number.active = false
      @synth_number.visible = false
    elsif Input.trigger?(Input::C)
      Sound.play_shop
      item = @synth_list.item
      $game_party.lose_gold(@synth_number.number * item.synth_cost)
      if item.synth_actor.include?($game_party.members[@actor_index].id)
        synth = item.synth_actor[$game_party.members[@actor_index].id]
      else
        synth = item.synth_actor[0]
      end
      $game_party.gain_item(synth, @synth_number.number)
      consume_ingredients(item, @synth_number.number)
      @gold_window.refresh
      $game_actors[@actor_id].learn_recipe(item)
      run_common_event(item)
      @synth_list.refresh(@actor_index)
      @ingre_list.refresh(@actor_index)
      @synth_list.active = true
      @synth_list.visible = true
      @synth_number.active = false
      @synth_number.visible = false
    end
  end
 
  #--------------------------------------------------------------------------
  # enabled?
  #--------------------------------------------------------------------------
  def enabled?(item)
    return false if item == nil
    return false if @actor_index == -1
    return false if item.synth_block.include?(@actor_id)
    return false unless (item.synth_actor.include?(@actor_id) or
    item.synth_actor.include?(0))
    for ingredient in item.ingredients
      return false if $game_party.item_number(ingredient[0]) < ingredient[1]
    end
    return false unless $game_party.gold >= item.synth_cost
    return true
  end
 
  #--------------------------------------------------------------------------
  # synthesize_item
  #--------------------------------------------------------------------------
  def synthesize_item(item)
    if item.synth_cost > 0
      max = $game_party.gold / item.synth_cost
    else
      max = $game_party.gold
    end
    if item.synth_consume?
      max = [max, $game_party.item_number(item)].min
    end
    for ingredient in item.ingredients
      next if ingredient[1] == 0
      n = $game_party.item_number(ingredient[0]) / ingredient[1]
      max = [max, n].min
    end
    number = $game_party.item_number(item)
    limit = ($imported["LimitBreak"] ? item.number_limit : 99)
    max = [max, limit - number].min
    synth = synth_number_item(item)
    @synth_number.set(synth, max, item.synth_cost, item)
    @synth_number.visible = true
    @synth_number.active = true
    @synth_list.visible = false
    @synth_list.active = false
  end
 
  #--------------------------------------------------------------------------
  # consume_ingredients
  #--------------------------------------------------------------------------
  def consume_ingredients(item, number)
    if item.synth_consume?
      $game_party.lose_item(item, number)
    end
    for ingredient in item.ingredients
      $game_party.lose_item(ingredient[0], number * ingredient[1])
    end
  end
 
  #--------------------------------------------------------------------------
  # synth_number_item
  #--------------------------------------------------------------------------
  def synth_number_item(item)
    if item.is_a?(RPG::Item)
      if $game_party.members[@actor_index].synth_items.include?(item.id)
        if item.synth_actor.include?($game_party.members[@actor_index].id)
          item = item.synth_actor[$game_party.members[@actor_index].id]
        elsif item.synth_actor.include?(0)
          item = item.synth_actor[0]
        end
      end
    elsif item.is_a?(RPG::Weapon)
      if $game_party.members[@actor_index].synth_weapons.include?(item.id)
        if item.synth_actor.include?($game_party.members[@actor_index].id)
          item = item.synth_actor[$game_party.members[@actor_index].id]
        elsif item.synth_actor.include?(0)
          item = item.synth_actor[0]
        end
      end
    elsif item.is_a?(RPG::Armor)
      if $game_party.members[@actor_index].synth_armours.include?(item.id)
        if item.synth_actor.include?($game_party.members[@actor_index].id)
          item = item.synth_actor[$game_party.members[@actor_index].id]
        elsif item.synth_actor.include?(0)
          item = item.synth_actor[0]
        end
      end
    end
    return item
  end
 
  #--------------------------------------------------------------------------
  # run_common_event
  #--------------------------------------------------------------------------
  def run_common_event(item)
    event = nil
    actor = $game_party.members[@actor_index]
    if item.synth_event.include?(actor.id)
      @synth_list.update
      event = item.synth_event[actor.id]
    elsif item.synth_event.include?(0)
      @synth_list.update
      event = item.synth_event[0]
    end
    return if event == nil
    if !actor.synth_events.include?(event) or item.replay_event?
      actor.synth_events.push(event) unless actor.synth_events.include?(event)
      if YE::SYNTH::EVENT_IN_SHOP
        @common_event = event
      else
        $game_temp.common_event_id = event
        $scene = Scene_Map.new
      end
    end
  end
 
end # Scene_Synthesis

#==============================================================================
# Window_SynthList
#==============================================================================

class Window_SynthList < Window_Selectable
 
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(x, y, w, h)
    super(x, y, w, h)
    self.visible = false
    self.active = false
    self.index = 0
    refresh
  end
 
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh(actor_index = -1)
    @data = []
    for goods_item in $game_temp.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
      next if item == nil
      next unless item.recipe?
      next unless $game_party.has_item?(item)
      @data.push(item)
    end
    @item_max = @data.size
    create_contents
    @actor_index = actor_index
    @actor_id = $game_party.members[@actor_index].id
    for i in 0...@item_max
      draw_item(i)
    end
  end
 
  #--------------------------------------------------------------------------
  # draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index]
    enable = enabled?(item)
    if @actor_index >= 0 and item.synth_actor.include?(@actor_id)
      if item.is_a?(RPG::Item)
        if $game_actors[@actor_id].synth_items.include?(item.id)
          item = item.synth_actor[@actor_id]
        end
      elsif item.is_a?(RPG::Weapon)
        if $game_actors[@actor_id].synth_weapons.include?(item.id)
          item = item.synth_actor[@actor_id]
        end
      elsif item.is_a?(RPG::Armor)
        if $game_actors[@actor_id].synth_armours.include?(item.id)
          item = item.synth_actor[@actor_id]
        end
      end
    elsif @actor_index >= 0 and item.synth_actor.include?(0)
      if item.is_a?(RPG::Item)
        if $game_actors[@actor_id].synth_items.include?(item.id)
          item = item.synth_actor[0]
        end
      elsif item.is_a?(RPG::Weapon)
        if $game_actors[@actor_id].synth_weapons.include?(item.id)
          item = item.synth_actor[0]
        end
      elsif item.is_a?(RPG::Armor)
        if $game_actors[@actor_id].synth_armours.include?(item.id)
          item = item.synth_actor[0]
        end
      end
    end
    draw_item_name(item, rect.x, rect.y, enable)
  end
 
  #--------------------------------------------------------------------------
  # enabled?
  #--------------------------------------------------------------------------
  def enabled?(item)
    return false if item == nil
    return false if @actor_index == -1
    return false if item.synth_block.include?(@actor_id)
    return false unless (item.synth_actor.include?(@actor_id) or
    item.synth_actor.include?(0))
    for ingredient in item.ingredients
      return false if $game_party.item_number(ingredient[0]) < ingredient[1]
    end
    return false unless $game_party.gold >= item.synth_cost
    return true
  end
 
  #--------------------------------------------------------------------------
  # return item
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
 
  #--------------------------------------------------------------------------
  # update_help
  #--------------------------------------------------------------------------
  def update_help
    if item == nil
      text = ""
    else
      text = item.description
    end
    if item.is_a?(RPG::Item)
      if $game_party.members[@actor_index].synth_items.include?(item.id)
        if item.synth_actor.include?($game_party.members[@actor_index].id)
          text =
          item.synth_actor[$game_party.members[@actor_index].id].description
        elsif item.synth_actor.include?(0)
          text = item.synth_actor[0].description
        end
      end
    elsif item.is_a?(RPG::Weapon)
      if $game_party.members[@actor_index].synth_weapons.include?(item.id)
        if item.synth_actor.include?($game_party.members[@actor_index].id)
          text =
          item.synth_actor[$game_party.members[@actor_index].id].description
        elsif item.synth_actor.include?(0)
          text = item.synth_actor[0].description
        end
      end
    elsif item.is_a?(RPG::Armor)
      if $game_party.members[@actor_index].synth_armours.include?(item.id)
        if item.synth_actor.include?($game_party.members[@actor_index].id)
          text =
          item.synth_actor[$game_party.members[@actor_index].id].description
        elsif item.synth_actor.include?(0)
          text = item.synth_actor[0].description
        end
      end
    end
    @help_window.set_text(text)
  end
 
end # Window_SynthList

#==============================================================================
# Window_Ingredients
#==============================================================================

class Window_Ingredients < Window_Base
 
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(x, y, w, h)
    super(x, y, w, h)
    self.visible = false
    @item = nil
    refresh
  end
 
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh(actor_index = -1)
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = 255
    self.contents.font.size = Font.default_size
    @actor_index = actor_index
    draw_actor
    draw_ingredients
  end
 
  #--------------------------------------------------------------------------
  # return item
  #--------------------------------------------------------------------------
  def item
    return @item
  end
 
  #--------------------------------------------------------------------------
  # item=
  #--------------------------------------------------------------------------
  def item=(item)
    if @item != item
      @item = item
      refresh
    end
  end
 
  #--------------------------------------------------------------------------
  # draw_actor
  #--------------------------------------------------------------------------
  def draw_actor
    return if @actor_index < 0
    sw = self.width - 32
    actor = $game_party.members[@actor_index]
    draw_actor_graphic(actor, 24, WLH*2)
    self.contents.draw_text(48, 0, sw-48, WLH, actor.name)
    self.contents.font.size = YE::SYNTH::SYNTH_FSIZE
    total = actor.synth_items.size + actor.synth_weapons.size +
    actor.synth_armours.size
    text = sprintf(YE::SYNTH::SYNTH_TOTAL, total)
    xoffset = YE::SYNTH::SYNTH_OFFSET
    self.contents.draw_text(48, 24, sw-48, WLH, text)
  end
 
  #--------------------------------------------------------------------------
  # draw_ingredients
  #--------------------------------------------------------------------------
  def draw_ingredients
    return if @item == nil
    self.contents.font.size = Font.default_size
    sw = self.width - 32
    dy = 48
    if incompatible? or
    @item.synth_block.include?($game_party.members[@actor_index].id)
      self.contents.font.color = text_color(YE::SYNTH::SYNTH_INCOLR)
      self.contents.draw_text(0, dy, sw, WLH, YE::SYNTH::SYNTH_INCOMP, 1)
      return
    else
      self.contents.font.color = system_color
      self.contents.draw_text(0, dy, sw, WLH, @item.name, 1)
    end
    dy += 24
    self.contents.font.color = normal_color
    self.contents.font.size = YE::SYNTH::SYNTH_FSIZE
    if item.synth_cost > 0
      enabled = ($game_party.gold >= item.synth_cost) ? true : false
      draw_icon(YE::SYNTH::SYNTH_C_ICON, 0, dy, enabled)
      self.contents.font.color.alpha = enabled ? 255 : 128
      self.contents.draw_text(24, dy, sw-24, WLH, YE::SYNTH::SYNTH_COST)
      text = sprintf(YE::SYNTH::SYNTH_T_COST, item.synth_cost, Vocab.gold)
      self.contents.draw_text(24, dy, sw-24, WLH, text, 2)
      dy += 24
    end
    if item.synth_consume?
      draw_item_name(item, 0, dy)
      amount = $game_party.item_number(item)
      text = sprintf(YE::SYNTH::SYNTH_AMT, 1, amount)
      self.contents.draw_text(0, dy, sw, WLH, text, 2)
      dy += 24
    end
    item_list = @item.ingredients.sort { |a,b| a[0].name <=> b[0].name }
    for key in item_list
      amount = $game_party.item_number(key[0])
      if amount >= key[1]
        self.contents.font.color.alpha = 255
        enabled = true
      else
        self.contents.font.color.alpha = 128
        enabled = false
      end
      draw_item_name(key[0], 0, dy, enabled)
      text = sprintf(YE::SYNTH::SYNTH_AMT, key[1], amount)
      self.contents.draw_tex

Re: Kleine Fragen, schnelle Antwort?

Offline Domin0e

  • Leaf in the Wind
  • Mr. MACK-Tile
  • ***
  • Beiträge: 237
    • Mein kleiner Blog~
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1730 am: März 25, 2011, 21:30:35 »
Nett von dir Flip, allerdings scheint das Skript nicht komplett, und ein paar Smileys haben sich eingeschlichen ):
code-Tags ;]
Gruß, Domi
"Twelve highlanders and a bagpipe make a rebellion." - Scottish Proverb

Mein kleiner Blog

Re: Kleine Fragen, schnelle Antwort?

Offline FlipelyFlip

  • Will sein Alter nicht verraten xD
  • Administrator
  • VX-Großmeister
  • ****
  • Beiträge: 884
  • Heyho (=
    • Flips Musik Kariere auf Facebook xD
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1731 am: März 25, 2011, 21:49:28 »
kö ich schicks dir per PN, is dummerweise zuviel Text für nen Beitrag wies ausguckt oO

Re: Kleine Fragen, schnelle Antwort?

Offline Galadriela

  • Event-Jongleur
  • **
  • Beiträge: 57
    • Meine Bücher
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1732 am: März 26, 2011, 06:55:58 »
 :haha_zwinker:  könnteste es nicht irgendwo bei den scripten reinstellen...ich hät es auch gern  :smile:

Re: Kleine Fragen, schnelle Antwort?

Offline FlipelyFlip

  • Will sein Alter nicht verraten xD
  • Administrator
  • VX-Großmeister
  • ****
  • Beiträge: 884
  • Heyho (=
    • Flips Musik Kariere auf Facebook xD
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1733 am: März 26, 2011, 08:56:36 »
Okö, kann ich schon machen, nur ich hab selbst null plan wie es funkt^^"
und auch nicht die nötigen Rechte es wo anders vorzustellen, daher mach ich es so: Link <--Link

Man findets in der KGCYanflyPLUS Base Demo (=
Es heißt dort YERD SynthesiseShop und es befindet sich ziemlich weit unten^^

lg flip

Re: Kleine Fragen, schnelle Antwort?

Offline Galadriela

  • Event-Jongleur
  • **
  • Beiträge: 57
    • Meine Bücher
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1734 am: März 26, 2011, 11:00:15 »
 :haha: danke danke die seite mit diesen vielen scripten hab ich gleich in meiner schnellwahlseite gespeichert  :haha:  :grimace:

Re: Kleine Fragen, schnelle Antwort?

Offline Magualie05

  • RTP-Mapper
  • *
  • Beiträge: 34
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1735 am: April 01, 2011, 14:38:07 »
ähm, ich hab mal n ganz seltsames Problem... :faint:
Also, ich hab jetzt nach dem TUT von Rosa einen animierten Titelscreen erstellt, und natürlich das Scipt eingefügt, soweit so gut...
Wenn ich jetzt aber eines meiner alten Häuser betreten will, dann kommt die Fehlermeldung:
Script 'Cache' line 80: RGSSError occured.
failed wo create bitmap
Was heißt denn das, ich meine, bei allen anderen Häusern gibts doch auch kein Problem?

Magualie05

Edit: Hab das Problem gefunden...aber das macht die Sache noch viel schlimmer...
Ich hab an meinen Charas gearbeitet (an nummer 7 auf dem Template...!) und wollte speichern und gimp hat sich beim speichern aufgehangen...jetzt is die Datei beschädigt und so wies aussieht, sind alle bisher erstellten Charas weg...q.q
Kann mir einer sagen, ob man das irgendwie reparieren kann?
...bitte...q.q
« Letzte Änderung: April 01, 2011, 15:24:59 von Magualie05 »


Re: Kleine Fragen, schnelle Antwort?

Offline Franky

  • Blutiger Fortgeschrittener
  • Eventmeister
  • ***
  • Beiträge: 390
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1736 am: April 02, 2011, 09:59:21 »
Mir hat immer noch niemand helfen können, wo ich animierte Charaktere finde, so wie Kaduki sie anbietet. Oder sind das die einzigen?

Re: Kleine Fragen, schnelle Antwort?

Offline FlipelyFlip

  • Will sein Alter nicht verraten xD
  • Administrator
  • VX-Großmeister
  • ****
  • Beiträge: 884
  • Heyho (=
    • Flips Musik Kariere auf Facebook xD
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1737 am: April 02, 2011, 10:19:58 »
einzige ort wo mir was einfallen würde, wäre bei rpgmakervx.net im ressourcenbereich eventuell, sonst null plan^^"

@maguile: füg mich mal im MSN/ICQ/Skype hinzu, dann kann ich dir besser helfen und mir auch angucken was da falsch läuft (=

lg flip

Re: Kleine Fragen, schnelle Antwort?

Offline Galadriela

  • Event-Jongleur
  • **
  • Beiträge: 57
    • Meine Bücher
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1738 am: April 02, 2011, 19:53:33 »
 :haha_zwinker: so leute wieder mal eine frage von mir, wie kann ich ein picture an der stelle festtackern an dem ich es haben will? ich habe alle scripte durchgesehen und ich finde nichts dazu, vielleicht gibt es ja was besseres dafür und man braucht vielleicht keinen script, aber ich finde es ziemlich blöd wenn ich einen baum, in verschiedenen wachstumsformen, auf einer stelle haben will und er "begleitet" den spieler überall hin  :hehe:

Re: Kleine Fragen, schnelle Antwort?

Offline Magualie05

  • RTP-Mapper
  • *
  • Beiträge: 34
Re: Kleine Fragen, schnelle Antwort?
« Antwort #1739 am: April 02, 2011, 20:17:53 »
Also ich mach mach das mit dem FIXED Picture Script von Original Wij, funktioniert super, einfach in den Bild Namen [FIXED] eintragen und es klappt.

Spoiler for Hiden:
==============================================================================
# Fixed Pictures
#==============================================================================
# Author : OriginalWij
# Version : 1.0
#==============================================================================

#==============================================================================
# To use: put the tag [FIXED] in the picture's filename
#==============================================================================

#==============================================================================
# Sprite_Picture
#==============================================================================

class Sprite_Picture < Sprite
  #--------------------------------------------------------------------------
  # Update (Mod)
  #--------------------------------------------------------------------------
  alias ow_fixed_picture_update update unless $@
  def update
    ow_fixed_picture_update
    if @picture_name.include?("[FIXED]")
      self.x += (self.ox - ($game_map.display_x / 8))
      self.y += (self.oy - ($game_map.display_y / 8))
    end
  end
end

Hoffe es hilft Magualie05


 


 Bild des Monats

rooftop party

Views: 3614
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