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
257 영상 동영상 재생 스크립트.-Game_Film II-(테스트) 7 할렘 2009.02.22 3741
256 전투 방어를 했을경우 hp / mp 회복 되도록 하는 스크립트 15 아방스 2008.01.22 3746
255 메뉴 전투승리시 아이템 경험치팝업창 스크립트 18 file 카르와푸딩의아틀리에 2009.06.23 3760
254 그래픽 밤낮 변환 스크립트 18 kram3 2008.01.31 3762
253 기타 레벨업 이펙트... 20 비극ㆍ 2010.04.19 3768
252 상점 상점 아이템 목록 정리 14 정의로운녀석 2008.07.22 3771
251 키입력 입력 기능 확장 스크립트 추가. [전체키 스크립트] 22 아방스 2008.08.25 3772
250 메뉴 몬스터도감 Tankentai사이드뷰에 작동하도록 수정 13 카르와푸딩의아틀리에 2009.05.22 3775
249 이동 및 탈것 부드럽게 이동, 8 방향이동 스크립트 25 file 사람이라면? 2010.08.16 3795
248 아이템 아이템 획득 팝업 스크립트 24 아방스 2009.01.07 3805
247 이동 및 탈것 화면의 부드러운 스크롤 스크립트 32 카르와푸딩의아틀리에 2009.07.17 3817
246 기타 설명하기 힘든 스크립트 (스크린샷 확인) 10 file 사람이라면? 2010.08.16 3818
245 맵/타일 맵에 이벤트 뿌리기 입니다. 7 file 허걱 2009.01.31 3827
244 기타 통합 스크립트(좋은 마우스 스크립트 좋은거),KGC좋은거 새로운 거 스크립트 세이브 스크립트 좋은거!~~~~~ 14 알피지GM 2010.03.07 3829
243 메뉴 YERD - 커먼 이벤트 메뉴 4 file 훈덕 2009.11.08 3850
242 심플하게 메뉴 띄우기 25 file RPGbooster 2008.10.08 3864
241 파티 파티 체인저 3.4 최신 13 file RPGbooster 2008.10.08 3864
240 전투 VX]Mog Battleback XP 1.0 11 file WMN 2008.04.06 3869
239 전투 Spirits System 정령 장착?이라고해야되나; 26 file 카르와푸딩의아틀리에 2009.08.19 3869
238 기타 VX에서 포그 그래픽을 사용하자 16 아방스 2008.01.31 3895
Board Pagination Prev 1 ... 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ... 32 Next
/ 32