What's up, RMers?
I have been dealing with a stupid bug I didn't manage to deal with for over a day, it seemed to be mystical by nature, something belonging to the realm of fantasy or a virus or anything corrupted by nature. Anybody would say it was caused by reaching my limits, that I was a small fish in the big ocean of programming and compilation. I had looked for an answer online as many would do it, and the only topic that handled my issue only had a single post, meaning it had been never been answered by knowledgeable rubyists or programmers. Then I found that a function definition was available at a specific file. Since I had downloaded the Ruby source code, that was no problem for me to open it and search for information. First I checked out the function declaration, but it was cryptic at best, then I read the definition, and I just discovered the method I had been using could be squeezed in a single function call...

Nope, that didn't mean I had an actual answer to my strange issue. Then I realized Ruby's nature had a lot to do with it, it IS weakly typed so I would never get an excellent explanation on certain functions even while looking at code. Later on I suspected I didn't read carefully or overlook some vital information. A few moments later, not really long after, not even five minutes after my suspicion had arouse, I finally got the whole picture! I overlooked the true nature of what I was defining a single value with a specific but not so temporary value. Guess what? I was making it extremely local instead of using it in a wider scope by calling the actual VALUE I needed to address from the very beginning...

What is the short explanation on what had happened to me then? I just tried to use a variable in the same way I used another one that is not supposed to have the same scope in the Ruby side. By retrieving and setting its value the very same way I could do it with the second one, plus a slight change in the function name, it would NEVER work. I had to be clever and understand the actual meaning of the first argument I was passing. Once I did so, the test game, the compiler, everything stopped complaining about errors... =_=

I cannot really say I am falling asleep even if it's 5:30 a.m. here, it seems that I just preferred to be lazy and stop looking for the actual implementation of the feature I was coding in the last few days... Confused
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
Every once and a while, I do google searches for stuff. Of these, one is to make sure that my demos exclusive to Save-Point are exactly that; exclusive. It was over a year ago when I discovered a member of "Mundo RPG Maker" ripped the entire post from Save-Point with the exclusive Paperdoll demos, and posted it there. It surprised the guy that I joined the site and made a post in Portuguese asking he just remove the paperdoll demo link. But don't bother going there.... the site is now gone (dangit).

So today, I decided to do the same 'search' for Lycan. What turned up? Well, I was aware of two sites, Tạo Trò Chơi (Vietnamese) and Universo Maker (Spanish), that made simpler posts which only have the first non-paperdoll demo. They never updated it since 2015, so they don't have story #2. And though Avangs.Info (Korean) copied the Save-Point page years ago and didn't remove the Paperdoll links.... sucks for them. They copied the old Fileden linkies that died a long time ago and they never doublechecked). Laughing
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }
I have updated my KMessage XP script this cold morning, but I don't feel like I am going to upload and post it here any time soon, guys! Laughing + Tongue sticking out
The brand new feature is about choices! Shocked
It will let you prevent the player from picking some specific choice if you as the developer have disabled it at any given time. Of course, you can turn it on at will as well. Laughing
Err, I gotta admit it is a simple system to keep track of choices. Confused

By the way, the blocked options now get grayed out in version 1.0.3!!
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
Both, KPortrait and KMessage XP got upgraded a few times lately. They just include minor fixes and very few new features like making it unnecessary to tell the game the text it is going to display should be grayed out or not. This is related to those times you are setting up some choices, especially non repeatable ones. It should not interfere with the normal text that is not related to any choice. Maracuyá also wanted to differentiate the clear all from clearing an specific portrait or face so I renamed the original clear method, now known as clear_all, and added a specific clear(position) method as well.

Their latest versions as of early this morning are 1.0.5 and 1.0.6 respectively.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
I'm currently working on a request. Okay, still a good number but meh. This latest one is a means to increase, decrease and in almost every way mess around with the element rates for actors and/or enemies. This includes setting individual 6-tier (A to F) rates for each element, so the normal fire element might be the same, but the 6-tier element rate for Undead could be painstakingly hellish for the heroes. There's that, and that status effects can change element rates while Actor Armor can have fun effects.

Still evaluating some things I did.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }
Guess what, fellow RM'ers? I have released KPortrait and KMessage XP early this morning. Shocked They have reached version 1.0.7 already. Did I say "released"? Confused Well, actually I only sent it to the only authorized user in existence and nobody else. Laughing + Tongue sticking out Curiously it seems they don't need any further debugging nor upgrade of any kind... unless that forumer comes up with another crazy idea... =_= Why do I say that? Because I have to implement some sort of typewriter speedometer! Shocked I also changed the default settings for face alignment as per request... I fixed some issues with not clearing images properly as well.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
I have been thinking about adding appraisals in KyoDiscounts series so the shopkeepers can act as appraisers as well. In few words, storekeepers might find out what kind of item you have got, he or she will identify it for you. I will try to make it optional as some people might not want to let their players get their mysterious items appraised in every single town they included in their games.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
Sounds like a good idea. What about having to pay a fee to get your items appraised? This way, you could gatekeep really rare items behind exorbitant prices to prevent the players from getting them earlier.

