TinyMine

Regular
Regular
Joined
Oct 26, 2013
Messages
53
Reaction score
54
First Language
German
Primarily Uses
Tinys More Currencies TMC

 

Update : 1.2

- IMPORTAN BUGFIX in 1.2! 1.1 had an error when exchanging currencies

 

Expand your game by more then 1 currency!

 

Script 1.2

#╔═───────────────────────────────────────────────────────────────────────────═#
#║ Tinys More Currencies (Mainscript)
#║ By TinyMine // english version
#║
#║  First Published/Erstveröffentlicht 12.04.2014
#║
#║  Visit : http://rpgmaker-vx-ace.de/ for further Information
#║
#║  Suggestions? Support? Bugs? Contact me in http://rpgmaker-vx-ace.de/
#║
#║  Credits required : TinyMine
#║  Commercial Use?  : Contact me in http://rpgmaker-vx-ace.de/
#║  Editable?        : Only by original editor TinyMine
#║  
#║  
#║ Version : 1.2 // 04.09.2014
#╚═───────────────────────────────────────────────────────────────────────────═#


$imported ||= {}
$imported[:TINY_TMC] = 1.2


#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Content
#║   
#║    - Expand your game by more currencies.
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Updates
#║   
#║    ■ 1.2
#║    - BUGFIX: Gamebreaker during exchanging currencies
#║   
#║    ■ 1.1
#║    - Penalty support for exchange operations
#║    - New command to check deactive currency stock.
#║   
#║    ■ 1.01
#║    - Better float support
#║   
#║    ■ 1.0
#║    - Release
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Addons
#║   
#║    ■ TMC Menu 1.01
#║    - Show up all currencies in standard main menu in its gold winow.
#║   
#║    ■ TMC Exchanger 1.1
#║    - Use a exchange office to exchange your currencies in a new scene.
#║   
#║    ■ TMC Enhance 1.01
#║    - Extends graphical contents in TMC and its addons.
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Usage In Game
#║ 
#║    following Scriptcommands used:
#║ 
#║    ■ Giving the player money from non-active currency:
#║ 
#║        change_gold(Amount, ID)
#║ 
#║      The usual gold event command works with the currency which is active by
#║      using the following command...
#║ 
#║    ■ To change the currency which is active for event commands:
#║ 
#║        change_currency(ID)
#║ 
#║      All known event commands work with the currency, that is active by this
#║      command.
#║ 
#║    ■ To exchange one currency to another use:
#║ 
#║        exchange_gold(from ID, to ID, Amount, Penalty)
#║ 
#║      Exchange from ID to to ID and set the amount with Amount.
#║      The Penalty is optional and is given by %. It is 100% by default.
#║        
#║    ■ To check if a currency is known:
#║ 
#║        currency_known?(ID)
#║ 
#║      A currency will be automatically known if one of the following commands
#║      were used with a currency:
#║      By "change_currency(...)" or "change_gold(...)" or "exchange_gold(...)"
#║        
#║    ■ To check a currency stock that is not active use:
#║ 
#║        gold?(ID)
#║ 
#║      Is the currency not known yet it will return 0.
#║ 
#╚═───────────────────────────────────────────────────────────────────────────═#
module TINY
  module TMC
    CURRENCIES = {
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Editable Region **              Settings               ** Editable Region █
#╚═───────────────────────────────────────────────────────────────────────────═#     
     
    # Here you create your own currencies:
    
    # Each currency can have its own value. A value of 1 represents the values
    # you use in your database prices. A Item with the Price 50 will cost 50
    # if the value of the used currency is 1. If the value would be 2 the item 
    # would cost only 25. If the value would be 0.5 the item would cost 100.
    
    # Sample for currency creation :
    # ID     =>    ["Name", "Shortcut", Value]
     
    :gold    =>    ["Gold", "G", 2],
    :silver  =>    ["Silver", "Sv", 1],
    :med     =>    ["Medicine", "Md", 5],
    :rocks   =>    ["Rocks", "R", 0.5]
     
     
#═────────────────────────────────────────────────────────────────────────────═#     
    } # Do not touch
#═────────────────────────────────────────────────────────────────────────────═#     
      




    # Define the currency that the Player knows from beginning of the game:
    START_CURRENCY = :silver
    


    
#╔═───────────────────────────────────────────────────────────────────────────═#         
#║ █ **                         END OF SETTINGS                             ** █
#║ █ **               DO NOT TOUCH THE FOLLOWING CONTENTS                   ** █
#╚═───────────────────────────────────────────────────────────────────────────═#
  end # TMC 
#═=═=═════════════════════════════════════════════════════════════════════════=#
end # TINY
#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Module Vocab
#╚═=═=════════════════════════════════════════════════════════════════════════=═
module Vocab
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Return Shortcut By Currency
  #╚────────────────────────────────────────────────────────────────────────────
  def self.currency_unit(currency = $game_party.currency)
    $game_party.currency_shortcut(currency)
  end
  
