질문과 답변

Extra Form
본문에 따르면 가게 이벤트 전에 PERCENT_BUY = Variable X = 또는 PERCENT_SELL = Variable X 을 어디 이벤트로 넣으라던데, 그게 무슨 뜻인 지 모르겠네요. '스크립트'에 뭘 써서 넣으라는 것인지, 주석에 넣으라는 것인지.


#===============================================================================
#
# 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
#
#===============================================================================

Who's 하늘바라KSND

profile

하늘바라KSND

하늘

하늘이

늘바

바라

하바

하바케이

하바케이엔

하느님 

------------------------------

현재 하는 일 :



허걱님과 함꼐하는 하늘섬 환상세계 시나리오 작성 중.

자세한 경과는 이야기 연재란에서.

 

Lighna형과 함께하는 프로젝트, D.A 시나리오 작성 중.

프로젝트 D.A 많은 관심 부탁드려요~

http://projetda.tistory.com/

-------------------------------

 

ㅎㅎ. 안녕하세요 하늘바라 KSND 입니다. 

(96년생)

성별 : 남

사용툴 : VX

주요 활동 : 소설쓰기, 댓글, 뻘글, 글소글

 

블로그 주소 : http://hb_tjdtn.blog.me/                 

 

이전 준비 중

http://habakn.tistory.com/         

 

 

Comment '2'
  • ?
    아이미르 2012.07.19 16:19
    # This determines the variables used to set the price percentage rate for
    # buying and selling items.
    PERCENT_BUY = 67
    PERCENT_SELL = 68

    라니까 아마 상점의 처리 전에 구입시세, 판매시세 처리를 위해서 67번 변수와 68번 변수에 숫자를 넣으라는 뜻 아닐까요. 위의 67, 68을 바꿔주면 처리 변수를 다른 걸로 바꿀 수 있을 겁니다.
  • profile
    하늘바라KSND 2012.07.19 16:27
    아!

    버라이어블이 변수라는 뜻이었군요!

    그것도 모르고 전...(으잌.;)

List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12449
기타 !! 자료실의 게임 소재들이 안 보여요 !! 라스민트 2010.11.14 1547
RMVXA "그림의 이동"에 걸리는 시간을 변수로 대체할 수 있을까요? 3 file Roam 2012.11.26 1069
RMXP "마녀의 집" 게임 첫부분 처럼 화면 맵 이동하는 방법 2 허곰탱 2014.02.20 1327
RMVXA "메뉴>상태>캐릭터선택>상태창"에서 캐릭터 선택을 없애기 2 Refus 2015.06.18 317
게임찾기 "보코의 농장"이란 게임 갖고있는분 찾습니다 2 A.미스릴 2013.04.27 2223
RMXP "주인공과 어떤 이벤트와 눈이 마주쳤을 때" 라는 조건분기 어떻게 만드나요? 1 CJYG* 2011.06.29 1589
RMVXA "피격당할때" 조건문을 넣기 머그빵 2016.01.07 135
RMVXA #추격 #추적 #사망 #게임오버 에 대해서 가르쳐주세요 5 신이다1 2018.05.13 277
RMMV $gameScreen.showPicture 쓸려하는데 어떻게 써야하나요. 4 게임잘날아가는닝겐 2016.01.15 224
RMVX $game_party.item_number로 아이템 숫자가 호출이 안 되는데 뭐가 문제일까요? 1 MMM 2014.07.07 751
RMVXA $game_variables은 뭔가요? 스크립트에 적는거인건 아는데... 1 알만툴초보입니당 2017.03.02 100
RMVX $scene = Scene_ATB.new 이게 안됩니다 2 file 욕쟁이스님 2012.11.04 931
이벤트 작성 RMMV '데미지의 처리' 구현법이 있나요? 아무개 2021.03.26 43
플러그인 추천 RMMV "버튼 액션"?에 관한 질문입니다! 2 소랭소랭 2021.03.20 144
플러그인 사용 RMMV "특정이름을 입력했을 때 이벤트 발생하기" 질문입니다! 2 소랭소랭 2021.01.26 149
RMMV "파티원"의 옷을 갈아입히면 케릭터칩을 그 옷을 입은 칩으로 바뀌게 하고싶습니다. 4 만죠메군 2017.07.09 496
플러그인 추천 RMMV "히어로즈 오브 마이트 앤 매직"같은 형식으로 전투를 할수있게해주는 플로그인이 있을까요? file 희희낙낙 2019.10.06 80
RMVXA '(번역) 선택지에서 \를 사용시 공백발생현상 해결' 스크립트를 찾습니다. 3 카로 2012.12.20 877
RMVXA 'A값이 B값보다 클 경우'를 스크립트로 어떻게 표현하죠? 2 게임잘날아가는닝겐 2015.09.19 169
RMVX 'rpg 쯔꾸르 vx'에서 한국 노래가 bgm으로 써지지 않습니다. 2 마런마 2014.01.14 1330
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 516 Next
/ 516