Save-Point
Currency Script - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Archives (https://www.save-point.org/forum-105.html)
+--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html)
+---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html)
+----- Forum: RPG Maker XP Code (https://www.save-point.org/forum-93.html)
+----- Thread: Currency Script (/thread-6838.html)



Currency Script - Split - 05-18-2006

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


This script allows you to have more than one type of currency(Ex. Gold, Gil, Cash) Just add these commands somewhere in Game_Party

Demos at bottom

to add to Gil use this line
Code:
$game_party.gaingil(put the amount here)

and for cash

Code:
$game_party.gaincash(put the amount here)

Code:
#--------------------------------------------------------------------------
  # EDIT START
  #--------------------------------------------------------------------------
  def gain_gil(n)
    @gil = [[@gil + n, 0].max, 9999999].min
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def lose_gil(n)
    # Reverse the numerical value and call it gain_gil
    gain_gil(-n)
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
    def gain_cash(n)
    @cash = [[@cash + n, 0].max, 9999999].min
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def lose_cash(n)
    # Reverse the numerical value and call it gain_gold
    gain_cash(-n)
  end
  
  #5 gil = 1 gold
  #1 cash = 3 gold
  #15 gil = 1 cash

  def giltogold(gil_amount = @gil)
    return if @gil < 5
    @gil /= 5
    @gold += @gil
    @gil -= @gil
  end
  
  def giltocash(gil_amount = @gil)
    return if @gil < 15
    @gil /= 15
    @cash += @gil
    @gil -= @gil
  end
  
  def goldtogil(gold_amount = @gold)
    @gil += gold_amount * 5
    @gold -= gold_amount
  end
  
  def cashtogil(cash_amount = @cash)
    @gil += cash_amount * 5
    @cash -= cash_amount
  end
  
  def goldtocash(gold_amount = @gold)
    return if @gold < 3
    @gold /= 3
    @cash += @gold
    @gold -= @gold
  end
  
  def cashtogold(cash_amount = @cash)
    @gold += cash_amount * 3
    @cash -= cash_amount
  end
  #--------------------------------------------------------------------------
  # EDIT STOP
  #--------------------------------------------------------------------------

For got the thanks:

SephirothSpawn - For helping me with the currency exchange
ShadowWolf- For giving me the idea



.rar   NewMoney.rar (Size: 190.74 KB / Downloads: 3)