On a different subject, is there a way to make a status buff permanent on a player once they have learned a skill on XP?
Reply }
Here I will leave my KyoDiscounts XP version 1.5.0 alpha or beta release in case anybody wants to report any issues with features already present in the previous version. That means people might test everything except for appraisals themselves since I haven't really worked on it. Nope, that is not a problem, what happened here is that I wanted to implement a different way to determine which command or buy or sell or discount window should be active at any given time to reduce the number of required checks and support future improvements, including appraisals. That might also mean I still have stuff that I have not fixed, yet...

Code:
# * KyoDiscounts XP
#   Scripter : Kyonides-Arkanthos
#   v1.5.0 - 2019-01-12

#   Whenever you obtain a discount card, such discount will be applied to all
#   of your purchases if you have picked a card till it expires after a certain
#   number of steps. Additional steps will be quickly added to your current card
#   whenever you purchase any additional card of the same kind.

#   One coupon will be spent every single time you purchase any specific item,
#   you will need another one to purchase a different item later on.
#   The discount card or coupon price is used to calculate the corresponding
#   discount on every single purchase the player makes with it.

#   Place this script below KItemRefill XP or KyoScriptPack Item XP if you
#   included any of those scripts in your current game project.

#   Now you can also setup exclusive store discount cards as well. Just keep in
#   mind that you will need to setup the in game variable you picked so it will
#   be able to store the Exclusive Store Code (an Integer) before you can add
#   the shop event command. Common stores don't need any Store Code at all.

#   Besides the player can also place orders to get an item that is supposed to
#   be found at another store only. The player will be charged an extra fee, but
#   he or she won't need to go back to another store. The player would only need
#   to keep walking for a while before the goods are available at the store.
#   Now the required steps for each placed order will be automatically increased
#   between 0% and 50%, making it look a bit random but also kind of realistic.

#   Script Calls   #

#   $game_party.discount_cards_expire
#      Makes all Discount Cards expire as part of the game's plot.

#   $game_party.disc_card_expire(Card_ID)
#      Makes an specific Discount Card expire as part of the game's plot.

#   KyoShopOrders << [Percent1, Percent2, etc.]
#      Defines a Commission percent for every Item in the Place Order List.

#   KyoShopOrders.steps = [Steps1, Steps2, etc.]
#   KyoShopOrders.steps += [Steps5, Steps6, etc.]
#      Defines Steps required by every Order in the Place Order List.
#      The 2nd call will be required only if you couldn't include all steps.

#   KyoShop.scarcity_lvl = 0 or higher
#     Define all prices and maximum number of units per shop item.
#     0 means no scarcity, 1 or higher reflects how severe it is.
#     You also have to configure the @scarce_limits hash in order to predefine
#     :price and :max per scarcity level. The maximum scarcity level depends on
#     how many values you entered in both :price and :max arrays.
#     In few words, you define the maximum scarcity level ever possible!

module KyoShop
  # Maximum number of units for each shop item
  NUMBERMAX = 99
  # Button that will open the Discount window while on the shop menu
  DISCOUNTBUTTON = Input::A
  # Add Discount Card Object IDs
  DISCOUNT_IDS = [33, 34]
  # Add Discount Coupon Object IDs
  COUPON_IDS = [36, 37]
  # Maximum Steps before Discount Card expires : ID => Steps
  STEPS = { 33 => 500, 34 => 300, 35 => 150 }
  # Exclusive Stores In Game Variable ID
  STORECODEVARID = 1
  # Exclusive Stores List : Object ID => Exclusive Store Code
  EXCLUSIVESTORES = { 35 => 102 }
  # Switch ID : deactivates Store to add Goods found elsewhere
  GOODSSWITCHID = 1
  # Store IDs for stores where you have invested some gold
  INVESTSTOREIDS = [101]
  # Maximum Number of Shares & Share Price
  SHARESMAXMIN = [10000, 100]
  INVESTMENTS = {} # Store Investments - Do Not Edit This Line
  INVESTMENTS.default = {} # Do Not Edit This Line
  # Available Improvements #
  # :discount : [:discount, 25]
  # :goods    : [:goods, 'i10', 'w4', 'a6']
  # :orders   : [:orders, 'i11', 'w5', 'a7']
  # [Store ID] = { Shares => Prize, Shares => Another Prize, etc. }
  INVESTMENTS[101] = { 50 => [:goods,'i10','w5','a6'], 100 => [:discount,10] }
  APPRAISALS = {} # Do Not Edit This Line!
  # [Store ID] = { price => $, success rate => %, bad result => "item1",
  #                goods => [item4, weapon2, armor3, etc.] }
  APPRAISALS[101] = { :price => 100, :rate => 10, :default => 'i1',
                      :goods => ['i2','i3','i9','i10'] }
  @scarce_limits = {
    :price  => [0, 25, 50, 100, 250, 350, 500, 650, 800],
    :max => [NUMBERMAX, NUMBERMAX - 10, NUMBERMAX - 25, NUMBERMAX - 35,
        NUMBERMAX - 50, NUMBERMAX - 65, NUMBERMAX - 80, NUMBERMAX - 90, 1]
    #:item => [1, 2, 3, 4, 5, 6],
    #:weapon => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
    #:armor => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
  }
  @scarce_lvl = 0 # Initial Level
  def self.current_item_max() @scarce_limits[:max][@scarce_lvl] end
  def self.current_price_max() @scarce_limits[:price][@scarce_lvl] end
  def self.scarcity_limits() @scarce_limits end
  def self.scarcity_lvl() @scarce_lvl end
  def self.scarcity_lvl=(lvl) @scarce_lvl = lvl end