end # Vocab


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class Game_Interpreter
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Game_Interpreter
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Gold Amount Of Type
  #╚────────────────────────────────────────────────────────────────────────────
  def gold?(type = $game_party.currency)
    return 0 unless currency_known?(type)
    $game_party.gold(type)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Adds/Removes Gold
  #╚────────────────────────────────────────────────────────────────────────────
  def change_gold(amount, type = $game_party.currency)
    $game_party.gain_gold(amount, type)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Changes Currency
  #╚────────────────────────────────────────────────────────────────────────────
  def change_currency(type)
    $game_party.currency = type
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Exchange Currency
  #╚────────────────────────────────────────────────────────────────────────────
  def exchange_gold(from, to, from_amount, penalty = 100)
    $game_party.exchange(from, to, from_amount, penalty)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Is Currency Known?
  #╚────────────────────────────────────────────────────────────────────────────
  def currency_known?(type)
    $game_party.gold_hash.keys.include?(type)
  end
  
end # Game_Interpreter


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class Game_Party
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Game_Party
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Sets New Instances : @gold, @currency
  #╚────────────────────────────────────────────────────────────────────────────
  alias_method :initialize_tmc_23829                                ,:initialize
  def initialize
    initialize_tmc_23829
    @gold = {}
    @currency = TINY::TMC::START_CURRENCY
    set_currency
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Sets Currency In @gold Hash
  #╚────────────────────────────────────────────────────────────────────────────
  def set_currency(type = @currency, reset = false)
    return unless @gold[type].nil? || reset
    @gold[type] = 0
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Empties A Value Of @gold Hash
  #╚────────────────────────────────────────────────────────────────────────────
  def clear_currency(type = @currency)
    @gold[type] = 0
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Deletes A Key Of @gold Hash
  #╚────────────────────────────────────────────────────────────────────────────
  def delete_currency(type = @currency)
    @gold.delete(type)
  end
    
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  New Argument For Old Method : type
  #╚────────────────────────────────────────────────────────────────────────────
  def gain_gold(amount, type = @currency)
    @gold[type].nil? ? base = 0 : base = @gold[type]
    @gold[type] = [[base + amount, 0].max, max_gold].min
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  New Argument For Old Method : type
  #╚────────────────────────────────────────────────────────────────────────────
  def lose_gold(amount, type = @currency)
    gain_gold(-amount, type)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  New Argument For Old Method : type
  #╚────────────────────────────────────────────────────────────────────────────
  def gold(type = @currency)
    return @gold[type]
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets @gold Hash instead of single value
  #╚────────────────────────────────────────────────────────────────────────────
  def gold_hash
    return @gold
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Sets @currency By Type; Return Default If Type Is Not Existent
  #╚────────────────────────────────────────────────────────────────────────────
  def currency=(type)
    @currency = type 
    set_currency
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets @currency
  #╚────────────────────────────────────────────────────────────────────────────
  def currency
    return @currency
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Ask If Player Has Enough Money
  #╚────────────────────────────────────────────────────────────────────────────  
  def exchangeable?(type, amount)
    @gold[type] >= amount
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Currency Name
  #╚──────────────────────────────────────────────────────────────────────────── 
  def currency_name(currency)
    TINY::TMC::CURRENCIES[currency][0]
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Currency Shortcut
  #╚──────────────────────────────────────────────────────────────────────────── 
  def currency_shortcut(currency)
    TINY::TMC::CURRENCIES[currency][1]
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Currency Value
  #╚──────────────────────────────────────────────────────────────────────────── 
  def currency_value(currency)
    TINY::TMC::CURRENCIES[currency][2]
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Exchange Result
  #╚──────────────────────────────────────────────────────────────────────────── 
  def exchange_result(player, other, amount, penalty = 100)
    return currency_value(player) * amount if player == other
    result = ((currency_value(player) * amount) / currency_value(other) * (penalty/100.0)).to_i
    result
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Exchanging A Currency To Another
  #╚────────────────────────────────────────────────────────────────────────────
  def exchange(player, other, amount, penalty = 100)
    return unless exchangeable?(player, amount)
    set_currency(player)
    set_currency(other)
    @gold[player] -= amount
    @gold[other] += exchange_result(player, other, amount, penalty)
  end
    
end # Game_Party


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class RPG::Enemy
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class RPG::Enemy
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Multiply Bounty By Current Currency
  #╚────────────────────────────────────────────────────────────────────────────  
  def gold
    (@gold / $game_party.currency_value($game_party.currency)).to_i
  end
  
end # RPG::Enemy


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class RPG::Item
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class RPG::Item
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Multiply Price By Current Currency
  #╚────────────────────────────────────────────────────────────────────────────   
  def price
    (@price / $game_party.currency_value($game_party.currency)).to_i
  end
  
end # RPG::Item


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class RPG::EquipItem 
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class RPG::EquipItem 
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Multiply Price By Current Currency
  #╚────────────────────────────────────────────────────────────────────────────   
  def price
    (@price / $game_party.currency_value($game_party.currency)).to_i
  end
  
end # RPG::EquipItem


