Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

help make advenced money system

aeuwa

Member

In RPG maker XP the default money system is just a basic currency and you just count up how much (gold) you have.  I am trying to make a system which uses England's old system, meaning the penny shilling and pound.  Where 12 pence(plural for penny) equals 1 shilling and 20 shillings equals 1 pound.  I need help so that the character can collect these different types of coins and have it automatically change 12 pence for 1 shilling and the same for shilling to pound.  It also would be helpful if i could make the shops work this way too.

thank you.
 
Sephiroth Spawn wrote 'dynamic currencies', but I believe this is to have different currencies for different 'countries' or areas in your game, and be able to exchange them.

1) are you asking for a tutorial on how to make such a system? Otherwise this belongs in the "RGSS support" or "Script Request" forum.

2) do you want them to be independent? i.e. could you ever have more than 11 pence in your inventory?
 
Outcast, you can't change the Gold window, or Shop windows without scripting.

You could display the amount in a text message ( \v[1],\v[2]),
where variable 2 = gold % 100, and variable 1 = (gold - variable[2]) / 100

But the menus would still show it without the comma.

Be Well
 

aeuwa

Member

If someone could get it to work with having more than 11 pence at a time then that would be ok but it might be too troublesome so it is ok to limit it at 11 pence too.
 

aeuwa

Member

I think that it would work to just have the basic money system in pence only but have variables that show the player the amount in pence, shillings and pounds. 

example:
If the player's money variable was 1328 pence he would see 8 pence, 10 shillings and 5 pounds.  Then in the store and Item might cost 15 shillings and 2 pound so when the player buys it the item really costs 660 pence.  The shop would work as usual subtracting 660 from 1328 to get 668 they would then have 8 pence, 15 shillings and 2 pounds.
 
I think this is something easy to do.  Give me a few minutes to see what I can come up with.

Done.  ;)

Right now the money shows up in the following format
#P. #S. #p.
Where P stands for Pound, S for Shilling and p for penny.  If you would like it to appear different, tell me and I'll change it.

Code:
#============================================================================
# ** Advance Money System
#----------------------------------------------------------------------------
# vpcdmd
# 1.0
# 2/9/2008
#---
# ~ Originally requested by                 : aeuwa
#============================================================================

#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
#  This window displays amount of gold.
#==============================================================================

class Window_Gold < Window_Base
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    pound = $game_party.gold/240
    shilling = ($game_party.gold - (pound * 240)) / 12
    penny = ($game_party.gold - (pound * 240) - (shilling * 12))
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120, 32, pound.to_s + 'P. ' + shilling.to_s +
    'S. ' + penny.to_s + "p.", 2)
  end
end
#==============================================================================
# ** Window_ShopBuy
#------------------------------------------------------------------------------
#  This window displays buyable goods on the shop screen.
#==============================================================================

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    if item.price <= $game_party.gold and number < 99
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    pound = item.price/240
    shilling = (item.price - (pound * 240)) / 12
    penny = (item.price - (pound * 240) - (shilling * 12))
    self.contents.draw_text(x + 213, y, 120, 32, pound.to_s + 'P. ' +
    shilling.to_s + 'S. ' + penny.to_s + "p.", 2)
  end
end
#==============================================================================
# ** Window_ShopNumber
#------------------------------------------------------------------------------
#  This window is for inputting quantity of items to buy or sell on the
#  shop screen.
#==============================================================================

class Window_ShopNumber < Window_Base
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_item_name(@item, 4, 96)
    self.contents.font.color = normal_color
    self.contents.draw_text(272, 96, 32, 32, "×")
    self.contents.draw_text(308, 96, 24, 32, @number.to_s, 2)
    self.cursor_rect.set(304, 96, 32, 32)
    total_price = @price * @number
    pound = total_price/240
    shilling = (total_price - (pound * 240)) / 12
    penny = (total_price - (pound * 240) - (shilling * 12))
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 160, 328, 32, pound.to_s + 'P. ' +
    shilling.to_s + 'S. ' + penny.to_s + "p.", 2)
  end
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top