end

module KyoShopLabels
  BASIC = ["Buy", "Sell", "Exit"]
  MOREOPTIONS = "Options"
  # Buy Stuff & Place Order & Pick Up Items Label
  BUYPLACEPICKUP = ['Buy Items', 'Place Order', 'Pick Up Items',
                    'Appraise', 'Invest']
  # Subtotal, Commission Percent and Total Amount
  PRICELABELS = ['Subtotal', 'Commission %', 'Total']
  # Place an Order Label
  PLACEORDER = 'Do you wish to place an order?'
  # Pick Up Order Label
  PICKUPORDER = 'Do you want to pick up an order?'
  # No Order Found Label
  NOORDERFOUND = 'There is nothing left, boss!'
  # Available Discounts Label
  SOMEDISCOUNTS = 'Press A to get a discount'
  # No Discount Available Label
  NODISCOUNTS = 'No Discount Available'
  # Select a Discount Card or Coupon Label
  SELECTDISCOUNT = 'Choose a Card or Coupon'
  # Apply Discount Label
  APPLYDISCOUNT = "Discount Applied %s%"
  # Warning about Extra Fees for Placing Orders
  FEESAPPLY = 'Extra Fees Apply'
  # Discount Card's Steps Left Label
  STEPSLEFT = " %s steps left."
  # Investment Label...
  INVESTMENT = 'Want to invest in this store?'
  # Share Number Label
  SHARES = 'Share Number'
  # Adquired or Purchased Shares Label
  TOTALSHARES = 'Total Shares'
end
# DO NOT EDIT ANYTHING ELSE #
module KyoShopOrders
  @commissions = []
  @steps = []
  class << self
    attr_accessor :store_event_id, :goods_id
    attr_reader :steps, :commissions
    def steps=(val) @steps = val.map {|n| n + rand((n / 2) + 2) } end
    def <<(val)
      @commissions += val
      @commissions = @commissions.flatten
    end
  end
end

module WindowModule
  def appear
    self.active = true
    self.visible = true
  end

  def disappear
    self.active = false
    self.visible = false
  end
end

class Game_System
  attr_accessor :shop_goods
  attr_reader :placed_orders, :shop_shares
  alias kyon_discounts_gm_sys_init initialize
  def initialize
    @shop_goods = []
    @placed_orders = {}
    @placed_orders.default = []
    @shop_shares = {}
    @shop_shares.default = 0
    kyon_discounts_gm_sys_init
  end

  def disc_store?(disc_id) !KyoShop::EXCLUSIVESTORES[disc_id] end

  def excl_disc_store?(disc_id)
    exclusive = KyoShop::EXCLUSIVESTORES[disc_id]
    exclusive == $game_variables[KyoShop::STORECODEVARID]
  end

  def check_shares(shop_id)
    results = []
    shares = @shop_shares[shop_id]
    investments = KyoShop::INVESTMENTS[shop_id]
    limits = KyoShop::INVESTMENTS[shop_id].keys.sort
    results = investments.select{|limit| shares >= limit[0] }.map {|r| r[1] }
  end
end

class Game_Party
  attr_reader :discounts
  alias kyon_discounts_gm_party_init initialize
  alias kyon_discounts_gm_party_gain_item gain_item
  def initialize
    @discounts = {}
    kyon_discounts_gm_party_init
  end

  def gain_item(item_id, n)
    kyon_discounts_gm_party_gain_item(item_id, n)
    return if item_id == 0 or n == 0
    return unless KyoShop::DISCOUNT_IDS.include?(item_id)
    if @discounts[item_id]
      @discounts[item_id] += KyoShop::STEPS[item_id]
      @items[item_id] = 1
    else
      @discounts[item_id] = KyoShop::STEPS[item_id]
    end
  end

  def check_discounts
    unless @discounts.empty?
      for did in KyoShop::DISCOUNT_IDS
        next unless @discounts[did] and @discounts[did] > 0
        return true if $game_system.disc_store?(did)
        return true if $game_system.excl_disc_store?(did)
      end
    end
    for cid in KyoShop::COUPON_IDS
      next unless item_number(cid) > 0
      return true if $game_system.disc_store?(cid)
      return true if $game_system.excl_disc_store?(cid)
    end
    return false
  end

  def decrease_discounts
    KyoShop::DISCOUNT_IDS.each {|n| next unless @discounts[n]
      @discounts[n] -= 1 if @discounts[n] > 0 }
  end

  def discount_cards_expire
    KyoShop::DISCOUNT_IDS.each {|n| @discounts[n] = 0 if @discounts[n] }
  end

  def disc_card_expire(dc_id) @discounts[dc_id] = 0 end
end

class Game_Player
  alias kyon_discounts_coupons_gm_player_increase_steps increase_steps
  def increase_steps
    kyon_discounts_coupons_gm_player_increase_steps
    $game_party.decrease_discounts
  end
