http://www.gamebaker.com/rmxp/scripts/multiple-currencies.htm
복수의 화폐단위를 사용할 수 있게 하는 스크립트입니다. 예전에 올렸던 것의 버전업판. 이 스크립트를 사용하려면 SG_Setting Control(http://www.gamebaker.com/rmxp/scripts/settings-control.htm )과 SG_Window Control(http://www.gamebaker.com/rmxp/scripts/window-control.htm )이 필요합니다.
#=============================================================================
# ** SG Multiple Currencies
#=============================================================================
# sandgolem
# Version 3
# 18.06.06
#=============================================================================
# This requires event scripting to switch, see below.
# The only script-related things to edit is this:
$sg_currencies = { 'names' => ['Temp','G','Tokens','Tickets'],
'icons' => ['','mbag','coin','card'],
'type' => [7,0,0,0],
'variables' => [7,2,3,4] }
# These need to be ordered exactly the same. You can increase the amount of
# currencies by adding more to the end of each.
# Temp is used for special occasions. See the tutorials section here for some
# odd ways of using it: http://www.gamebaker.com/rmxp/tutorials/
# Set the G to what you have your gold name as in the database.
# Icons, type & vars are picked based on the order that you have your names set
# to. Make sure you name the variables in RMXP so you won't reuse them.
# 'type' uses SG Window Control to set the window format.
# See the comments in that script for what options are available.
#=============================================================================
# To change the player's currency, use this in a call script:
# sg_change_currency('NameHere')
# This changes your current currency and modifies the amount of gold you have
# to whatever it is set at. The amount of gold you had before is set to the
# variable listed for it. This can be used anywhere, even in other scripts
# The variable used for your current gold is NOT altered until you change the
# currency. To do checks for that amount ingame, just use the regular gold.
# Or, you can save it by using this in a script: sg_save_currency
# This command is included in sg_change_currency and generally not useful
#=============================================================================
#
# To check for updates or find more scripts, visit:
# http://www.gamebaker.com/rmxp/scripts/
#
# To use this script, copy it and insert it in a new section above "Main",
# under the default scripts and Software Development Kit (optional).
#
# Requires SG Settings Control & SG Window Control, found at above site
#
# Have problems? You can leave me a message at:
# http://www.gamebaker.com/users/sandgolem
#
#=============================================================================
#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------
begin
SDK.log("SG Multiple Currencies", "sandgolem", 3, "18.06.06")
if SDK.state("SG Multiple Currencies") != true
@sg_multiple_currencies_disabled = true
end
rescue
end
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if !@sg_multiple_currencies_disabled
class SG_Start
alias sandgolem_currencies_sgstart_start start_game
def start_game
if !$sg_defaultcurrency
$sg_defaultcurrency = $data_system.words.gold.clone
else
$data_system.words.gold = $sg_defaultcurrency.clone
end
sandgolem_currencies_sgstart_start
end
end
class Scene_Load
alias sandgolem_currencies_load_read read_save_data
def read_save_data(file)
sandgolem_currencies_load_read(file)
if $game_sg['currency current']
$data_system.words.gold = $game_sg['currency current'].clone
end
end
end
class Window_Gold < Window_Base
alias sg_currencies_gold_initialize initialize
def initialize
@old_gold = -1
sg_currencies_gold_initialize
end
def refresh
#------------------------------------------------------------------------------
# Begin SG Multiple Currencies Edit
#------------------------------------------------------------------------------
if @old_gold != $game_party.gold
self.contents.clear
@old_gold = $game_party.gold
self.contents.font.color = normal_color
sg_select_currency
sg_draw_window($sg_currencies['type'][@sg_mc_temp],160,$sg_currencies['icons'][@sg_mc_temp],$data_system.words.gold,$game_party.gold.to_s)
end
#------------------------------------------------------------------------------
# End SG Multiple Currencies Edit
#------------------------------------------------------------------------------
end
def sg_select_currency
for i in 0...$sg_currencies.size
if $data_system.words.gold == $sg_currencies['names'][i]
@sg_mc_temp = i
return
end
end
@sg_mc_temp = 1
return
end
end
def sg_save_currency
for i in 0...$sg_currencies.size
if $data_system.words.gold == $sg_currencies['names'][i]
$game_variables[$sg_currencies['variables'][i]] = $game_party.gold
return
end
end
p 'You have an invalid currency name! Contact game creator: ' + $data_systems.words.gold.to_s
@sg_mc_currency_stop = true
return
end
def sg_change_currency(curnew)
sg_save_currency
if curnew == 'curold'
if $game_sg['currency old']
curnew = $game_sg['currency old']
else
p 'No old currency saved. Contact game creator.'
end
end
if @sg_mc_currency_stop == true
return
end
$game_sg['currency old'] = $data_system.words.gold.clone
sg_mc_temp = 0
for i in 0...$sg_currencies.size
if curnew == $sg_currencies['names'][i]
$game_party.lose_gold($game_party.gold)
$game_party.gain_gold($game_variables[$sg_currencies['variables'][i]])
$data_system.words.gold = curnew
$game_sg['currency current'] = curnew
return
end
end
p 'Invalid currency name in command! Contact game creator: ' + cur_new.to_s
return
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end
복수의 화폐단위를 사용할 수 있게 하는 스크립트입니다. 예전에 올렸던 것의 버전업판. 이 스크립트를 사용하려면 SG_Setting Control(http://www.gamebaker.com/rmxp/scripts/settings-control.htm )과 SG_Window Control(http://www.gamebaker.com/rmxp/scripts/window-control.htm )이 필요합니다.
#=============================================================================
# ** SG Multiple Currencies
#=============================================================================
# sandgolem
# Version 3
# 18.06.06
#=============================================================================
# This requires event scripting to switch, see below.
# The only script-related things to edit is this:
$sg_currencies = { 'names' => ['Temp','G','Tokens','Tickets'],
'icons' => ['','mbag','coin','card'],
'type' => [7,0,0,0],
'variables' => [7,2,3,4] }
# These need to be ordered exactly the same. You can increase the amount of
# currencies by adding more to the end of each.
# Temp is used for special occasions. See the tutorials section here for some
# odd ways of using it: http://www.gamebaker.com/rmxp/tutorials/
# Set the G to what you have your gold name as in the database.
# Icons, type & vars are picked based on the order that you have your names set
# to. Make sure you name the variables in RMXP so you won't reuse them.
# 'type' uses SG Window Control to set the window format.
# See the comments in that script for what options are available.
#=============================================================================
# To change the player's currency, use this in a call script:
# sg_change_currency('NameHere')
# This changes your current currency and modifies the amount of gold you have
# to whatever it is set at. The amount of gold you had before is set to the
# variable listed for it. This can be used anywhere, even in other scripts
# The variable used for your current gold is NOT altered until you change the
# currency. To do checks for that amount ingame, just use the regular gold.
# Or, you can save it by using this in a script: sg_save_currency
# This command is included in sg_change_currency and generally not useful
#=============================================================================
#
# To check for updates or find more scripts, visit:
# http://www.gamebaker.com/rmxp/scripts/
#
# To use this script, copy it and insert it in a new section above "Main",
# under the default scripts and Software Development Kit (optional).
#
# Requires SG Settings Control & SG Window Control, found at above site
#
# Have problems? You can leave me a message at:
# http://www.gamebaker.com/users/sandgolem
#
#=============================================================================
#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------
begin
SDK.log("SG Multiple Currencies", "sandgolem", 3, "18.06.06")
if SDK.state("SG Multiple Currencies") != true
@sg_multiple_currencies_disabled = true
end
rescue
end
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if !@sg_multiple_currencies_disabled
class SG_Start
alias sandgolem_currencies_sgstart_start start_game
def start_game
if !$sg_defaultcurrency
$sg_defaultcurrency = $data_system.words.gold.clone
else
$data_system.words.gold = $sg_defaultcurrency.clone
end
sandgolem_currencies_sgstart_start
end
end
class Scene_Load
alias sandgolem_currencies_load_read read_save_data
def read_save_data(file)
sandgolem_currencies_load_read(file)
if $game_sg['currency current']
$data_system.words.gold = $game_sg['currency current'].clone
end
end
end
class Window_Gold < Window_Base
alias sg_currencies_gold_initialize initialize
def initialize
@old_gold = -1
sg_currencies_gold_initialize
end
def refresh
#------------------------------------------------------------------------------
# Begin SG Multiple Currencies Edit
#------------------------------------------------------------------------------
if @old_gold != $game_party.gold
self.contents.clear
@old_gold = $game_party.gold
self.contents.font.color = normal_color
sg_select_currency
sg_draw_window($sg_currencies['type'][@sg_mc_temp],160,$sg_currencies['icons'][@sg_mc_temp],$data_system.words.gold,$game_party.gold.to_s)
end
#------------------------------------------------------------------------------
# End SG Multiple Currencies Edit
#------------------------------------------------------------------------------
end
def sg_select_currency
for i in 0...$sg_currencies.size
if $data_system.words.gold == $sg_currencies['names'][i]
@sg_mc_temp = i
return
end
end
@sg_mc_temp = 1
return
end
end
def sg_save_currency
for i in 0...$sg_currencies.size
if $data_system.words.gold == $sg_currencies['names'][i]
$game_variables[$sg_currencies['variables'][i]] = $game_party.gold
return
end
end
p 'You have an invalid currency name! Contact game creator: ' + $data_systems.words.gold.to_s
@sg_mc_currency_stop = true
return
end
def sg_change_currency(curnew)
sg_save_currency
if curnew == 'curold'
if $game_sg['currency old']
curnew = $game_sg['currency old']
else
p 'No old currency saved. Contact game creator.'
end
end
if @sg_mc_currency_stop == true
return
end
$game_sg['currency old'] = $data_system.words.gold.clone
sg_mc_temp = 0
for i in 0...$sg_currencies.size
if curnew == $sg_currencies['names'][i]
$game_party.lose_gold($game_party.gold)
$game_party.gain_gold($game_variables[$sg_currencies['variables'][i]])
$data_system.words.gold = curnew
$game_sg['currency current'] = curnew
return
end
end
p 'Invalid currency name in command! Contact game creator: ' + cur_new.to_s
return
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end