#╔═───────────────────────────────────────────────────────────────────────────═╗
#╠══════════════════════════════▲ END OF SCRIPT ▲══════════════════════════════╣
#╚═───────────────────────────────────────────────────────────────────────────═╝

 
 

Update :

 

■ 1.2


-BUGFIX: Gamebreaker during exchanging currencies

 

■ 1.1

  - Penalty support for exchange operations

  - New command to check deactive currency stock.


 


 ■ 1.01

  - Better float support


 

Known Issues :

 



 

Planned Features : Let me Know

 



 

ADDONs

 

TMC Exchanger 1.2


 


█ Content

   

- Expand the TMC Mainscript, to use a exchange office scene.


 

Code:
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ TMC Exchanger
#║ By TinyMine // english version
#║
#║  First Published/Erstveröffentlicht 12.04.2014
#║
#║  Visit : [URL="http://rpgmaker-vx-ace.de/"]http://rpgmaker-vx-ace.de/[/URL] for further Information
#║
#║  Suggestions? Support? Bugs? Contact me in [URL="http://rpgmaker-vx-ace.de/"]http://rpgmaker-vx-ace.de/[/URL]
#║
#║  Credits required : TinyMine
#║  Commercial Use?  : Contact me in [URL="http://rpgmaker-vx-ace.de/"]http://rpgmaker-vx-ace.de/[/URL]
#║  Editable?        : Only by original editor TinyMine
#║  
#║  
#║ Version : 1.2 // 04.09.2014
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Content
#║   
#║    - Expand the TMC Mainscript, to use a exchange office scene.
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Updates
#║   
#║    ■ 1.2
#║    - Currencies, the player do not know - will not occur in Exchange scene;
#║      even the exchanger could trade with it by command
#║   
#║    ■ 1.1
#║    - A Penalty can be given to a exchange office
#║    - The exchange rate will be shown up before exchange confirmation
#║   
#║    ■ 1.01
#║    - Versionssupport extended
#║   
#║    ■ 1.0
#║    - Release
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Usage In Game
#║ 
#║    following Scriptcommands used:
#║ 
#║    ■ Opening up the exchange office scene:
#║ 
#║        open_exchange(IDs, Penalty)
#║ 
#║      The exchange office only exchanges currencies, that are given by command.
#║      The Penalty is optional and 100% by default.
#║      f.e.: open_exchange(:gold, :silver, 50)
#║      Would call a exchange office that trades gold and silver for a penalty
#║      of 50%. What a robbery...
#║ 
#╚═───────────────────────────────────────────────────────────────────────────═#
if $imported[:TINY_TMC] >= 1.2
   $imported[:TINY_TMC_Exch] = 1.2
module TINY
  module TMC
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Editable Region **              Settings               ** Editable Region █
#╚═───────────────────────────────────────────────────────────────────────────═#     
     
   # Edit Vocabulary for the scene.
   
    # ■ Player List
    VOCAB_PLAYER   = "Which currency you would like to exchange?"   
    
    # ■ Anzahl Fenster
    VOCAB_AMOUNT   = "Amount?"  
    VOCAB_NUMBER   = "How much you would like to exchange?"  
    
    # ■ Händler Liste
    VOCAB_EXCHANGE = "To which currency you want to exchange?"
    
    # ■ Abschluss Fenster
    VOCAB_QUESTION = "Exchange?"
    VOCAB_TO       = "to"
    VOCAB_TRADE    = "exchanging?"
    
    # ■ Kurs Fenster
    VOCAB_RATE     = "Rate"
    
#╔═───────────────────────────────────────────────────────────────────────────═#         
#║ █ **                         END OF SETTINGS                             ** █
#║ █ **               DO NOT TOUCH THE FOLLOWING CONTENTS                   ** █
#╚═───────────────────────────────────────────────────────────────────────────═#
  end # TMC 
end # TINY


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Module SceneManager
#╚═=═=════════════════════════════════════════════════════════════════════════=═
module SceneManager
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Call A Scene With Arguments
  #╚────────────────────────────────────────────────────────────────────────────
  def self.call_args(scene_class, *args)
    @stack.push(@scene)
    @scene = scene_class.new(*args)
  end
  
end # SceneManager


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class Game_Interpreter
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Game_Interpreter
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Open Scene_Exchange
  #╚────────────────────────────────────────────────────────────────────────────  
  def open_exchange(*currencies)
    SceneManager.call_args(Scene_Exchange, *currencies)
  end
  
end # Game_Interpreter


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  NEW Class Window_More_Gold_Selectable
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Window_More_Gold_Selectable < Window_Selectable
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Initializing Window
  #╚────────────────────────────────────────────────────────────────────────────
  def initialize(currencies, version = :player)
    @currencies = currencies
    @version = version
    super(0, 0, window_width, fitting_height(currencies.size))
    refresh
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Get Width
  #╚────────────────────────────────────────────────────────────────────────────
  def window_width
    return 160
  end  
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Get Selectable Items
  #╚────────────────────────────────────────────────────────────────────────────  
  def item_max
    return @currencies.size
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Get Key Of Contents By Index
  #╚────────────────────────────────────────────────────────────────────────────  
  def content_index
    return @currencies[@index]
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refresh Contents
  #╚────────────────────────────────────────────────────────────────────────────
  def refresh
    contents.clear
    i = 0
    @currencies.each { |cur|
      next if TINY::TMC::CURRENCIES[cur].nil?
      info = TINY::TMC::CURRENCIES[cur]
      part = @version == :player ? $game_party.gold(cur) : info[0]
      draw_currency_value(part, " #{info[1]}", 4, 24 * i, contents.width - 8)
      i += 1
    }
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Open Window
  #╚────────────────────────────────────────────────────────────────────────────
  def open
    refresh
    super
  end
  
