Save-Point
Extra Gold ACE - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker VX/VXAce (RGSS2/3) Engines (https://www.save-point.org/forum-117.html)
+---- Thread: Extra Gold ACE (/thread-9363.html)



Extra Gold ACE - kyonides - 09-12-2024

Extra Gold ACE

by Kyonides

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! Grinning

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

Code:
# * 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. Grinning
Include me in your game credits! Laughing
That's all, folks! Winking