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 스킬 무기 업그레이드 시스템 27 file 담먹캐 2009.11.01 5757
396 상점 스킬합성 상점 스크립트 23 file 미얼 2009.10.29 4498
395 전투 불사신(무적) 스크립트 9 file 미얼 2009.10.29 3198
394 메시지 대화창효과 8 078656577er 2009.10.20 5972
393 기타 사이드뷰배틀에서 찌르기 공격 가능하게(Upgrade!) 6 078656577er 2009.10.15 2838
392 전투 사이드뷰배틀에서 시각적으로 위치 지정하기 9 file 078656577er 2009.10.14 4908
391 맵/타일 새로운 월드맵 만들기 (로맨싱사가풍) 37 file 078656577er 2009.10.09 6151
390 기타 KGC패시브 스크립트 30 카르와푸딩의아틀리에 2009.10.07 3551
389 저장 오토세이브 VX 5 file 카르와푸딩의아틀리에 2009.10.05 4138
388 메시지 얼굴표시 9 허걱 2009.09.23 5001
387 전투 사이드뷰배틀에서 찌르기 공격 가능하게 7 078656577er 2009.09.16 3223
386 전투 반사 스테이트 -KGC 4 카르와푸딩의아틀리에 2009.09.12 2661
385 기타 커스텀 페이지 스크립트 9 file 달표범 2009.09.07 3140
» 상점 상점 할인 스크립트(변수를 이용한 물건 가격 조정) 9 달표범 2009.09.04 3185
383 맵/타일 타일 바꾸기 13 file 허걱 2009.09.01 3687
382 전투 대미지%MP흡수 스크립트 4 Evangelista 2009.08.31 2279
381 전투 대미지 MP전환 스테이트 : 수정 => 마나쉴드 7 Evangelista 2009.08.29 2384
380 HUD 네비게이션 (나침반) 36 file 허걱 2009.08.25 4908
379 이동 및 탈것 느리게 걷기 5 허걱 2009.08.23 2424
378 타이틀/게임오버 Rafidelis KaHh Box 타이틀화면 20 카르와푸딩의아틀리에 2009.08.23 5004
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