end # Window_More_Gold_Selectable


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  NEW Class Window_Gold_Number
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Window_Gold_Number < Window_Selectable
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Initializes Window
  #╚────────────────────────────────────────────────────────────────────────────
  def initialize(x, y)
    super(x, y, window_width, fitting_height(2))
    @number = 0
    @index = 1
  end 
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Width
  #╚────────────────────────────────────────────────────────────────────────────  
  def window_width
    return 224
  end  
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Selectable Items
  #╚────────────────────────────────────────────────────────────────────────────  
  def item_max
    return 1
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Sets Used Items
  #╚────────────────────────────────────────────────────────────────────────────  
  def set_item(cur)
    @item = cur
    @number = 0
    refresh
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Chosen Amount
  #╚────────────────────────────────────────────────────────────────────────────  
  def number
    return @number
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Modulator
  #╚────────────────────────────────────────────────────────────────────────────  
  def max_exchange
    $game_party.gold(@item) + 1
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Handle Movement
  #╚────────────────────────────────────────────────────────────────────────────  
  def process_cursor_move
    return unless active
    if Input.repeat?(:UP) || Input.repeat?(:DOWN) || Input.repeat?(:RIGHT) || Input.repeat?(:LEFT)
      return if @item_max == 0
      @number = (@number + 1)   % max_exchange if Input.repeat?(:UP)
      @number = (@number - 1)   % max_exchange if Input.repeat?(:DOWN)
      @number = (@number + 10)  % max_exchange if Input.repeat?(:RIGHT)
      @number = (@number - 10)  % max_exchange if Input.repeat?(:LEFT)
      refresh
    end
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refresh Content
  #╚────────────────────────────────────────────────────────────────────────────  
  def refresh
    contents.clear
    draw_text(0, 0, contents_width, contents_height/2, TINY::TMC::VOCAB_AMOUNT, 1)
    draw_text(0, contents_height/2, contents_width, contents_height/2, "#{@number}", 1)
  end
  
end # Window_Gold_Number


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  NEW Class Window_Conclude
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Window_Conclude < Window_Selectable
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Initializes Window
  #╚────────────────────────────────────────────────────────────────────────────  
  def initialize(x, y, w)
    super(x, y, w, fitting_height(5))
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Sets Used Items
  #╚────────────────────────────────────────────────────────────────────────────   
  def set_item(from, to, amount, penalty)
    @from = from
    @to = to
    @amount = amount
    @penalty = penalty
    refresh
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refreshes Conclude Window
  #╚────────────────────────────────────────────────────────────────────────────   
  def refresh
    contents.clear
    text = TINY::TMC::VOCAB_QUESTION
    draw_text(0, 0, contents.width, 24, text, 1)
    calc = "#{@amount} #{$game_party.currency_name(@from)}"
    contents.font.color = system_color
    draw_text(0, 24, contents.width, 24, calc, 1)
    contents.font.color = normal_color
    calc = TINY::TMC::VOCAB_TO
    draw_text(0, 48, contents.width, 24, calc, 1)
    calc = "#{exchange_result} #{$game_party.currency_name(@to)}"
    contents.font.color = system_color
    draw_text(0, 72, contents.width, 24, calc, 1)
    contents.font.color = normal_color
    calc = TINY::TMC::VOCAB_TRADE
    draw_text(0, 96, contents.width, 24, calc, 1)
  end 
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Get Exchange Result
  #╚────────────────────────────────────────────────────────────────────────────  
  def exchange_result
    $game_party.exchange_result(@from, @to, @amount, @penalty)
  end
  
