Setting Gold to a Variable

● ARCHIVED · READ-ONLY
Started by CrazyCrab 7 posts View original ↗
  1. Hi everyone,

    this might be pretty dumb but I really can't find a simple solution for it as the change gold only allows you to increase / decrease the amount of gold.

    I have a variable ''production'' which can be used for many things, one of them being a kind of currency. 

    Given that the shop system will work perfectly (even though its not a shop) I want the player's gold to always be equal to variable production.

    How can I do this? I know it's a parallel process but I just don't know how to do it.

    Thanks!
  2. #===============================================================================#                      http://dekitarpg.wordpress.com/                         #===============================================================================module Gold_Var#===============================================================================  #-----------------------------------------------------------------------------  #  #-----------------------------------------------------------------------------  Variable_ID = 50  #-----------------------------------------------------------------------------  #  #-----------------------------------------------------------------------------end#===============================================================================#                      http://dekitarpg.wordpress.com/                         #===============================================================================class Game_Party < Game_Unit#===============================================================================  #-----------------------------------------------------------------------------  #  #-----------------------------------------------------------------------------  def gain_gold(amount)    @gold = [[$game_variables[Gold_Var::Variable_ID].to_i,0].max, max_gold].min  end  #-----------------------------------------------------------------------------  #  #-----------------------------------------------------------------------------end#===============================================================================#                      http://dekitarpg.wordpress.com/                         #===============================================================================Putting that into your script editor will mean that every single time you use the change gold feature, the gold will ALWAYS become the value of Variable_ID

    (Edit: Unless the variable value is higher than the max allowed gold.)

    hope that helps :)
  3. Great! Thanks a lot.

    If everything goes well the project might go commercial - do you mind if I use it in it?
  4. If your making a commercial project and wish to use this script, you must pay me a fee of either 1 million doll hairs or your soul. Either is fine by me ^_^
     
  5. Lol, alright  ;)

    Just wanted to make sure, some people can be quite nit-picky when it comes to commercial use.

    Feel free to close the thread.
  6. Lol, I am one of those nit picky people, but for this snippet, I dont mind ^_^
  7. This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.