end

class Window_Selectable
  include WindowModule
end
# * Begin of Window_Help Add-On for KyoDiscounts XP
class Window_Help
  def set_text(item_id, text=nil, align=0)
    if item_id.is_a?(String)
      if KyoShop::DISCOUNT_IDS.include?(KyoShopOrders.goods_id)
        steps = $game_party.discounts[KyoShopOrders.goods_id].to_s
        text = item_id + sprintf(KyoShopLabels::STEPSLEFT, steps)
        KyoShopOrders.goods_id = item_id = nil
      end
    end
    if text.is_a?(String)
      text = text.gsub(/\\[Uu]/){$game_system.refill_items[item_id].sips.to_s}
    elsif text.is_a?(Integer)
      align = text
      text = item_id
    else
      text = item_id
    end
    if text != @text or align != @align
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
      @text = text
      @align = align
      @actor = nil
    end
    self.visible = true
  end
end

class Window_Item
  alias kyon_discounts_win_item_up_help update_help
  def update_help
    KyoShopOrders.goods_id = self.item.id
    kyon_discounts_win_item_up_help
  end
end
# * End of Window_Help Add-On
class Window_ShopCommand
  def initialize
    super(0, 64, 480, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    @item_max = 3
    @column_max = 3
    @commands = KyoShopLabels::BASIC.dup
    if KyoShop::APPRAISALS[$game_variables[KyoShop::STORECODEVARID]]
      @commands[0] = KyoShopLabels::MOREOPTIONS.dup
    end
    refresh
    self.index = 0
  end
end

class Window_ShopBuy
  attr_accessor :discount
  def initialize(shop_goods)
    super(0, 128, 368, 288)
    @shop_goods = shop_goods
    @discount = 0
    refresh
    self.index = 0
  end

  def deliver(goods)
    @shop_goods = goods
    if goods.size - 1 < @index
      @index = goods.size > 0 ? (@index + goods.size - 1) % goods.size : 0
      update_cursor_rect
    end
    refresh
    self.index = 0
  end

  def draw_item(index)
    item = @data[index]
    number = case item
    when RPG::Item then $game_party.item_number(item.id)
    when RPG::Weapon then $game_party.weapon_number(item.id)
    when RPG::Armor then $game_party.armor_number(item.id)
    end
    enough = (item.price <= $game_party.gold and number < 99)
    self.contents.font.color = enough ? normal_color : disabled_color
    y = index * 32
    rect = Rect.new(4, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = enough ? 255 : 128
    self.contents.blt(4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(32, y, 212, 32, item.name, 0)
    price = item.price - item.price * @discount / 100
    self.contents.draw_text(244, y, 88, 32, price.to_s, 2)
  end
end

class Window_ShopPickUp < Window_ShopBuy
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for good in @shop_goods
      new_item = case good[0]
      when 0 then $data_items[good[1]]
      when 1 then $data_weapons[good[1]]
      when 2 then $data_armors[good[1]]
      end
      @data << new_item if new_item
    end
    @item_max = @data.size
    return if @item_max == 0
    self.contents = Bitmap.new(width - 32, row_max * 32)
    (0...@item_max).each {|i| draw_item(i) }
  end

  def draw_item(index)
    item = @data[index]
    qty, steps = @shop_goods[index][2..3]
    number = case item
    when RPG::Item then $game_party.item_number(item.id)
    when RPG::Weapon then $game_party.weapon_number(item.id)
    when RPG::Armor then $game_party.armor_number(item.id)
    end
    enough = (number + qty < 100 and steps <= $game_party.steps)
    self.contents.font.color = enough ? normal_color : disabled_color
    y = index * 32
    rect = Rect.new(4, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = enough ? 255 : 128
    self.contents.blt(4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(32, y, 212, 32, item.name, 0)
    self.contents.draw_text(244, y, 88, 32, qty.to_s, 2)
  end
  undef discount, discount=
end

class Window_ShopNumber
  include WindowModule
  def initialize
    super(0, 128, 368, 288)
    self.contents = Bitmap.new(width - 32, height - 32)
    @item = nil
    @max = 1
    @price = 0
    @number = 1
    @multiplier = 1
  end

  def reset_multiplier
    @multiplier = 1
    @number = 1
    refresh
  end

  def set(item, max, price, percent=nil, multiplier=1)
    @item = item
    @max = max
    @price = price
    @number = 1
    @multiplier = multiplier
    @percent = percent
    refresh
  end

  def update
    super
    return unless self.active
    if Input.repeat?(Input::RIGHT) and @number < @max # Cursor right (+1)
      $game_system.se_play($data_system.cursor_se)
      @number += @multiplier
      refresh
    end
    if Input.repeat?(Input::LEFT) and @number > @multiplier # Cursor left (-1)
      $game_system.se_play($data_system.cursor_se)
      @number -= @multiplier
      refresh
    end
    if Input.repeat?(Input::UP) and @number < @max # Cursor up (+10)
      $game_system.se_play($data_system.cursor_se)
      @number = [@number + 10 * @multiplier, @max].min
      refresh
    end
    if Input.repeat?(Input::DOWN) and @number > @multiplier # Cursor down (-10)
      $game_system.se_play($data_system.cursor_se)
      @number = [@number - 10 * @multiplier, 1].max
      refresh
    end
  end

  def refresh
    self.contents.clear
    draw_item_name(@item, 4, 96)
    self.contents.font.color = normal_color
    if @multiplier == 1
      cx1, cx2, cx3, cw1, cw2 = [272, 308, 304, 24, 32]
    else
      cx1, cx2, cx3, cw1, cw2 = [260, 264, 272, 68, 64]
    end
    self.contents.draw_text(cx1, 96, 32, 32, "")
    self.contents.draw_text(cx2, 96, cw1, 32, @number.to_s, 2)
    self.cursor_rect.set(cx3, 96, cw2, 32)
    gold = $data_system.words.gold
    cx = contents.text_size(gold).width
    subtotal_price = @item.price * @number
    total_price = @price * @number
    labels = KyoShopLabels::PRICELABELS
    if total_price > subtotal_price and @multiplier < 2
      self.contents.font.color = system_color
      self.contents.draw_text(120, 128, 100, 32, labels[0], 2)
      self.contents.draw_text(332-cx, 128, cx, 32, gold, 2)
      self.contents.draw_text(80, 160, 140, 32, labels[1], 2)
      self.contents.draw_text(328-cx, 160, cx + 4, 32, '%', 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 128, 328-cx-2, 32, subtotal_price.to_s, 2)
      self.contents.draw_text(4, 160, 328-cx-2, 32, @percent.to_s, 2)
    end
    self.contents.draw_text(4, 192, 328-cx-2, 32, total_price.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(120, 192, 100, 32, labels[2], 2)
    self.contents.draw_text(332-cx, 192, cx, 32, gold, 2)
  end
end

class Window_ShopBuyOptions < Window_Selectable
  def initialize
    commands = KyoShopLabels::BUYPLACEPICKUP.dup
    varid = $game_variables[KyoShop::STORECODEVARID]
    commands.pop unless KyoShop::INVESTSTOREIDS.include?(varid)
    super(214, 148, 212, commands.size * 32 + 32)
    @commands = commands
    @item_max = @commands.size
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    refresh
    self.index = 0
  end

  def refresh
    self.contents.clear
    @item_max.times {|i| @commands[i]
    contents.draw_text(4, i * 32, 172, 32, @commands[i]) }
  end
end

class Window_ShopDiscountAlert < Window_Base
  def initialize
    super(0, 416, 368, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
  end

  def set_text(text)
    self.contents.clear
    self.contents.draw_text(0, 0, width - 32, height - 32, text)
  end
end

class Window_ShopDiscountCoupon < Window_Selectable
  def initialize
    super(0, 128, 368, 288)
    self.index = 0
    refresh
  end

  def item() @data[@index] end

  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    dc_ids = $game_party.discounts.keys.sort
    dc_ids.each {|i| next if $game_party.discounts[i] == 0
      next if !$game_system.disc_store?(i) and !$game_system.excl_disc_store?(i)
      @data << $data_items[i] }
    KyoShop::COUPON_IDS.each {|i| next unless $game_party.item_number(i) > 0
      @data << $data_items[i] }
    @item_max = @data.size
    return if @item_max == 0
    self.index -= 1 if @index > @item_max - 1
    self.contents = Bitmap.new(width - 32, row_max * 32)
    (0...@item_max).each {|i| draw_item(i) }
  end

  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item.id)
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
    self.contents.draw_text(x + 28, y, 212, 32, item.name)
    self.contents.draw_text(x + 28, y, 244, 32, ': ' + number.to_s, 2)
  end

  def update_help
    KyoShopOrders.goods_id = self.item.id
    @help_window.set_text(self.item.description)
  end
end

class Window_ShopStatus
  alias kyon_discounts_win_shop_status_refresh refresh
  def refresh
    if @investment
      refresh_investment
      return
    end
    kyon_discounts_win_shop_status_refresh
  end

  def investment=(bool)
    @investment = bool
    refresh
  end

  def refresh_investment
    shares = $game_system.shop_shares[$game_variables[KyoShop::STORECODEVARID]]
    contents.font.color = system_color
    contents.draw_text(0, 0, 240, 32, KyoShopLabels::TOTALSHARES)
    contents.font.color = normal_color
    contents.draw_text(0, 0, 240, 32, shares.to_s, 2)
  end
end

class Interpreter
  alias kyon_discounts_inter_comm_302 command_302
  def command_302
    if $game_switches[KyoShop::GOODSSWITCHID]
      KyoShopOrders.store_event_id = @event_id
      $game_switches[KyoShop::GOODSSWITCHID] = false
      $game_system.shop_goods = [@parameters]
      loop do
        @index += 1
        if @list[@index].code == 605
          $game_system.shop_goods << @list[@index].parameters
        else
          return false
        end
      end
    end
    kyon_discounts_inter_comm_302
  end
end

class Scene_Shop
  alias kyon_discounts_scn_shop_up update
  def main
    start
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if @exit
    end
    Graphics.freeze
    terminate
  end

  def start
    @stage = :main
    @shop_id = $game_variables[KyoShop::STORECODEVARID]
    @goods = $game_temp.shop_goods.dup
    @orders = $game_system.shop_goods.dup
    update_goods_orders_after_investment
    make_basic_windows
    @discount_window = Window_ShopDiscountCoupon.new
    @discount_window.disappear
    @discount_window.help_window = @help_window
    unless $game_system.shop_goods.empty?
      @order_window = Window_ShopBuy.new($game_system.shop_goods)
      @order_window.disappear
      @order_window.help_window = @help_window
      @option_window = Window_ShopBuyOptions.new
      @option_window.disappear
    end
    @purchase_window = Window_ShopBuy.new($game_temp.shop_goods)
    @purchase_window.disappear
    @purchase_window.help_window = @help_window
    @pack_id = [$game_map.map_id, KyoShopOrders.store_event_id]
    goods = $game_system.placed_orders[@pack_id]
    goods = [] unless goods
    @pickup_window = Window_ShopPickUp.new(goods)
    @pickup_window.disappear
    @pickup_window.help_window = @help_window
    @sell_window = Window_ShopSell.new
    @sell_window.disappear
    @sell_window.help_window = @help_window
    @number_window = Window_ShopNumber.new
    @number_window.disappear
    @status_window = Window_ShopStatus.new
    @status_window.visible = false
  end

  def update_goods_orders_after_investment
    gds = []
    orders = []
    stuff = $game_system.check_shares(@shop_id)
    return if stuff.empty?
    stuff.each {|b| gds += strings_goods_conversion(b[1..-1]) if b[0] == :goods
      orders += string_good_conversion(b[1..-1]) if b[0] == :orders }
    $game_system.shop_goods = (@orders + orders).sort.uniq
    $game_temp.shop_goods = (@goods + gds).sort.uniq
  end

  def strings_goods_conversion(strings)
    data = []
    for string in strings
      item = case string[0,1]
      when 'i' then [0, string[1..-1].to_i]
      when 'w' then [1, string[1..-1].to_i]
      when 'a' then [2, string[1..-1].to_i]
      end
      data << item
    end
    data
  end

  def make_basic_windows
    @help_window = Window_Help.new
    @command_window = Window_ShopCommand.new
    @gold_window = Window_Gold.new
    @gold_window.x = 480
    @gold_window.y = 64
    @dummy_window = Window_Base.new(0, 128, 640, 352)
    @question_window = Window_ShopDiscountAlert.new
    @question_window.visible = false
  end

  def terminate
    @help_window.dispose
    @command_window.dispose
    @gold_window.dispose
    @dummy_window.dispose
    @purchase_window.dispose
    @pickup_window.dispose
    @sell_window.dispose
    @number_window.dispose
    @status_window.dispose
    @question_window.dispose
    @discount_window.dispose
    $game_variables[KyoShop::STORECODEVARID] = 0
    return if $game_system.shop_goods.empty?
    @order_window.dispose
    @option_window.dispose
    $game_system.shop_goods.clear
    KyoShopOrders.commissions.clear
    KyoShopOrders.steps.clear
    KyoShopOrders.store_event_id = nil
    @stage = @exit = nil
  end

  def update_discount_message
    cd = $game_party.check_discounts
    text = cd ? KyoShopLabels::SOMEDISCOUNTS : KyoShopLabels::NODISCOUNTS
    @question_window.set_text(text)
  end

  def update
    @help_window.update
    @gold_window.update
    @dummy_window.update
    @sell_window.update
    @status_window.update
    case @stage
    when :main then update_command
    when :option then update_option
    when :purchase then update_purchase
    when :place then update_place_order
    when :pickup then update_pickup_order
    when :discount then update_discount
    when :appraise then update_appraisal
    when :sell then update_sell
    when :number then update_number
    end
  end

  def update_command
    @command_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return @exit = true
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0 # buy
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        if $game_system.shop_goods.empty?
          @discount = 0
          @dummy_window.visible = false
          @question_window.visible = true
          @status_window.visible = true
          @purchase_window.appear
          @purchase_window.refresh
          update_discount_message
          return @stage = :purchase
        else
          @option_window.appear
          return @stage = :option
        end
      when 1 # sell
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @dummy_window.visible = false
        @sell_window.appear
        @sell_window.refresh
        return
      when 2 # quit
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Map.new
      end
    end
  end

  def update_option
    @option_window.update
    @order_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @option_window.disappear
      @status_window.visible = false
      @command_window.active = true
      @dummy_window.visible = true
      return @stage = :main
    elsif Input.trigger?(Input::C)
      shares = $game_system.shop_shares[@shop_id]
      inv_max, inv_price = KyoShop::SHARESMAXMIN
      if @option_window.index == 4 and inv_max == shares
        return $game_system.se_play($data_system.buzzer_se)
      end
      $game_system.se_play($data_system.decision_se)
      @dummy_window.visible = false
      @option_window.disappear
      @question_window.visible = true
      @status_window.visible = true
      case @option_window.index
      when 0 # buy
        @discount = 0
        @purchase_window.discount = 0
        disc = $game_system.check_shares(@shop_id)
        disc.each {|b| @purchase_window.discount += b[1] if b[0] == :discount }
        @status_window.item = @purchase_window.item
        @purchase_window.refresh
        @purchase_window.appear
        update_discount_message
        return @stage = :purchase
      when 1 # place order
        @status_window.item = @order_window.item
        @order_window.appear
        @order_window.refresh
        @question_window.set_text(KyoShopLabels::PLACEORDER)
        return @stage = :place
      when 2 # pick up stuff
        @status_window.item = @pickup_window.item
        @pickup_window.appear
        @pickup_window.refresh
        @question_window.set_text(KyoShopLabels::PICKUPORDER)
        return @stage = :pickup
      when 3 # appraisal
        
        return @stage = :appraise
      when 4 # investments
        @status_window.investment = @investment = true
        inv_max = [inv_max - shares, $game_party.gold / inv_price].min
        fake_item = RPG::Item.new
        fake_item.name = KyoShopLabels::SHARES
        @price = inv_price
        @number_window.set(fake_item, inv_max, inv_price, nil, 10)
        @number_window.appear
        @question_window.set_text(KyoShopLabels::INVESTMENT)
        @stage = :invest
      end
    end
  end

  def update_purchase
    @purchase_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      if $game_system.shop_goods.empty?
        @command_window.active = true
        @stage = :main
      else
        @option_window.appear
        @stage = :option
      end
      @discount = 0
      @purchase_window.discount = 0
      @dummy_window.visible = true
      @purchase_window.disappear
      @question_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
      @status_window.item = @purchase_window.item
      return
    end
    if Input.trigger?(KyoShop::DISCOUNTBUTTON)
      unless $game_party.check_discounts
        return $game_system.se_play($data_system.buzzer_se)
      end
      $game_system.se_play($data_system.decision_se)
      @purchase_window.disappear
      @discount_window.refresh
      @discount_window.appear
      @question_window.set_text(KyoShopLabels::SELECTDISCOUNT)
      return @stage = :discount
    elsif Input.trigger?(Input::C)
      discount = @purchase_window.discount
      percent = KyoShop.current_price_max
      @item = @purchase_window.item
      @price = @item.price + @item.price * percent / 100
      @price -= @item.price * discount / 100 if discount > 0
      if @item == nil or @price > $game_party.gold
        return $game_system.se_play($data_system.buzzer_se)
      end
      shop_max = KyoShop.current_item_max
      if (number = check_number) == shop_max
        return $game_system.se_play($data_system.buzzer_se)
      end
      $game_system.se_play($data_system.decision_se)
      max = @price == 0 ? shop_max : $game_party.gold / @price
      max = [max, shop_max - number].min
      @purchase_window.disappear
      @number_window.set(@item, max, @price)
      @number_window.appear
      @last_stage = @stage
      @stage = :number
    end
  end

  def update_place_order
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @option_window.appear
      @dummy_window.visible = true
      @order_window.disappear
      @question_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return @stage = :option
    end
    if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
      @status_window.item = @order_window.item
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @item = @order_window.item
      @price = @item.price
      percent = KyoShopOrders.commissions[@order_window.index]
      percent += KyoShop.current_price_max
      @price += percent * @item.price / 100 if percent > 0
      if @item == nil or @price > $game_party.gold
        return $game_system.se_play($data_system.buzzer_se)
      end
      number = check_number
      shop_max = KyoShop.current_item_max
      if number == shop_max
        return $game_system.se_play($data_system.buzzer_se)
      end
      $game_system.se_play($data_system.decision_se)
      max = @price == 0 ? shop_max : $game_party.gold / @price
      max = [max, shop_max - number].min
      @order_window.disappear
      @place_order = true
      @number_window.set(@item, max, @price, percent)
      @number_window.appear
      @question_window.set_text(KyoShopLabels::FEESAPPLY)
      @last_stage = @stage
      @stage = :number
    end
  end

  def update_pickup_order
    @pickup_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @dummy_window.visible = true
      @question_window.visible = false
      @status_window.visible = false
      @pickup_window.disappear
      @option_window.appear
      return @stage = :option
    end
    if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
      @status_window.item = @pickup_window.item
      return
    end
    if Input.trigger?(Input::C)
      current_item = @pickup_window.item
      goods = $game_system.placed_orders[@pack_id]
      unless goods
        return $game_system.se_play($data_system.buzzer_se)
      end
      goods = goods[@pickup_window.index]
      unless current_item and goods[3] <= $game_party.steps
        return $game_system.se_play($data_system.buzzer_se)
      end
      $game_system.se_play($data_system.decision_se)
      number = goods[2]
      case current_item
      when RPG::Item then $game_party.gain_item(current_item.id, number)
      when RPG::Weapon then $game_party.gain_weapon(current_item.id, number)
      when RPG::Armor then $game_party.gain_armor(current_item.id, number)
      end
      $game_system.placed_orders[@pack_id].delete_at(@pickup_window.index)
      @pickup_window.deliver($game_system.placed_orders[@pack_id])
    end
  end

  def update_discount
    @discount_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @discount_window.disappear
      @purchase_window.appear
      return @stage = :purchase
    elsif Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @coupons_allowed = KyoShop::COUPON_IDS.include?(@discount_window.item.id)
      @purchase_window.discount -= @discount
      @discount = @discount_window.item.price
      @discount_window.disappear
      @purchase_window.appear
      discount = @purchase_window.discount += @discount
      @purchase_window.refresh
      text = sprintf(KyoShopLabels::APPLYDISCOUNT, discount)
      @question_window.set_text(text)
      @stage = :purchase
    end
  end

  def update_appraisal
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @purchase_window.appear
      return @stage = :option
    elsif Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      
    end
  end

  def check_number
    return number = case @item
    when RPG::Item then $game_party.item_number(@item.id)
    when RPG::Weapon then $game_party.weapon_number(@item.id)
    when RPG::Armor then $game_party.armor_number(@item.id)
    end
  end

  def update_number
    @number_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @number_window.disappear
      @number_window.reset_multiplier
      case @command_window.index
      when 0 # buy or place order
        if @place_order
          @place_order = nil
          @order_window.appear
          @question_window.set_text(KyoShopLabels::PLACEORDER)
        elsif @investment
          @investment = nil
          @status_window.investment = nil
          @option_window.appear
          @question_window.visible = false
          @status_window.visible = false
          @dummy_window.visible = true
        else
          @purchase_window.appear
          discount = @purchase_window.discount
          if discount == 0
            update_discount_message
          else
            text = sprintf(KyoShopLabels::APPLYDISCOUNT, discount) + "%"
            @question_window.set_text(text)
          end
        end
      when 1 # sell
        update_discount_message
        @sell_window.appear
        @status_window.visible = false
      end
      @stage = @last_stage
      return @last_stage = nil
    elsif Input.trigger?(Input::C)
      $game_system.se_play($data_system.shop_se)
      @number_window.disappear
      case @command_window.index
      when 0  # buy
        $game_party.lose_gold(@number_window.number * @price)
        number = @number_window.number
        if @place_order
          update_number_place_order(number)
        elsif @investment
          update_number_investment(number)
        else
          update_number_purchase(number)
        end
        @stage = @last_stage
        return @last_stage = nil
      when 1  # sell
        number = @number_window.number
        $game_party.gain_gold(number * (@item.price / 2))
        case @item
        when RPG::Item then   $game_party.lose_item(@item.id, number)
        when RPG::Weapon then $game_party.lose_weapon(@item.id, number)
        when RPG::Armor then  $game_party.lose_armor(@item.id, number)
        end
        @gold_window.refresh
        @sell_window.refresh
        @status_window.refresh
        @sell_window.appear
        @status_window.visible = false
        @stage = @last_stage
        return @last_stage = nil
      end
    end
  end

  def update_number_place_order(number)
    steps = $game_party.steps + KyoShopOrders.steps[@order_window.index]
    order = [nil, @item.id, number, steps]
    order[0] = case @item
    when RPG::Item then 0
    when RPG::Weapon then 1
    when RPG::Armor then 2
    end
    $game_system.placed_orders[@pack_id] ||= []
    $game_system.placed_orders[@pack_id] << order
    @pickup_window.deliver($game_system.placed_orders[@pack_id])
    @gold_window.refresh
    @status_window.refresh
    @place_order = nil
    @order_window.refresh
    @order_window.appear
    @question_window.set_text(KyoShopLabels::PLACEORDER)
  end

  def update_number_investment(number)
    @investment = nil
    @status_window.investment = nil
    $game_system.shop_shares[@shop_id] += number
    update_goods_orders_after_investment
    @order_window.deliver($game_system.shop_goods)
    @purchase_window.deliver($game_temp.shop_goods)
    @gold_window.refresh
    @question_window.visible = false
    @status_window.visible = false
    @dummy_window.visible = true
    @number_window.reset_multiplier
    @number_window.disappear
    @option_window.appear
  end

  def update_number_purchase(number)
    case @item
    when RPG::Item then $game_party.gain_item(@item.id, number)
    when RPG::Weapon then $game_party.gain_weapon(@item.id, number)
    when RPG::Armor then $game_party.gain_armor(@item.id, number)
    end
    if @coupons_allowed
      @coupons_allowed = nil
      $game_party.lose_item(@discount_window.item.id, 1)
      update_discount_message
      @discount_window.refresh
      @purchase_window.discount = 0
      @discount = 0
    end
    @gold_window.refresh
    @status_window.refresh
    @purchase_window.refresh
    @purchase_window.appear
  end
end
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
(01-12-2019, 12:03 PM)Steel Beast 6Beets Wrote: On a different subject, is there a way to make a status buff permanent on a player once they have learned a skill on XP?

Are you talking about having a status bonus effect such as "Haste"? I never saw anyone make a status effect fully permanent. Well, not one that is not concealed in some way (ie ... vampirism or something ^_^). It need not require a script either. Performing a test, I just took DAZZLE, and knocked off anything that made the state vanish: Unchecked the 'Release at the end of battle' , set 'after X turns' to 0, and set both chance to release values to 0%. Other than making Aluxes totally weak on combat Laughing it works just fine. I used an event and made him already "Dazzled" before he enters battle, and he emerges still Dazzled after.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }




Users browsing this thread: 310 Guest(s)