设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
搜索附件  
同能RPG制作大师 › 附件中心 › 同能RM技术讨论区 › RPG Maker VA 讨论区 › Tinys More Currencies (TMC): tmc demo 1.2.zip

Tinys More Currencies (TMC): tmc demo 1.2.zip

 

Tinys More Currencies (TMC):
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

Spoiler#╔═───────────────────────────────────────────────────────────────────────────═#
#║ 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.


 

Spoiler                Code:       




Screens:

Spoiler








 

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.



 

Spoiler                Code:       




 

Screens:

Spoiler








 

TMC Enhance


 


 █ Content

   

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

   more in future version.   


 

Spoiler                Code:       




 

Screens:

Spoiler










 

DEMO

tmc demo 1.2.zip


本贴来自国际rpgmaker官方论坛作者:TinyMine处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/tinys-more-currencies-tmc.26491/
简体中文
繁體中文
English(英语)
日本語(日语)
Deutsch(德语)
Русский язык(俄语)
بالعربية(阿拉伯语)
Türkçe(土耳其语)
Português(葡萄牙语)
ภาษาไทย(泰国语)
한어(朝鲜语/韩语)
Français(法语)
关闭

幸运抽奖

社区每日抽奖来袭,快来试试你是欧皇还是非酋~

立即查看

Loading...

QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

GMT+8, 2026-10-5 03:23 , Processed in 0.101141 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

返回顶部