VX 스크립트

지정한 구입 가격 할인 및 판매 가격 할인 변수를 조작해, 상점의 물건 값을 낮추는 스크립트입니다.

특별한 액터(예를 들어 상인이나 말빨 좋은 녀석)가 있을때를 조건분기로 해서 활용하면 좋을 듯 합니다.

 

스크립트 수정에 약하시거나, 영어에 약하신 분들이라면... 맨 윗 부분의

# PERCENT_BUY  = Variable 67 = Affects the percentage that will affect the price
#                              the player will buy the item for.
# PERCENT_SELL = Variable 68 = Affects the percentage that will affect the price
#                              the player will sell the item for.

부분만 알아두시면 됩니다. 이 스크립트는 별도의 스크립트 명령어가 아니라, 위의 설정된 저 두가지 변수에 숫자를 넣어서 할인률을 조정할 수 있습니다.

67번 변수가 물건 구입 가격 변수로, 기입하지 않으면 100% 가격으로 물건을 사게 되고, 여기에 50을 쓰시면 물건을 절반 가격으로 살 수 있습니다. 68번 변수는 판매 변수로, 물건 판매가격을 조절하게 됩니다.

 

다른 변수를 물건 가격 결정 변수로 삼고 싶다면.. 조금 더 아래로 내려가

module YE
  module EVENT
    module VARIABLE
     
      # This determines the variables used to set the price percentage rate for
      # buying and selling items.
      PERCENT_BUY  = 67
      PERCENT_SELL = 68
     
      # This is the common divisor for all percentage calculations.
      PERCENT_DIVISOR = 100
     
    end
  end
end

부분을 수정하시면 됩니다. 67,68대신 다른 숫자를 넣으면 되겟지요.

 

아래는 스크립트입니다.

 

출처 : RPG MAKER VX COMMUNITY

 

#===============================================================================
#
# Yanfly Engine RD - Variable Controlled Discounts
# Last Date Updated: 2009.06.03
# Level: Normal
#
# As much as I love price changer scripts and everything, it becomes a tedious
# job to manually adjust the price of each individual item (and calculating the
# new prices) for just one shop and then having to do it again for another. This
# script adjusts the prices of everything sold in the shop by a percentage and
# is controlled by a variable so you don't have to script event it each time.
#
#===============================================================================
# Updates:
# ----------------------------------------------------------------------------
# o 2009.06.03 - Increased compatibility with KGC Limit Break.
# o 2009.05.09 - Started script and finished.
#===============================================================================
# Instructions
#===============================================================================
#
# By default, the variables are as follows:
#
# PERCENT_BUY  = Variable 67 = Affects the percentage that will affect the price
#                              the player will buy the item for.
# PERCENT_SELL = Variable 68 = Affects the percentage that will affect the price
#                              the player will sell the item for.
#
# Before processing a shop event, input the two variables into the event list
# and adjust the percentage rate you wish for the player to buy/sell items at.
# For normal shops, the rate should be 100 for buying and 50 for selling.
#
#===============================================================================
#
# Compatibility
# - Works With: KGC Limit Break
# - Alias: Scene_Shop: update_buy_selection, update_sell_selection
# - Overwrites: Scene_Shop: decide_number_input
#
#===============================================================================

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

module YE
  module EVENT
    module VARIABLE
     
      # This determines the variables used to set the price percentage rate for
      # buying and selling items.
      PERCENT_BUY  = 67
      PERCENT_SELL = 68
     
      # This is the common divisor for all percentage calculations.
      PERCENT_DIVISOR = 100
     
    end
  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.
#===============================================================================

#===============================================================================
# Scene Shop
#===============================================================================

class Scene_Shop < Scene_Base

  #--------------------------------------------------------------------------
  # alias update_buy_selection
  #--------------------------------------------------------------------------
  alias update_buy_selection_vcd update_buy_selection unless $@
  def update_buy_selection
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      number = $game_party.item_number(@item)
      price = @item.price * $game_variables[YE::EVENT::VARIABLE::PERCENT_BUY]
      price /= YE::EVENT::VARIABLE::PERCENT_DIVISOR
      if @item == nil or price > $game_party.gold or number == 99
        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
    else
      update_buy_selection_vcd
    end
  end
 
  #--------------------------------------------------------------------------
  # alias update_sell_selection
  #--------------------------------------------------------------------------
  alias update_sell_selection_vcd update_sell_selection unless $@
  def update_sell_selection
    if Input.trigger?(Input::C)
      @item = @sell_window.item
      @status_window.item = @item
      if @item == nil or @item.price == 0
        Sound.play_buzzer
      else
        price = @item.price * $game_variables[YE::EVENT::VARIABLE::PERCENT_SELL]
        price /= YE::EVENT::VARIABLE::PERCENT_DIVISOR
        Sound.play_decision
        max = $game_party.item_number(@item)
        @sell_window.active = false
        @sell_window.visible = false
        @number_window.set(@item, max, price)
        @number_window.active = true
        @number_window.visible = true
        @status_window.visible = true
      end
    else
      update_sell_selection_vcd
    end
  end
 
  #--------------------------------------------------------------------------
  # Overwrite decide_number_input
  #--------------------------------------------------------------------------
  def decide_number_input
    Sound.play_shop
    @number_window.active = false
    @number_window.visible = false
    case @command_window.index
    when 0  # Buy
      price = @item.price * $game_variables[YE::EVENT::VARIABLE::PERCENT_BUY]
      price /= YE::EVENT::VARIABLE::PERCENT_DIVISOR
      $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
    when 1  # sell
      price = @item.price * $game_variables[YE::EVENT::VARIABLE::PERCENT_SELL]
      price /= YE::EVENT::VARIABLE::PERCENT_DIVISOR
      $game_party.gain_gold(@number_window.number * price)
      $game_party.lose_item(@item, @number_window.number)
      @gold_window.refresh
      @sell_window.refresh
      @status_window.refresh
      @sell_window.active = true
      @sell_window.visible = true
      @status_window.visible = false
    end
  end
 
