じ☆ve冰风 发表于 2026-8-2 18:23:04

Extra Gold XP & ACE

Extra Gold XP & ACE

by Kyonides Arkanthes​


Introduction

Usually you could just change a method in the Game_Party class to set a permanent limit for the amount of gold the party can keep in its purse. This scriptlet pretends to override that by allowing you the game developer to change the Maximum Gold Limit in game at any given time.

It includes several script calls for your convenience so please read the instructions, namely the Script Calls section of my scriptlet. By the way, I forgot to mention that you can also set an initial maximum limit by modifying the value of the MAX_GOLD constant. It's the only constant there so you won't miss it!


There are no screenshots for this changes had never relied on any GUI at all.


                Ruby:       
# * Extra Gold XP & ACE
#   Scripter : Kyonides Arkanthes
#   2021-09-09
=begin
*** Script Calls ***

- Check out how much Extra Gold the party has earned - They cannot spend it!
$game_party.extra_gold

- Reach Maximum Gold Limit
$game_party.extra_gold_to_purse

- Check out what is the current Maximum Gold Limit
$game_party.max_gold

- Change Maximum Gold Limit at Any Given Time In Game
$game_party.max_gold = NewLimit

- Has the Party's Purse reached the Maximum Gold Limit?
$game_party.gold_max?

=end

class Game_Party
MAX_GOLD = 9999
alias :kyon_extra_gold_gm_pty_init :initialize
def initialize
    kyon_extra_gold_gm_pty_init
    @max_gold = MAX_GOLD
    @extra_gold = 0
end

def gain_gold(amount)
    next_gold = [[@gold + amount, 0].max, max_gold].min
    diff = @gold - next_gold
    @extra_gold += diff if diff > 0
    @gold = next_gold
end

def extra_gold_to_purse
    diff = max_gold - @gold
    @extra_gold -= diff
    @gold = diff > 0 ? max_gold : @gold
end
def gold_max?() max_gold == @gold end
attr_reader :extra_gold
attr_accessor :max_gold
end


Terms & Conditions

Free for use anywhere.

Include me in your game credits!

That's all, folks!



本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/extra-gold-xp-ace.140296/
页: [1]
查看完整版本: Extra Gold XP & ACE