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
437 상태/속성 상태 메뉴 변경 스크립트 45 죄송해욧! 2008.03.01 4284
436 상점 상점의 자세한 표시 32 file RPGbooster 2008.10.11 4008
435 상점 상점을 색다르게 바꿔주는 스크립트 34 file 할렘 2009.02.02 6301
434 상점 상점에서 아이템 분류 5 file 파이어 2011.01.23 3510
» 상점 상점 할인 스크립트(변수를 이용한 물건 가격 조정) 9 달표범 2009.09.04 3185
432 상점 상점 아이템 목록 정리 14 정의로운녀석 2008.07.22 3771
431 상점 상점 무기, 방어구 능력치 비교 스크립트! 18 불독 2008.12.25 3611
430 기타 사이드뷰배틀에서 찌르기 공격 가능하게(Upgrade!) 6 078656577er 2009.10.15 2838
429 전투 사이드뷰배틀에서 찌르기 공격 가능하게 7 078656577er 2009.09.16 3223
428 전투 사이드뷰배틀에서 시각적으로 위치 지정하기 9 file 078656577er 2009.10.14 4910
427 전투 사이드뷰배틀3.3 + ATB1.1 스크립트. 65 할렘 2009.02.01 10946
426 전투 사이드뷰 애드온 7 비극ㆍ 2010.08.21 6758
425 전투 사이드뷰 스크립트 [2003 전투 방식] 39 아방스 2008.03.09 8406
424 전투 사이드 뷰 시스템 [시트르산님 제공] 56 아방스 2010.11.29 7499
423 오디오 사운드테스트 스크립트 13 file 카르와푸딩의아틀리에 2009.08.19 2106
422 오디오 사운드 자동 변환 설정 rukan 2009.07.01 1461
421 빠른 스킬사용 6 file RPGbooster 2008.10.08 2814
420 기타 빛 이펙트 71 file DEVIL<Li Patanis Roni Kraudus> 2008.06.06 5861
419 기타 블록 미니게임 11 file 사람이라면? 2010.08.15 2269
418 기타 블랙잭, 룰렛, 포커 스크립트 종합 9 file 도심 2010.08.22 2643
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 32 Next
/ 32