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
317 저장 세이브 시스템 확장 스크립트 9 file 신규회원 2012.02.24 3315
316 아이템 아이템 분류 19 file RPGbooster 2008.10.11 3309
315 저장 세이브/로드가 불가능한 스크립트!!! 9 file ~AYARSB~ 2010.03.08 3298
314 스킬 DQ특기풍스킬 - KGC 4 카르와푸딩의아틀리에 2009.08.19 3288
313 이름입력 MOG 이름바꾸기 11 file RPGbooster 2008.10.08 3285
312 장비 장비 레벨 개념 추가 스크립트 14 아방스 2010.12.06 3275
311 액터 한계돌파(렙9999) 18 작은샛별 2010.03.07 3273
310 다음 레벨까지의 경험치 강제조정 13 정의로운녀석 2008.07.24 3273
309 기타 KGC파라미터배분 2 (VX전용) 20 file 카르와푸딩의아틀리에 2009.07.21 3269
308 이동 및 탈것 탈것탑승후 내부로 이동하는 스크립트 16 file 카르와푸딩의아틀리에 2009.07.01 3268
307 상태/속성 어떤 상태일때에만 사용가능한 스킬 14 file 좀비사냥꾼 2009.03.25 3266
306 기타 라이트 이펙트 스크립트 12 file 아방스 2009.02.07 3262
305 기타 [kcg] 슬립 데미지 상세화 19 BoneheadedAlien 2009.02.22 3242
304 메시지 메시지 오른쪽 정렬되어 나오는 스크립트 3 file 아방스 2009.07.12 3237
303 기타 <중수이상>RPG VX의 대표적 참조값 6 까까까 2009.05.31 3236
302 타이틀/게임오버 Graphics Load System 1.0.1 14 file NightWind AYARSB 2010.06.10 3230
301 전투 사이드뷰배틀에서 찌르기 공격 가능하게 7 078656577er 2009.09.16 3223
300 전투 불사신(무적) 스크립트 9 file 미얼 2009.10.29 3198
299 기타 [자작]게임 실행시 파일 체크 프로그램. 또는 파일 실행기. 16 file NightWind AYARSB 2010.05.20 3192
» 상점 상점 할인 스크립트(변수를 이용한 물건 가격 조정) 9 달표범 2009.09.04 3185
Board Pagination Prev 1 ... 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 ... 32 Next
/ 32