end # Window_Conclude


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  NEW Class Scene_Exchange
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Scene_Exchange < Scene_MenuBase
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Initializes Scene
  #╚────────────────────────────────────────────────────────────────────────────  
  def initialize(*args)
    @currencies = *args
    @penalty = 100 
    set_vendor_properties
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Sets the config as traded currencies or penalty of the vendor
  #╚──────────────────────────────────────────────────────────────────────────── 
  def set_vendor_properties
    @currencies.sort.each { |e|
      set_penalty(amount) if e.is_a?(Integer)
      @currencies.delete(e) if e.is_a?(Symbol) && !$game_party.gold_hash.keys.include?(e)
    }
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Stes penalty if given in *args to scene
  #╚────────────────────────────────────────────────────────────────────────────
  def set_penalty(amount)
    @penalty = e 
    @currencies.delete(e)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Starts Scene
  #╚────────────────────────────────────────────────────────────────────────────  
  def start
    super
    create_windows
    create_handler
    select_window
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Create All Windows
  #╚────────────────────────────────────────────────────────────────────────────  
  def create_windows
    @player_window = Window_More_Gold_Selectable.new($game_party.gold_hash.keys)
    @player_window.x = 0
    @player_window.y = 0
    #--
    @exchanger_window = Window_More_Gold_Selectable.new(@currencies, :other)
    @exchanger_window.x = Graphics.width - @exchanger_window.width
    @exchanger_window.y = 0
    #--
    @number_window = Window_Gold_Number.new(160, 0)
    @number_window.hide
    @number_window.close
    #--
    @text_window = Window_Base.new(0, Graphics.height-72, Graphics.width, 72)
    refresh_text_window(TINY::TMC::VOCAB_PLAYER)
    #--
    @rate_window = Window_Base.new(160, 72, 224, 48)
    @rate_window.hide
    @rate_window.close
    #--
    @conclude_window = Window_Conclude.new(160, 120, 224)
    @conclude_window.hide
    @conclude_window.close
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Set All Window Handler
  #╚────────────────────────────────────────────────────────────────────────────   
  def create_handler
    @player_window.set_handler(:ok,       method(:activate_number))
    @exchanger_window.set_handler(:ok,    method(:activate_conclude))
    @number_window.set_handler(:ok,       method(:activate_exchange))
    @conclude_window.set_handler(:ok,     method(:exchange))
    @player_window.set_handler(:cancel,   method(:return_scene))
    @exchanger_window.set_handler(:cancel,method(:activate_number))
    @number_window.set_handler(:cancel,   method(:activate_player))
    @conclude_window.set_handler(:cancel, method(:activate_exchange))
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refreshes Text Window
  #╚────────────────────────────────────────────────────────────────────────────   
  def refresh_text_window(text)
    @text_window.contents.clear
    @text_window.draw_text_ex(0, 0, text)
  end  
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refreshes Rate Window
  #╚────────────────────────────────────────────────────────────────────────────   
  def refresh_rate_window
    @rate_window.contents.clear
    from = @player_window.content_index
    to = @exchanger_window.content_index
    @rate_window.draw_text_ex(0, 0, get_rate_text(from, to))
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Exchange Rate In A String
  #╚────────────────────────────────────────────────────────────────────────────   
  def get_rate_text(from, to)
    from == to ? pen = 1 : pen = penalty
    "#{TINY::TMC::VOCAB_RATE}:\\C[16] #{(exchange_value(to) * 100).to_i} #{$game_party.currency_shortcut(from)} \\C[0]-\\C[16] #{(exchange_value(from) * pen * 100).to_i} #{$game_party.currency_shortcut(to)}"
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Penalty For Calculation
  #╚────────────────────────────────────────────────────────────────────────────    
  def penalty
    @penalty/100.0
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Currency Value
  #╚────────────────────────────────────────────────────────────────────────────  
  def exchange_value(currency)
    $game_party.currency_value(currency)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Select At Start
  #╚────────────────────────────────────────────────────────────────────────────   
  def select_window
    @player_window.activate
    @player_window.select(0)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Activate Player List
  #╚────────────────────────────────────────────────────────────────────────────   
  def activate_player
    refresh_text_window(TINY::TMC::VOCAB_PLAYER)
    @number_window.close
    @exchanger_window.unselect
    @player_window.activate
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Activate Exchange List
  #╚────────────────────────────────────────────────────────────────────────────   
  def activate_exchange
    refresh_text_window(TINY::TMC::VOCAB_EXCHANGE)
    @conclude_window.close
    @rate_window.close
    @exchanger_window.activate
    @exchanger_window.select(0)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Activate Conclude Window
  #╚────────────────────────────────────────────────────────────────────────────  
  def activate_conclude
    @conclude_window.set_item(@player_window.content_index, @exchanger_window.content_index,
    @number_window.number, @penalty)
    refresh_rate_window
    @rate_window.show
    @rate_window.open
    @conclude_window.refresh
    @conclude_window.show
    @conclude_window.open
    @conclude_window.activate
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Activate Number Window
  #╚────────────────────────────────────────────────────────────────────────────  
  def activate_number
    refresh_text_window(TINY::TMC::VOCAB_NUMBER)
    @exchanger_window.unselect
    @number_window.set_item(@player_window.content_index)
    @number_window.show
    @number_window.open
    @number_window.activate
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Exchange Chosen Values
  #╚────────────────────────────────────────────────────────────────────────────  
  def exchange
    $game_party.exchange(@player_window.content_index, @exchanger_window.content_index, 
    @number_window.number, @penalty)
    @player_window.refresh
    @conclude_window.close
    @rate_window.close
    activate_player
  end
  
end # Scene_Exchange


else 
  msgbox_p("TMC Menu will not run without TMC Mainscript 1.2 or higher")
end
#╔═───────────────────────────────────────────────────────────────────────────═╗
#╠══════════════════════════════▲ END OF SCRIPT ▲══════════════════════════════╣
#╚═───────────────────────────────────────────────────────────────────────────═╝
Screens:

