加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 djs789783 于 2024-3-14 14:32 编辑
ACE第二货币工程案例发给大家,还有其它方式可以写出来哈,我也是啥都不懂,
请大佬看看脚本有没问题。
我发工程案例出来给大家。
我也是到处找第二种货币,都没工程案例,刚好有大佬指教就整理一个多种货币工程案例,希望有和我一样的小白可以用到它。
#第二货币设置 $SECOND_CURRENCY_SWITCH = 1 $SECOND_CURRENCY_NAME = "钻石" #第二货币方法 class Game_Party < Game_Unit attr_reader :spegold alias initialize_normal_sc initialize def initialize initialize_normal_sc @spegold = 0 end alias gain_gold_normal_sc gain_gold def gain_gold(amount) if $game_switches[$SECOND_CURRENCY_SWITCH] @spegold = [[@spegold + amount, 0].max, max_gold].min else gain_gold_normal_sc(amount) end end end #第二货币的显示 class Window_Gold < Window_Base #覆盖方法!可能引起冲突 def initialize super(0, 0, window_width, fitting_height(2)) refresh end alias refresh_normal_sc refresh def refresh refresh_normal_sc draw_currency_value($game_party.spegold, $SECOND_CURRENCY_NAME, 4, 24, contents.width - 8) end end #战斗胜利不获得第二货币 module BattleManager #覆盖方法!可能引起冲突 def self.gain_gold if $game_troop.gold_total > 0 text = sprintf(Vocab::ObtainGold, $game_troop.gold_total) $game_message.add('\.' + text) $game_party.gain_gold_normal_sc($game_troop.gold_total) end wait_for_message end end #用第二货币买东西 module RPG class Item def price if $game_switches[$SECOND_CURRENCY_SWITCH] note.split(/[\r\n]+/).each { |line| case line when /<第二货币价格:(\d+)>/i return $1.to_i end } return 0 else return @price end end end end #商店中购买钻石物品显示钻石 class Window_ShopNumber < Window_Selectable alias draw_total_price_normal_sc draw_total_price def draw_total_price if $game_switches[$SECOND_CURRENCY_SWITCH] @currency_unit = $SECOND_CURRENCY_NAME end draw_total_price_normal_sc end end class Scene_Shop < Scene_MenuBase alias money_normal_sc money def money if $game_switches[$SECOND_CURRENCY_SWITCH] return $game_party.spegold else return money_normal_sc end end alias create_gold_window_normal_sc create_gold_window def create_gold_window create_gold_window_normal_sc @gold_window.y -= 24 end end
#第二货币设置
$SECOND_CURRENCY_SWITCH = 1
$SECOND_CURRENCY_NAME = "钻石"
#第二货币方法
class Game_Party < Game_Unit
attr_reader :spegold
alias initialize_normal_sc initialize
def initialize
initialize_normal_sc
@spegold = 0
end
alias gain_gold_normal_sc gain_gold
def gain_gold(amount)
if $game_switches[$SECOND_CURRENCY_SWITCH]
@spegold = [[@spegold + amount, 0].max, max_gold].min
else
gain_gold_normal_sc(amount)
end
end
end
#第二货币的显示
class Window_Gold < Window_Base
#覆盖方法!可能引起冲突
def initialize
super(0, 0, window_width, fitting_height(2))
refresh
end
alias refresh_normal_sc refresh
def refresh
refresh_normal_sc
draw_currency_value($game_party.spegold, $SECOND_CURRENCY_NAME, 4, 24, contents.width - 8)
end
end
#战斗胜利不获得第二货币
module BattleManager
#覆盖方法!可能引起冲突
def self.gain_gold
if $game_troop.gold_total > 0
text = sprintf(Vocab::ObtainGold, $game_troop.gold_total)
$game_message.add('\.' + text)
$game_party.gain_gold_normal_sc($game_troop.gold_total)
end
wait_for_message
end
end
#用第二货币买东西
module RPG
class Item
def price
if $game_switches[$SECOND_CURRENCY_SWITCH]
note.split(/[\r\n]+/).each { |line|
case line
when /<第二货币价格:(\d+)>/i
return $1.to_i
end
}
return 0
else
return @price
end
end
end
end
#商店中购买钻石物品显示钻石
class Window_ShopNumber < Window_Selectable
alias draw_total_price_normal_sc draw_total_price
def draw_total_price
if $game_switches[$SECOND_CURRENCY_SWITCH]
@currency_unit = $SECOND_CURRENCY_NAME
end
draw_total_price_normal_sc
end
end
class Scene_Shop < Scene_MenuBase
alias money_normal_sc money
def money
if $game_switches[$SECOND_CURRENCY_SWITCH]
return $game_party.spegold
else
return money_normal_sc
end
end
alias create_gold_window_normal_sc create_gold_window
def create_gold_window
create_gold_window_normal_sc
@gold_window.y -= 24
end
end
这脚本没有显示的哈,有没大佬加工下。就是打开箱子有自动提示获得的物品提示。
我是自己加了文字内容提示,比较麻烦。 |