end

#===============================================================================
# Window ShopBuy
#===============================================================================

class Window_ShopBuy < Window_Selectable
 
  #--------------------------------------------------------------------------
  # overwrite draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item)
    price = item.price * $game_variables[YE::EVENT::VARIABLE::PERCENT_BUY]
    price /= YE::EVENT::VARIABLE::PERCENT_DIVISOR
    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
    enabled = (price <= $game_party.gold and number < max)
    enabled = (price <= $game_party.gold and number < max)
    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, price, 2)
  end
 
end

#===============================================================================
#
# END OF FILE
#
#===============================================================================

TAG •

Who's 달표범

?

제작중

나름의 맹세 : 에스페란사 

차기작

나름의 맹세 : 폭풍의 아이

Comment '9'
  • ?
    배군 2009.09.04 20:18
    오 시세를 책정할수 있겠군요!!
  • ?
    칼리아 2009.09.05 15:56

    ㄳ합니다.

    근데 사용법좀...

  • ?
    누군가 2009.10.03 14:39
    오호라~세일....내가 제일 좋아하는 마트의 이벤트ㅋㅋ
  • ?
    드림스 2009.10.12 18:27

    오 이런거 필요했는데

    감사합니다

  • ?
    화염 2010.07.20 13:48

    어 난외 사용하면 전부다 0/0이라고 설정되ㅏ버리는거지 .ㄷㄷ

  • ?
    나홀로11호 2010.10.06 23:19

    괌 사해요

  • ?
    도심 2011.01.24 21:35

    물가 싼 곳을 따로 지정할때 매우 유용하겠군요.

  • ?
    JHG RPG 2011.08.21 12:37

    이벤트적으로 좋네요

  • ?
    오리엔탈 2011.09.07 21:33

    헉...

    이 스크립트 그대로 적용시켜서 실험해봤습니다.

    아무것도 수정하지 않았는데

    다 0원으로 사지네요.

    가격표시도 0원으로 나오고요. ㅠㅡㅜ


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
397 전투 GubiD's Tactical Battle System 1.5.1.4 (RMVX용) 2 Alkaid 2010.09.03 2858
396 이동 및 탈것 달리면 스태미너가 감소하는 스크립트 18 file 카르와푸딩의아틀리에 2009.06.30 2869
395 헬프윈도우 확장 13 file RPGbooster 2008.10.08 2872
394 그래픽 Arevulopapo's Particle Engine for VX/Ace by PK8 1 Alkaid 2012.05.13 2873
393 기타 텍스트 파일 읽어 오는 스크립트 11 아방스 2008.03.04 2878
392 전투 Etude87_Tankentai_Addon ver.1.0 7 file 습작 2012.06.03 2879
391 저장 Neo Save System VI by Helladen 2 Alkaid 2012.01.15 2886
390 그래픽 Multiple Fogs 1.0 4 아방스 2008.03.05 2886
389 제작도구 Icon Preview Window by Woratana 8 file 허걱 2009.08.20 2891
388 스킬 스킬, 아이템 적아 구분 없이 쓰기 10 file EuclidE 2011.10.16 2900
387 오버 드라이브 8/24 버젼 20 file RPGbooster 2008.10.11 2904
386 기타 던전에 적정 레벨이 어떤건지 스크린에 표시해주는 스크립트! 5 file 루시페르 2009.06.06 2907
385 액터 캐릭터에 다양한 효과주기 투명도 조절 9 아방스 2008.03.04 2943
384 기타 밤낮의 변화에 따른 전투배경의 변화 스크립트 10 file 카르와푸딩의아틀리에 2009.07.01 2948
383 영상 Avi 재생 스크립트! [고화질 재생 가능] 34 짭뿌C 2012.10.24 2952
382 변수/스위치 HG_Variables : 변수 확장 시스템 11 file 허걱 2010.06.14 2957
381 기타 화면에 그림 그리는 스크립트 21 file 강진수 2010.02.27 2962
380 전투 SRPGコンバータ for VX by AD.Bank 습작 2013.05.13 2970
379 액터 (수정)크리쳐 합체, 'SW_CreatureMix' by SiotWarrior 22 file 시옷전사 2010.09.07 2972
378 기타 [요청자료] 유즈미짱 님께서 요청한 그림표시 입니다. 5 file 허걱 2009.07.08 2976
Board Pagination Prev 1 ... 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ... 32 Next
/ 32