t3l9armd.png



 

TMC Menu


 


 █ Content

 


  - Expand the TMC Mainscript, that all currencies will be shown in the

    standard main menu gold window, as soon as they are known.



 

Code:
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ TMC Menu
#║ By TinyMine // english version
#║
#║  First Published/Erstveröffentlicht 12.04.2014
#║
#║  Visit : [URL="http://rpgmaker-vx-ace.de/"]http://rpgmaker-vx-ace.de/[/URL] for further Information
#║
#║  Suggestions? Support? Bugs? Contact me in [URL="http://rpgmaker-vx-ace.de/"]http://rpgmaker-vx-ace.de/[/URL]
#║
#║  Credits required : TinyMine
#║  Commercial Use?  : Contact me in [URL="http://rpgmaker-vx-ace.de/"]http://rpgmaker-vx-ace.de/[/URL]
#║  Editable?        : Only by original editor TinyMine
#║  
#║  
#║ Version : 1.01 // 12.04.2014
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Content
#║   
#║    - Expand the TMC Mainscript, that all currencies will be shown in the
#║      standard main menu gold window, as soon as they are known.
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Updates
#║   
#║    ■ 1.01
#║    - Versionsupport extended
#║   
#║    ■ 1.0
#║    - Release
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
if $imported[:TINY_TMC] >= 1.0
   $imported[:TINY_TMC_Menu] = 1.01
#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  NEW Class Window_More_Gold
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Window_More_Gold < Window_Base
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Initializing Window
  #╚────────────────────────────────────────────────────────────────────────────
  def initialize
    super(0, 0, window_width, fitting_height($game_party.gold_hash.keys.size))
    refresh
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Get Width
  #╚────────────────────────────────────────────────────────────────────────────
  def window_width
    return 160
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refresh Contents
  #╚────────────────────────────────────────────────────────────────────────────
  def refresh
    contents.clear
    i = 0
    $game_party.gold_hash.each { |key, val|
      info = TINY::TMC::CURRENCIES[key]
      draw_currency_value(val, info[1], 4, 24 * i, contents.width - 8)
      i += 1
    }
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Open Window
  #╚────────────────────────────────────────────────────────────────────────────
  def open
    refresh
    super
  end
  
end # Window_More_Gold


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class Scene_Menu
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Scene_Menu
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  New Gold Window
  #╚────────────────────────────────────────────────────────────────────────────
  def create_gold_window
    @gold_window = Window_More_Gold.new
    @gold_window.x = 0
    @gold_window.y = Graphics.height - @gold_window.height
  end
  
end # Scene_Menu


else 
  msgbox_p("TMC Menu will not run without TMC Mainscript 1.0 or higher")
end
#╔═───────────────────────────────────────────────────────────────────────────═╗
#╠══════════════════════════════▲ END OF SCRIPT ▲══════════════════════════════╣
#╚═───────────────────────────────────────────────────────────────────────────═╝
 

Screens:

bdreimxi.png



 

TMC Enhance


 


 █ Content

   

 - Expand the TMC Mainscript, for new enhancements like using icons and

   more in future version.   


 

Code:
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ TMC Enhance
#║ By TinyMine // english version
#║
#║  First Published/Erstveröffentlicht 12.04.2014
#║
#║  Visit : [URL="http://rpgmaker-vx-ace.de/"]http://rpgmaker-vx-ace.de/[/URL] for further Information
#║
#║  Suggestions? Support? Bugs? Contact me in [URL="http://rpgmaker-vx-ace.de/"]http://rpgmaker-vx-ace.de/[/URL]
#║
#║  Credits required : TinyMine
#║  Commercial Use?  : Contact me in [URL="http://rpgmaker-vx-ace.de/"]http://rpgmaker-vx-ace.de/[/URL]
#║  Editable?        : Only by original editor TinyMine
#║  
#║  
#║ Version : 1.01 // 13.04.2014
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Content
#║   
#║    - Expand the TMC Mainscript, for new enhancements like using icons and
#║      more in future version.   
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Updates
#║   
#║    ■ 1.01
#║    - Versionsupport extended
#║   
#║    ■ 1.0
#║    - Release
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Installation
#║   
#║    ■ Put this script below all other TMC Scripts/Addons
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#


if $imported[:TINY_TMC] >= 1.0
module TINY
  module TMC
    CUR_GRAPHICS = {
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Editable Region **              Settings               ** Editable Region █
#╚═───────────────────────────────────────────────────────────────────────────═#      
     
    # Sample for icon creation:
    # ID     =>    Icon Index
    
    :gold    =>    361,
    :silver  =>    359,
    :rocks   =>    350
     
     
#═────────────────────────────────────────────────────────────────────────────═#     
    } # Do not touch
#═────────────────────────────────────────────────────────────────────────────═#     
    
    # █ Icon Settings
    
    # Define default Icon for currencies without a specified icon
    DEFAULT_ICON = 262
    
    
    # In which Addons icons should be used?
    
      # ■ Menu Addon?
      ICON_MENU = true
    
      # ■ Exchanger Addon?
      ICON_EXCH = true
    
    
