[XP] Gold, Silver, Copper money system

Started by Taiine, October 24, 2009, 01:56:20 am

Previous topic - Next topic

Taiine

I'm looking for a new money system (think WoW) where
100 copper > 1 silver
100 silver = 1 gold
possibly with images for the diff coins.

that will also work in shops. I did find a money converter some time ago that turned gold into dollars (1g = 1 cent) but can't find it at the moment, however even if I did I don't think itm would work out for this.

Much appreciation in advanced.

Oh and ps. I'm not wanting this to make things 'look cool' with no real use for it. Fare from it,  I'd like this to make item prices and money spending a bit more even out rather then having an item for a huge sum of gold. And it would help out in my one game as you start out in a poorer section and make more sents for people to have copper and silver to start with then a stash of gold. Honestly, a few gold for some bread? Must be darn good bread. xD

Blizzard

Quote from: Taiine on October 24, 2009, 01:56:20 am
Honestly, a few gold for some bread? Must be darn good bread. xD


Depends on how much a piece of gold is valued. xD

Have you tried searching the script database yet? I think that somebody posted something related to currencies. Maybe it was a system like this that only needs to be modified a bit.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Taiine

October 24, 2009, 09:14:57 am #2 Last Edit: October 24, 2009, 11:18:19 am by Taiine
Oh I've browsed the script database a number of times, finding a couple of nice tidbits that further enhanced my game :) but no, I don't think it was here that I found that one edit that turned 1g into 1 cent to change the games gold into dollars (100g = $1 250g = $2.50). I'm still searching for it, I know I bookmarked it for a future date but firefox seems to be iffy at times when it comes to saving favs. >.>


Edit: Yay I found the script that changed gold into dollars, however I'm not 100% sure if this can be edited to change gold into silver and copper where 100 copper = 1 silver and 100 silver = 1 gold.
But here it is none the less.

One thing forgot to bring up! Also been using http://www.creationasylum.net/forum/index.php?showtopic=16879 for my shops (looks a lot cleaner then most stop systems I've seen) and the below only half works with it. While the amount you have is down the item price is not converted.

I also use http://www.rpgrevolution.com/forums/index.php?showtopic=34792 and the other rearranged CMS windows by Law, does work it's just extremely picky as in what order it goes in for it to work right XD
So if the below is used as a base for what I'd like, or a new system done up entirely, that's about it :P


#==============================================================================
# ■ Dollars
#==============================================================================
# Jadant
# Version 1
# 18.11.06
#
#Used to convert gold to dollars and cents.
#The change is purely superficial and only changes the window displays,
#no changes to actual gold calculations.
#==============================================================================

 
 #===================================================
 # ▼ CLASS Window_Gold additional code begins
 #===================================================

 
 class Window_Gold < Window_Base
 
   alias jadant_dollars_window_gold_refresh refresh
 
   def refresh
   
     @totalcents = $game_party.gold          
     dollars = @totalcents / 100 % 100      
     cents = @totalcents % 100              
     money = sprintf("$%s.%02d", dollars.to_s, cents)
   
     self.contents.clear
     cx = contents.text_size($data_system.words.gold).width
     self.contents.font.color = normal_color
     self.contents.draw_text(4, 0, 120-cx-2, 32, money.to_s, 2)
     self.contents.font.color = system_color
     self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
   end
 end


 #===================================================
 # ▲ CLASS Window_Gold additional code ends
 #===================================================
 
 
 #===================================================
 # ▼ CLASS Window_ShopBuy additional code begins
 #===================================================

 
 class Window_ShopBuy < Window_Selectable
 
   alias jadant_dollars_window_shopbuy_draw_item draw_item

   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)
     @totalcents_price = item.price
     dollars_price = @totalcents_price / 100 % 100
     cents_price = @totalcents_price % 100
     item_price = sprintf("$%s.%02d", dollars_price.to_s, cents_price)
     self.contents.draw_text(x + 240, y, 88, 32, item_price, 2)
   end
 end
 
 #===================================================
 # ▲ CLASS Window_ShopBuy additional code ends
 #===================================================
 
 #===================================================
 # ▼ CLASS Window_ShopNumber additional code begins
 #===================================================


 class Window_ShopNumber < Window_Base
   alias jadant_dollars_Window_ShopNumber_refresh 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)

     domination = $data_system.words.gold
     cx = contents.text_size(domination).width
     total_price = @price * @number
     dollars = total_price / 100 % 100
     cents = total_price % 100
     money = sprintf("$%s.%02d", dollars.to_s, cents)
     self.contents.font.color = normal_color
     self.contents.draw_text(4, 160, 328-cx-2, 32, money, 2)
     self.contents.font.color = system_color
     self.contents.draw_text(332-cx, 160, cx, 32, domination, 2)
   end
 end

 
 #===================================================
 # ▲ CLASS Window_ShopBuy additional code ends
 #===================================================
 
 
 #===================================================
 # ▼ CLASS Window_BattleResult additional code begins
 #===================================================

 
 class Window_BattleResult < Window_Base
 
   alias jadant_dollars_window_battleresult_refresh refresh

   def refresh
     dollars = @gold / 100 % 100
     cents = @gold % 100
     money = sprintf("$%s.%02d", dollars.to_s, cents)
     self.contents.clear
     x = 4
     self.contents.font.color = normal_color
     cx = contents.text_size(@exp.to_s).width
     self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
     x += cx + 4
     self.contents.font.color = system_color
     cx = contents.text_size("Exp").width
     self.contents.draw_text(x, 0, 64, 32, "Exp")
     x += cx + 16
     self.contents.font.color = normal_color
     cx = contents.text_size(money).width
     self.contents.draw_text(x, 0, cx, 32, money)
     x += cx + 4
     self.contents.font.color = system_color
     self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
     y = 32
     for item in @treasures
       draw_item_name(item, 4, y)
       y += 32
     end
   end
 end

 #===================================================
 # ▲ CLASS Window_BattleResult additional code ends
 #===================================================

