My game uses small numbers overall, and so there's no need for the player to be able to carry a ton of gold. I want to make the gold cap out at 9,999, so... how do I achieve this?
How can I limit the amount of gold that can be carried?
RGSS3 Script RequestsCopy and paste this scriptlet on your script editor.
The downside is that you'd lose the rest of the gold. 😀
The Alternative
Ruby:
class Game_Party
def max_gold() 9999 end
end
The downside is that you'd lose the rest of the gold. 😀
The Alternative
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
Works perfect, thanks! 😀
Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-limit-the-amount-of-gold-that-can-be-carried.140292/