#╔═───────────────────────────────────────────────────────────────────────────═#         
#║ █ **                         END OF SETTINGS                             ** █
#║ █ **               DO NOT TOUCH THE FOLLOWING CONTENTS                   ** █
#╚═───────────────────────────────────────────────────────────────────────────═#
  end # TMC 
#═=═=═════════════════════════════════════════════════════════════════════════=#
end # TINY


if TINY::TMC::ICON_MENU && !$imported[:TINY_TMC_Menu].nil?
#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class Window_More_Gold
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Window_More_Gold
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refresh Contents
  #╚────────────────────────────────────────────────────────────────────────────
  def refresh
    contents.clear
    i = 0
    $game_party.gold_hash.each { |key, val|
      info = TINY::TMC::CURRENCIES[key]
      icon = TINY::TMC::CUR_GRAPHICS[key].nil? ? TINY::TMC::DEFAULT_ICON : TINY::TMC::CUR_GRAPHICS[key]
      draw_icon(icon, contents.width - 24, 24 * i)
      draw_currency_value(val, info[1], 4 - 24, 24 * i, contents.width - 8)
      i += 1
    }
  end


end # Window_More_Gold
end # if ICON_MENU
if TINY::TMC::ICON_EXCH && !$imported[:TINY_TMC_Exch].nil?
#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class Window_More_Gold_Selectable
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Window_More_Gold_Selectable
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refresh Contents
  #╚────────────────────────────────────────────────────────────────────────────
  def refresh
    contents.clear
    i = 0
    @currencies.each { |cur|
      next if TINY::TMC::CURRENCIES[cur].nil?
      info = TINY::TMC::CURRENCIES[cur]
      icon = TINY::TMC::CUR_GRAPHICS[cur].nil? ? TINY::TMC::DEFAULT_ICON : TINY::TMC::CUR_GRAPHICS[cur]
      part = @version == :player ? $game_party.gold(cur) : info[0]
      draw_icon(icon, contents.width - 24, 24 * i)
      draw_currency_value(part, " #{info[1]}", 4 , 24 * i, contents.width - 8 - 24)
      i += 1
    }
  end
  
end # Window_More_Gold_Selectable
end # if ICON_EXCH


else 
  msgbox_p("TMC Menu will not run without TMC Mainscript 1.0 or higher")
end # if version


#╔═───────────────────────────────────────────────────────────────────────────═╗
#╠══════════════════════════════▲ END OF SCRIPT ▲══════════════════════════════╣
#╚═───────────────────────────────────────────────────────────────────────────═╝
 

Screens:

df4z9vob.png
ma7uex95.png



 

DEMO

tmc demo 1.2.zip
 

Attachments

  • tmc demo 1.2.zip
    323 bytes · Views: 102
Last edited by a moderator:

Sazra

Warper
Member
Joined
Jun 20, 2014
Messages
2
Reaction score
0
First Language
German
Primarily Uses
Is it possible to use the Change_gold command with a variable?
 

TinyMine

Regular
Regular
Joined
Oct 26, 2013
Messages
53
Reaction score
54
First Language
German
Primarily Uses
You mean by the usual variables you have in events?
Could you please specify, what you try to do? :)

change_gold(amount, id)changes the Amount that a player has of the currency.

You could do someting like:

change_gold($game_variables[NUMBER], id)or when the id is not important - naturally it takes the active one by #change_currency

change_gold($game_variables[NUMBER])So if the amount is saved in lets say game variable 12 you would do:

Code:
change_gold($game_variables[12))
 

Sazra

Warper
Member
Joined
Jun 20, 2014
Messages
2
Reaction score
0
First Language
German
Primarily Uses
Thank you you are a life saver.
 

TinyMine

Regular
Regular
Joined
Oct 26, 2013
Messages
53
Reaction score
54
First Language
German
Primarily Uses
No worries- you're welcome! :)

Don't be shy if there are more questions! 

Regards
 

magnaangemon01

Miles Montgomery
Regular
Joined
Jun 7, 2014
Messages
482
Reaction score
298
First Language
English
Primarily Uses
RMVXA
What are your terms of use for this script? Is it free for commercial or non-commercial?
 

TinyMine

Regular
Regular
Joined
Oct 26, 2013
Messages
53
Reaction score
54
First Language
German
Primarily Uses
Free for both - but when used commerical I would like to have a copy of it when game is finished or avaiable to play :)
 

magnaangemon01

Miles Montgomery
Regular
Joined
Jun 7, 2014
Messages
482
Reaction score
298
First Language
English
Primarily Uses
RMVXA
Is it possible to use gold for the first half of the game, and then for the second half, use gold and souls both as currency?
 

TinyMine

Regular
Regular
Joined
Oct 26, 2013
Messages
53
Reaction score
54
First Language
German
Primarily Uses
Currencies are known as soon as they are used in the game by one of the following commands:

change_currency(...) , change_gold(...) , exchange_gold(...)you can define with:

START_CURRENCY = :silverwhich currency shall be known from the very beginning.