Jackolas

October 28, 2009, 05:32:29 am #3 Last Edit: October 28, 2009, 08:52:18 am by Jackolas
still working on it (am not that great of a scriper, so taking my time)

something like this?
Spoiler: ShowHide




Sorry, did not have a pic for the command window)


I recommend to us a large gold window because adding 3 extra sprites is taking a lot of room.
and also change the background a little bid (of the shop that is)

phillip1756

Quote from: Jackolas on October 28, 2009, 05:32:29 am
still working on it (am not that great of a scriper, so taking my time)

something like this?
Spoiler: ShowHide




Sorry, did not have a pic for the command window)


I recommend to us a large gold window because adding 3 extra sprites is taking a lot of room.
and also change the background a little bid (of the shop that is)


r u gonna finish this scriot m8,coz it looks good

Jackolas

October 28, 2009, 02:27:09 pm #5 Last Edit: October 29, 2009, 04:02:51 am by Jackolas
yeah working on it. (just posted today  :'( )

atm working at increasing the prices of items.

in the database you can only let items cost a maximal of 99999 (9G 99S 99C)
so need to script a way to overcome this.

Edit:
The script is all done (and working
only problem is that atm its not possible to increase prices of items past (9G 99S 99C)
still working on this

edit 2:
got it working (the increase price), now only need to add a config and I post it here

Taiine

Yeah the shop script has a broken image for the buy/sell window, I took the screen shot and edited out the window to use. lol

It's looking good!

Just one more thing, that I may get shot for ;3
I poked around, and found a item limiter script (something been after for ages past)
http://www.atelier-rgss.com/RGSS/System/XP_SYS04.html
Where you can have a max limit for all items then set a limit for individual items as well, and once you reached the limit you can't buy any more...


however it don't work what so ever with this shop script I use. :( While the limit don't increase, you can still 'buy' items over and over. Anyway to get that compatible with the shop script AND the gold script or am I gona have to make a hefty choice of using it and throwing out the shop script, or keep the shop script and throw out the item limiter. >.<

Jackolas

easy to add
QuoteItem Limit V1.7

wonder why he needed 7 versions (at least)

Taiine


Jackolas

thank me when i finish it:P

btw.. latest update:
Spoiler: ShowHide


changed it so for example if an item cost only 10 silver it won't display the 00 gold in frond of it

Taiine

Could there be a space after the coin graphic? so it's not 00[coin]00[coin]00[coin] but 00[coin] 00[coin] 00[coin] with the spaces?

Jackolas

yes. its possible... but remember every time you add extra room to the money the less room you get for other numbers.

Taiine

That is fine, I'm working on mixing things up a bit on the main menu and one will be making a longer gold bar.

Jackolas

November 02, 2009, 09:28:19 am #13 Last Edit: November 05, 2009, 10:03:41 am by Jackolas
with thanks to Game_Guy i managed to add the higher gold prices to the game.
only the item limiter script and than its done (sorry it takes this long but can't do a lot when I'm at work)

edit:
added some extra room between the numbers
been toying around with different spaces between it and this looked the best
Spoiler: ShowHide


will clean up the script and post it here later today (I hope)
For the edit with item limiter you need to wait a little bid longer

script without the item limiter (place below FF Tactics Advance Shop System):

Spoiler: ShowHide
#=========================================================================================
# ■ Gold, Silver and Copper
# ■ Made to work with FF Tactics Advance Shop System By Mac
#=========================================================================================
# script by:            Jackolas
# Version number:       V 0.90 Beta
# Last edit date:       3-11-09
# Thanks for help:      Game_Guy (helping sort increase gold problem)
#                       Taiine   (for requesting this script)
#
# Used to convert the normal gold to Gold, Silver and Copper
# The change is purely superficial and only changes the window displays,
# no changes to actual gold calculations.
#
# Every price in the editor will be using Copper as basic number
# So an item of normal 12500 Gold wil cost now 1 gold, 25 silver and 00 copper
#==============================================================================
module Jackolas_Gold
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Basic Configuration below
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::  
 Font_size = 18 # Font size of gold, normal is 22 but i recommend 18.
 Modif_Font_size = false # change all font sizes to the same of the gold
 Max_gold = 999 # max gold (look out for the space you have to draw it)
 Gold_Icon = 'goldcoin' # icon of the gold in the menu (put in icon map and 18x18 pix)
 Silver_Icon = 'silvercoin' # icon of the silver in the menu (put in icon map and 18x18 pix)
 Copper_Icon = 'coppercoin' # icon of the copper in the menu (put in icon map and 18x18 pix)
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Basic Configuration above
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 Max_gild = Max_gold * 10000 + 9999 #Do not edit
 Ferror = (Font_size - 17)/2 #Do not edit
end

module RPG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Gold Configuration below
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 class Item
   def price
     case @id
     when 1 then return 100 #1 silver 00 copper
     #when 2 than return 200 etc
     end
     return @price
   end
 end
 class Weapon
   def price
     case @id
     when 1 then return 15000 #1 gold, 50 silver, 00 copper
     #when 2 than return 200 etc
     end
     return @price
   end
 end
 class Armor
   def price
     case @id
     when 1 then return 24999 #2 gold, 49 silver, 99 copper
     #when 2 than return 200 etc
     end
     return @price
   end
 end
end
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Gold Configuration above
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


 #===================================================
 # ▼ CLASS Game_Party additional code begins
 #===================================================
 class Game_Party
     def gain_gold(n)
     @gold = [[@gold + n, 0].max, Jackolas_Gold::Max_gild].min
   end
 end
 #===================================================
 # ▲ CLASS Game_Party additional code ends
 #===================================================
 
 #===================================================
 # ▼ CLASS Window_Gold additional code begins
 #===================================================

 
 class Window_Gold < Window_Base #Hijack the gold code in main menu
 
   alias Jackolas_gold_refresh refresh
 
   def refresh
     #Calculate Gold, Silver and Copper
     @totalmoney = $game_party.gold  
     gild = @totalmoney / 10000
     silver = @totalmoney / 100 % 100
     copper = @totalmoney % 100
     moneygold = sprintf("%s", gild.to_s)
     moneysilver = sprintf("%02d", silver)
     moneycopper = sprintf("%02d", copper)
   
     self.contents.clear
     cx = contents.text_size($data_system.words.gold).width
     rect = Rect.new(0, 0, 18, 18)
     self.contents.font.color = normal_color
     self.contents.font.size = Jackolas_Gold::Font_size
     if gild >= 1
       self.contents.draw_text(0, 0, 34, 32, moneygold.to_s, 2)
       self.contents.blt(32, 8, RPG::Cache.icon(Jackolas_Gold::Gold_Icon), rect)
     end
     if silver >= 1
       self.contents.draw_text(4, 0, 66, 32, moneysilver.to_s, 2)
       self.contents.blt(68, 8, RPG::Cache.icon(Jackolas_Gold::Silver_Icon), rect)
     else
       if gild >= 1
         self.contents.draw_text(4, 0, 66, 32, moneysilver.to_s, 2)
         self.contents.blt(68, 8, RPG::Cache.icon(Jackolas_Gold::Silver_Icon), rect)
       end
     end
     self.contents.draw_text(4, 0, 102, 32, moneycopper.to_s, 2)
     self.contents.blt(104, 8, RPG::Cache.icon(Jackolas_Gold::Copper_Icon), rect)
     self.contents.font.color = system_color
   end
 end

 #===================================================
 # ▲ CLASS Window_Gold additional code ends
 #===================================================
 
 #===================================================
 # ▼ CLASS Window_ShopBuy additional code begins
 #===================================================
module FFT_ShopSystem #Hijack the script
 class Window_ShopBuy < ::Window_ShopBuy #Hijack buy window
   #--------------------------------------------------------------------------
   # * Draw Item
   #--------------------------------------------------------------------------
   def draw_item(index)
     # Gets item Number
     item = @data[index]
     # Gets Number Owned & Equipped
     case item
     when RPG::Item
       number = $game_party.item_number(item.id)
       equipped_number = 0
     when RPG::Weapon
       number = $game_party.weapon_number(item.id)
       equipped_number = $game_party.equipped_weapon_number(item.id)
     when RPG::Armor
       number = $game_party.armor_number(item.id)
       equipped_number = $game_party.equipped_armor_number(item.id)
     end
     # Clears Area
     rect = Rect.new(0, index * 32, contents.width, 32)
     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
     # Draws Icon
     bitmap = RPG::Cache.icon(item.icon_name)
     opacity = self.contents.font.color == normal_color ? 255 : 128
     if Jackolas_Gold::Modif_Font_size
       self.contents.font.size = Jackolas_Gold::Font_size
     else
       self.contents.font.size = Font.default_size
     end
     self.contents.blt(4, index * 32 + 4, bitmap, Rect.new(0, 0, 24, 24),
       opacity)
     # Draws Item Name, Total, Equipped and Price
     self.contents.draw_text(32, index * 32, 212, 32, item.name, 0)
     self.contents.draw_text(334, index * 32, 88, 32,
       (number + equipped_number).to_s, 2)
     self.contents.draw_text(254, index * 32, 88, 32, equipped_number.to_s, 2)
     #Calculate Gold, Silver and Copper
     rect = Rect.new(0, 0, 18, 18)
     @moneycost = item.price
     gild = @moneycost / 10000
     silver = @moneycost / 100 % 100
     copper = @moneycost % 100
     moneygold = sprintf("%s", gild.to_s)
     moneysilver = sprintf("%02d", silver)
     moneycopper = sprintf("%02d", copper)
     # Draw Gold, Silver and Copper
     self.contents.font.size = Jackolas_Gold::Font_size
     if gild >= 1
       self.contents.draw_text(4, 0+index*32, 476, 32, moneygold.to_s, 2)
       self.contents.blt(478, 8+index*32, RPG::Cache.icon(Jackolas_Gold::Gold_Icon), rect)
     end
     if silver >= 1
       self.contents.draw_text(4, 0+index*32, 512, 32, moneysilver.to_s, 2)
       self.contents.blt(514, 8+index*32, RPG::Cache.icon(Jackolas_Gold::Silver_Icon), rect)
     else
       if gild >= 1
         self.contents.draw_text(4, 0+index*32, 512, 32, moneysilver.to_s, 2)
         self.contents.blt(514, 8+index*32, RPG::Cache.icon(Jackolas_Gold::Silver_Icon), rect)
       end
     end
     self.contents.draw_text(4, 0+index*32, 548, 32, moneycopper.to_s, 2)
     self.contents.blt(550, 8+index*32, RPG::Cache.icon(Jackolas_Gold::Copper_Icon), rect)
   end
 end
 #===================================================
 # ▲ CLASS Window_ShopBuy additional code ends
 #===================================================
   
 #===================================================
 # ▼ CLASS Window_ShopSell additional code begins
 #===================================================
 class Window_ShopSell < ::Window_ShopSell #Hijack sell window
   #--------------------------------------------------------------------------
   # * Draw Item
   #--------------------------------------------------------------------------
   def draw_item(index)
     # Gets Item Data
     item = @data[index]
     # Gets Number & Equipped Number
     case item
     when RPG::Item
       number = $game_party.item_number(item.id)
       equipped_number = 0
     when RPG::Weapon
       number = $game_party.weapon_number(item.id)
       equipped_number = $game_party.equipped_weapon_number(item.id)
     when RPG::Armor
       number = $game_party.armor_number(item.id)
       equipped_number = $game_party.equipped_armor_number(item.id)
     end
     # Adjust Font Color By Price
     if item.price > 0
       self.contents.font.color = normal_color
     else
       self.contents.font.color = disabled_color
     end
     # Clears Area
     rect = Rect.new(0, index * 32, contents.width, 32)
     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
     # Draws Icon
     bitmap = RPG::Cache.icon(item.icon_name)
     opacity = self.contents.font.color == normal_color ? 255 : 128
       if Jackolas_Gold::Modif_Font_size
         self.contents.font.size = Jackolas_Gold::Font_size
       else
         self.contents.font.size = Font.default_size
       end
     self.contents.blt(4, index * 32 + 4, bitmap, Rect.new(0, 0, 24, 24),
       opacity)
     # Draws Item Name, Total Owned, Equipped and Price
     self.contents.draw_text(32, index * 32, 212, 32, item.name, 0)
     self.contents.draw_text(334, index * 32, 88, 32,
       (number + equipped_number).to_s, 2)
     self.contents.draw_text(254, index * 32, 88, 32, equipped_number.to_s, 2)
     #Calculate Gold, Silver and Copper
     rect = Rect.new(0, 0, 18, 18)
     @moneycost = item.price / 2
     gild = @moneycost / 10000
     silver = @moneycost / 100 % 100
     copper = @moneycost % 100
     moneygold = sprintf("%s", gild.to_s)
     moneysilver = sprintf("%02d", silver)
     moneycopper = sprintf("%02d", copper)
     # Draw Gold, Silver and Copper
     self.contents.font.size = Jackolas_Gold::Font_size
     if gild >= 1
       self.contents.draw_text(4, 0+index*32, 476, 32, moneygold.to_s, 2)
       self.contents.blt(478, 8+index*32, RPG::Cache.icon(Jackolas_Gold::Gold_Icon), rect)
     end
     if silver >= 1
       self.contents.draw_text(4, 0+index*32, 512, 32, moneysilver.to_s, 2)
       self.contents.blt(514, 8+index*32, RPG::Cache.icon(Jackolas_Gold::Silver_Icon), rect)
     else
       if gild >= 1
         self.contents.draw_text(4, 0+index*32, 512, 32, moneysilver.to_s, 2)
         self.contents.blt(514, 8+index*32, RPG::Cache.icon(Jackolas_Gold::Silver_Icon), rect)
       end
     end
     self.contents.draw_text(4, 0+index*32, 548, 32, moneycopper.to_s, 2)
     self.contents.blt(550, 8+index*32, RPG::Cache.icon(Jackolas_Gold::Copper_Icon), rect)
   end
 end
 #===================================================
 # ▲ CLASS Window_ShopSell additional code ends
 #===================================================  
end


pics needed(place in the icon folder):
   

on a side not. will also make 1 that work with the default shop system

Taiine

Thanks so much! It's perfect! Although to make it more user friendly to other people who may like it (I know of least two others who've been after something like this) I think it's best to also make it effect the default shops, the money you have shows fine, but when you buy/sell the amount below is back to default.

Just a FYI :3

Jackolas

November 13, 2009, 03:05:32 am #15 Last Edit: November 13, 2009, 03:23:31 am by Jackolas
yeah.. still need to work on it... but it requires a lot of editing. and atm its 1 big mess
to make it work with the default I need to remake the whole script (plan to do it when I have time)
Also note that I have (well I think I have) no scripting skills at all. (reason why it takes so long)
all what I make is kinda by looking to other peep scripts.. and a lot of luck


Quotebut when you buy/sell the amount below is back to default.


how you mean? so far I'm not able to recreate this.. do you have any other scripts?

Taiine

I don't mean the gold count in the upper corner. I mean when you go to sell/buy something. the amount that's showing for the total for the amount you are buying/selling for still shows the normal gold amount.

Jackolas


mila26


G_G