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.

Two gold systems in Rpg Maker XP

I need to know how to make your gold system change between two worlds. Like in TLoZ:Oracle of Seasons. Basicly everytime I change to a certain map, I need my gold to change to a certain ammount, and change its name in the pause menu. Thanks in advance.
 

poccil

Sponsor

When you say to change gold "to a certain amount", do you mean to adjust it for exchange rates?

To make the word "gold"  change depending on the current map, you can use a script like this (put it before the last script in the script editor).  To customize it, read the notes within the script and follow its example:

Code:
class RPG::System::Words
  def gold
    return @gold if !$game_map
    case $game_map.map_id
      when 10, 11, 12, 13  # add map IDs separated by commas
       return "Gold2"
      when 14, 15, 16, 17 # add map IDs separated by commas
       return "Gold3"
      else # For everything else
       return @gold
    end
  end
end
 
I'm pretty much a noob at scripting. Basicly there are two continents in my game. Basicly whenever I move to one of the other continents, I need a new gold system. Like if I were to go from the US to Mexico, I would need a different currency. I would just use variables, but gold is displayed on the pause menu. With that script, the name change would be easy enough. How would I go about changing the ammount of each different curreny I have?
 
I just had a thought. Is there a way to make the gold display on the pause menu to display a variable instead. Because then I could just use variables for my different monatary systems.
 

poccil

Sponsor

To describe a currency system, it is necessary to have a nominal currency, similar to how we can compare the dollar to the euro, or the dollar to the yen.  The script below implements exchange rates, meaning the value of a currency in relation to a neutral, or nominal currency.  For example, if 1 gil is worth 2 gold (the nominal currency), then the exchange rate is 2.  (Put the script before the last script in the script editor.  To customize it, read the notes within the script and follow its example.)

Please note that with this script installed, all transactions will be done in the local currency, and all money will be displayed in the local currency; however, the gold will be stored internally in the nominal currency, for convenience.

Code:
# Gets the exchange rate of the currency depending on
# the current map
def getExchangeRate
 return 1.0 if !$game_map
 case $game_map.map_id
   when 10, 11, 12, 13  # add map IDs separated by commas
     return 1.2 # Worth 1.2 times the nominal currency
   when 14, 15, 16, 17 # add map IDs separated by commas
     return 0.8 # Worth 1.2 times the nominal currency
   else # For everything else
     return 1.0
   end
end

class Game_Party
  def gain_gold(n)
    @gold = [[@gold+(n*1.0*getExchangeRate()), 0].max, 9999999].min
  end
  def gold
    goldValue=(@gold*1.0/getExchangeRate())
    goldValue=[[goldValue,0.0].max,9999999.0].min
    return goldValue.to_i
  end
end
 
Wow, while that is a great script, and it gave me a couple ideas, it is not quite what I'm looking for. You see, the one form of currency is worthless in the other country, so when the player first visits this other area there gold goes from xxxx to 0, and then back again when the character leaves.
 

poccil

Sponsor

Well then, you can just store the old gold in a variable like: "Control Variables: [XXXX] = Gold" and restore it when the player leaves.  Here's an example:

Entering new country:

Code:
@>Comment: Resetting gold to 0
@>Control Variables: [0010: Gold] = Gold
@>Change Gold: - Variable [0010: Gold]

Leaving country:

Code:
@>Comment: Resetting gold to 0
@>Control Variables: [0001: Temp] = Gold
@>Change Gold: - Variable [0001: Temp]
@>Comment: Restoring gold
@>Change Gold: + Variable [0010: Gold]
 

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