I hope the demo helps understanding this concept :)

The scenario of having more currencies used for trading is also handled there.

I could also make an addon for changing currencies in the default trade scene directly if needed.
 

magnaangemon01

Miles Montgomery
Regular
Joined
Jun 7, 2014
Messages
482
Reaction score
298
First Language
English
Primarily Uses
RMVXA
I don't know a single thing about scripting.

My plans for a game is where this girl with no memory appears and she has a weapon and armor that uses cores to give her abilities and stats. Later on, it turns out that she is Death and needs 50,000 souls plus four seals to reclaim her "job". She also can use souls to buy more cores or materials to craft cores.

Her party members will be regular mortals with regular gear and use a stat system to level up. Kind of like AP, but they get one point every level, 2 every 5 levels, to spend on a stat and max level is 50.
 

TinyMine

Regular
Regular
Joined
Oct 26, 2013
Messages
53
Reaction score
54
First Language
German
Primarily Uses
Yes you could use this script for this soul idea - you could also use this script for having a ... soul vendor guy, that takes only souls.

I guess the demo can help you out to learn about using the script for your needs :)

If it is too difficult let me know - we can talk via PN then i guess :)
 

magnaangemon01

Miles Montgomery
Regular
Joined
Jun 7, 2014
Messages
482
Reaction score
298
First Language
English
Primarily Uses
RMVXA
I have to wait for someone to design the weapon/armor script for me before I can even begin. bgillisp is working on the AP system for me.
 

magnaangemon01

Miles Montgomery
Regular
Joined
Jun 7, 2014
Messages
482
Reaction score
298
First Language
English
Primarily Uses
RMVXA
When I went to exchange gold into medicine, I got this. And it shut down.
 

TinyMine

Regular
Regular
Joined
Oct 26, 2013
Messages
53
Reaction score
54
First Language
German
Primarily Uses
Yep, you have found a bug there! Sorry for that - I will upload new version tomorrow :) Thanks for reporting!

NEW Vesion uploaded - Demo also updated. No more bugs! :) Thanks again!
 
Last edited by a moderator:

Tw0Face

Master Strategist
Regular
Joined
Nov 12, 2018
Messages
679
Reaction score
511
First Language
German
Primarily Uses
RMVXA
Hi. Is there a way to have a specific Item (e.g. Item with ID 1) in the Database as a currency as well? I want to be able to buy Items and pay with Items. :)

Greetings Tw0Face
 

Tw0Face

Master Strategist
Regular
Joined
Nov 12, 2018
Messages
679
Reaction score
511
First Language
German
Primarily Uses
RMVXA
I've seen your trade system, but it's a bit different than I thought. I want the player to buy items and pay for them with items. It should look like the shop window. I thought it could be possible to use items instead of variables in the script. Wouldn't it work if I'd change def self.currency_unit(currency = $game_party.currency) to def self.currency_unit(currency = $game_party.item_number($data_items[1]).group) or something like that? Then, maybe, I could edit the script myself.

PS: Jep, ich bin's. ^^
 

Alexander16

Villager
Member
Joined
Nov 17, 2023
Messages
6
Reaction score
1
First Language
English
Primarily Uses
RMMV
Help, I can't open the file
 

Roninator2

Gamer
Regular
Joined
May 22, 2016
Messages
5,242
Reaction score
1,570
First Language
English
Primarily Uses
RMVXA
Help, I can't open the file
Well a few things here.
1. the file is lost due to a forum update.
2. the scripts seem to be intact, so just copy those.
3. are you sure you want this? Your profile says MV but this is for VX Ace.
 

Alexander16

Villager
Member
Joined
Nov 17, 2023
Messages
6
Reaction score
1
First Language
English
Primarily Uses
RMMV
Well a few things here.
1. the file is lost due to a forum update.
2. the scripts seem to be intact, so just copy those.
3. are you sure you want this? Your profile says MV but this is for VX Ace.
Is this for VX Ace? I thought it for MV, okay my bad and thanks for your reply.
 

Latest Threads

Latest Posts

Latest Profile Posts

if we get a trailer for shadow of the erdtree words won't describe how happy i'll be. keeping my hype down but, fingers crossed
Off to LEGOLAND today! Yes, my wife and I are in our 50s and going to LEGOLAND without any small children. Stop judging us! Apparently, there are places you can't go without being accompanied by a child in LEGOLAND. Which is kind of the opposite of what is usual. But our kids are all grown and we have never been. LEGO KRAMPUS here I come!
I decided that for the video game i will work next year i will use characters from my TCG as main characters for the RPGMAKER game, so expand the universe, that will be a cool :CoOoOL: Here some of my characters :

Ah also yes I'm accepting commission in case tat you ask for haha.
Some people shouldn't be parents. Someone put their toddler in the hallway of the apartment building I live in at 11 p.m.... and let her wander. The heck is wrong with people?!
Twitch! Strean is currently live with some more gamedev! Feel free to drop by~

Forum statistics

Threads
136,758
Messages
1,269,610
Members
180,505
Latest member
rpplayer158
Top