Per 2016, RMID pindah ke RMID Discord (Invite link dihapus untuk mencegah spambot -Theo @ 2019). Posting sudah tidak bisa dilakukan lagi.
Mohon maaf atas ketidaknyamanannya dan mohon kerjasamanya.
|
|
| [VX]Multiple Money Script | |
| 2010-02-12, 15:37 | [VX]Multiple Money Script |
---|
hart Senior
Posts : 805 Thanked : 38 Engine : Other Skill : Very Beginner Type : Developer
| First topic message reminder :<Hart Multi Money System> Versi: -1 Tipe: Miscellanous
Sebenarnya, aku membuat ini berdasarkan request di trid https://rmid.forumotion.net/rgss2-request-f30/reqmultiple-money-system-t1115.htm, tapi karena script ini sangat panjang dan penggunaannya agak rumit, jadi saya buat terpisah saja (bila dianggap melanggar aturan, silahkan buang aja trid ini ) Petunjuk penggunaan script ada di scriptnya. Maaf bila banyak bug atau terlalu jelek atau gak guna, maklum saya idiot dan masih pemula Fitur
- Bisa banyak mata uang.
- Membuat item tertentu hanya bisa dibeli dengan mata uang tertentu.
- Super simple money changer.
ScreenshotsSepertinya tidak butuh screenshot, karena ini script simpel, walaupun panjang(maklum, yang buat idiot) DemoSepertinya tidak butuh demo, alasan sama seperti di atas. Scripts- Spoiler:
- Code:
-
module Hart module Multiple_Money #-------------------------------------------------------------------------- # * Cara Penggunaan: # Pertama-tama, konfigurasi dulu(lihat di bawah). # Agar suatu item harus dibeli dengan mata uang tertentu, # isilah note pada item itu dengan: <tipe matauang>, misalnya: <tipe gold> # Untuk membuat suatu item dapat dibeli dengan berbagai mata uang, # Saya tidak bisa :rofl: # Tapi, ada cara untuk mengakalinya, yaitu # Buat aja 2 atau lebih item yang sama persis, hanya saja note nya berbeda. # Misalnya buat 2 item potion, potion pertama notenya <tipe gold>, dan 1 # lagi <tipe silver>. # # Untuk mengakses money changer, buatlah suatu event, masukkan script ini: # $scene = Scene_DuitChanger.new #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- # * Konfigurasi :muach: # DefaultKurs : Mata uang default # Symbol : isikan dengan nama2 mata uang yang anda inginkan, dan lambangnya. # bila ingin menambah lagi mata uang, tambahkan aja sesuai dengan # contoh di bawah ini # ratio : Perbandingan nilai mata2 uang # SellRate : Seberapa banyak kerugian pada saat menukar uang. # 1 = Tidak ada kerugian sama sekali. #-------------------------------------------------------------------------- DefaultKurs = "gold" Symbol = {"gold" => 'G', "silver" => 'S', "bronze" => 'X'} Ratio = { "gold" => 4, "silver" => 2, "bronze" => 2} SellRate = 2 #-------------------------------------------------------------------------- # * Jangan mengubah apa2 di bawah ini! #-------------------------------------------------------------------------- end end
module RPG class BaseItem alias multi_money_initialize initialize def initialize multi_money_initialize @tipe = Hart::Multiple_Money::DefaultKurs end
def create_tipe_cache temp = self.note[/<tipe\s+[a-z]+>/] if temp != nil temp2 = temp[/\s+[a-z]+/] @tipe = temp2[/[a-z]+/] else @tipe = Hart::Multiple_Money::DefaultKurs end end
attr_accessor :tipe end end
class Scene_Title < Scene_Base alias tipe_load_database load_database def load_database tipe_load_database for item in $data_items next if item == nil item.create_tipe_cache end for weapon in $data_weapons next if weapon == nil weapon.create_tipe_cache end for armor in $data_armors next if armor == nil armor.create_tipe_cache end end end
class Game_Party < Game_Unit attr_reader :duit alias multi_money_initialize initialize def initialize multi_money_initialize @duit = {} for i, j in Hart::Multiple_Money::Ratio @duit[i] = 0 end end def gain_gold(n, x = Hart::Multiple_Money::DefaultKurs) @duit[x] = [[@duit[x] + n, 0].max, 9999999].min end def lose_gold(n, x = Hart::Multiple_Money::DefaultKurs) gain_gold(-n, x) end end
class Window_Base def draw_currency_value(value, x, y, width, kurs = Hart::Multiple_Money::DefaultKurs) cx = contents.text_size(Hart::Multiple_Money::Symbol[kurs]).width self.contents.font.color = normal_color self.contents.draw_text(x, y, width-cx-2, WLH, value, 2) self.contents.font.color = system_color self.contents.draw_text(x, y, width, WLH, Hart::Multiple_Money::Symbol[kurs], 2) end def draw_duit_name(item, x, y, enabled = true) if item != nil self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x + 24, y, 172, WLH, item) end end end
class Window_Gold < Window_Base def initialize(x, y) super(x, (y - (WLH * ($game_party.duit.size - 1))), 160, ((WLH * $game_party.duit.size) + 32)) refresh end def refresh self.contents.clear p = 0 for i, j in $game_party.duit draw_currency_value(j, 4, p, 120, i) p += WLH end end end
class Window_Help < Window_Base def initialize(width = 544) super(0, 0, width, WLH + 32) end end
class Window_ShopBuy < Window_Selectable def draw_item(index) item = @data[index] number = $game_party.item_number(item) enabled = (item.price <= $game_party.duit[item.tipe] and number < 99) rect = item_rect(index) self.contents.clear_rect(rect) draw_item_name(item, rect.x, rect.y, enabled) rect.width -= 4 cx = contents.text_size(Hart::Multiple_Money::Symbol[item.tipe]).width self.contents.draw_text(rect.x, rect.y, rect.width-cx-2, rect.height, item.price, 2) self.contents.font.color = system_color self.contents.draw_text(rect.x, rect.y, rect.width, rect.height, Hart::Multiple_Money::Symbol[item.tipe], 2) end end
class Window_ShopNumber < Window_Base def refresh y = 96 self.contents.clear draw_item_name(@item, 0, y) self.contents.font.color = normal_color self.contents.draw_text(212, y, 20, WLH, "×") self.contents.draw_text(248, y, 20, WLH, @number, 2) self.cursor_rect.set(244, y, 28, WLH) draw_currency_value(@price * @number, 4, y + WLH * 2, 264, @item.tipe) end end
class Window_ShopStatus < Window_Base def initialize(x, y) super(x, y, 240, 304-(y-112)) @item = nil refresh end end
class Scene_Shop < Scene_Base def start super create_menu_background create_command_window @help_window = Window_Help.new(384) @gold_window = Window_Gold.new(384, ($game_party.duit.size-1)*24) @dummy_window = Window_Base.new(0, 112, 544, 304) @buy_window = Window_ShopBuy.new(0, 112) @buy_window.active = false @buy_window.visible = false @buy_window.help_window = @help_window @sell_window = Window_ShopSell.new(0, 112, 544, 304) @sell_window.active = false @sell_window.visible = false @sell_window.help_window = @help_window @number_window = Window_ShopNumber.new(0, 112) @number_window.active = false @number_window.visible = false @status_window = Window_ShopStatus.new(304, @gold_window.height) @status_window.visible = false end def update_buy_selection @status_window.item = @buy_window.item if Input.trigger?(Input::B) Sound.play_cancel @command_window.active = true @dummy_window.visible = true @buy_window.active = false @buy_window.visible = false @status_window.visible = false @status_window.item = nil @help_window.set_text("") return end if Input.trigger?(Input::C) @item = @buy_window.item number = $game_party.item_number(@item) if @item == nil or @item.price > $game_party.duit[@item.tipe] or number == 99 Sound.play_buzzer else Sound.play_decision max = @item.price == 0 ? 99 : $game_party.duit[@item.tipe] / @item.price max = [max, 99 - number].min @buy_window.active = false @buy_window.visible = false @number_window.set(@item, max, @item.price) @number_window.active = true @number_window.visible = true end end end def decide_number_input Sound.play_shop @number_window.active = false @number_window.visible = false case @command_window.index when 0 # Buy $game_party.lose_gold(@number_window.number * @item.price, @item.tipe) $game_party.gain_item(@item, @number_window.number) @gold_window.refresh @buy_window.refresh @status_window.refresh @buy_window.active = true @buy_window.visible = true when 1 # sell $game_party.gain_gold(@number_window.number * (@item.price / 2), @item.tipe) $game_party.lose_item(@item, @number_window.number) @gold_window.refresh @sell_window.refresh @status_window.refresh @sell_window.active = true @sell_window.visible = true @status_window.visible = false end end end
class Window_DuitChanger < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization # x : window x-coordinate # y : window y-coordinate # width : window width # height : window height #-------------------------------------------------------------------------- def initialize(x, y, width, height) super(x, y, width, height) @column_max = 1 self.index = 0 refresh end #-------------------------------------------------------------------------- # * Get Item #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # * Whether or not to include in item list # item : item #-------------------------------------------------------------------------- def include?(item) return false if $game_party.duit[item] == nil return true end def enable?(item) return $game_party.duit[item] != 0 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh @data = [] for i, j in $game_party.duit next unless include?(i) @data.push(i) end @data.push(nil) if include?(nil) @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # * Draw Item # index : item number #-------------------------------------------------------------------------- def draw_item(index, show = true) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil enabled = show number = $game_party.duit[item] rect.width -= 4 draw_duit_name(item, rect.x, rect.y, enabled) self.contents.draw_text(rect, sprintf(":%2d", number), 2) end end #-------------------------------------------------------------------------- # * Update Help Text #-------------------------------------------------------------------------- def update_help @help_window.set_text(item == nil ? "" : $game_party.duit[item]) end end
class Scene_DuitChanger < Scene_Base def start super create_menu_background @duit_window = Window_DuitChanger.new(100, 100, 300, 100) @duit_window2 = Window_DuitChanger.new(100, 220, 300, 100) @duit_window2.active = false @duit_window2.visible = false @number_window = Window_NumberInput.new @number_window.active = false @number_window.visible = false end def terminate super dispose_menu_background @duit_window.dispose @duit_window2.dispose @number_window.dispose end def update super update_menu_background @duit_window.update @duit_window2.update @number_window.update if @duit_window.active update_duit_selection elsif @duit_window2.active update_duit2_selection elsif @number_window.active update_number_selection end end def update_duit_selection if Input.trigger?(Input::B) Sound.play_decision $scene = Scene_Map.new elsif Input.trigger?(Input::C) @duit1 = @duit_window.item if @duit1 == nil or $game_party.duit[@duit1] == 0 Sound.play_buzzer else Sound.play_decision @duit_window.active = false @duit_window2.active = true @duit_window2.visible = true end end end def update_duit2_selection if Input.trigger?(Input::B) Sound.play_cancel @duit_window2.active = false @duit_window2.visible = false @duit_window.active = true elsif Input.trigger?(Input::C) @duit2 = @duit_window2.item if @duit2 == nil Sound.play_buzzer else Sound.play_decision @duit_window2.active = false @number_window.active = true @number_window.visible = true end end end def update_number_selection if Input.trigger?(Input::B) Sound.play_cancel @number_window.active = false @number_window.visible = false @duit_window2.active = true elsif Input.trigger?(Input::C) @number = @number_window.number if @number == 0 or @number > $game_party.duit[@duit1] Sound.play_buzzer else Sound.play_decision @valued = Hart::Multiple_Money::Ratio[@duit1] / Hart::Multiple_Money::Ratio[@duit2] * @number / Hart::Multiple_Money::SellRate $game_party.gain_gold(@valued, @duit2) $game_party.lose_gold(@number, @duit1) @duit_window.refresh @duit_window2.refresh @number_window.active = false @number_window.visible = false @duit_window2.visible = false @duit_window.active = true end end end end
class Scene_Battle < Scene_Base def display_exp_and_gold exp = $game_troop.exp_total gold = $game_troop.gold_total $game_party.gain_gold(gold) text = sprintf(Vocab::Victory, $game_party.name) $game_message.texts.push('\|' + text) if exp > 0 text = sprintf(Vocab::ObtainExp, exp) $game_message.texts.push('\.' + text) end if gold > 0 text = sprintf(Vocab::ObtainGold, gold, Hart::Multiple_Money::DefaultKurs) $game_message.texts.push('\.' + text) end wait_for_message end end
Credits
- Semua anggota RMID, terutama CrimsonSeas yang membuat note tag tutorial yang sangat berguna bagiku
- akuya, karena telah merequest script ini
Terakhir diubah oleh hart tanggal 2010-02-12, 16:07, total 1 kali diubah |
| | |
2011-08-04, 12:36 | Re: [VX]Multiple Money Script |
---|
rezpect Novice
Posts : 109
| yah klo ane bisa convert sendiri ngapaen juga ane ngepost. . |
| | | 2011-08-04, 15:15 | Re: [VX]Multiple Money Script |
---|
hart Senior
Posts : 805 Thanked : 38 Engine : Other Skill : Very Beginner Type : Developer
| yah, maaf saya tidak bisa, alasannya karena saya sendiri udah lupa gimana cara bikinnya, kalau mau coba lagi malas, terus saya juga ga punya RMXP, kalau mau install lagi malas, kalau ada RMXP pun, saya gak pernah scripting di situ, kalau mau membiasakan diri lagi malas. Maaf ya... |
| | | 2011-08-04, 16:37 | Re: [VX]Multiple Money Script |
---|
rezpect Novice
Posts : 109 Thanked : 0 Engine : RMXP Skill : Beginner Type : Event Designer
| oke dech. . .gk apa2 thx b4 |
| | | | Re: [VX]Multiple Money Script |
---|
Sponsored content
| | | | | [VX]Multiple Money Script | |
|
Similar topics | |
|
Similar topics | |
| |
Halaman 1 dari 1 | |
| Permissions in this forum: | Anda tidak dapat menjawab topik
| |
| |
Latest 10 Topics | [Web Novel] Gloria Infidelis 2016-11-17, 21:27 by LightNightKnight
[Announcement] Forum baru untuk RMID 2016-08-25, 16:39 by TheoAllen
Where I'm Wrong ? 2016-07-24, 16:10 by ReydVires
flakeheartnet's Resources part III 2016-07-08, 14:30 by flakeheartnet
Keira's Art Warehouse 2016-06-28, 19:27 by KeiraBlaze
Theo Core Time System + Bingung 2016-06-27, 16:24 by Lockin
Error Script, Maybe ? 2016-06-27, 16:20 by Lockin
Nusaimoe @ RMID Lounge 2016-06-21, 05:02 by Jihad Bagas
Call Random Battle 2016-06-15, 17:04 by Lockin
Flakeheartnet Resources Part II [come back gift] 2016-06-07, 15:51 by flakeheartnet
|
Statistics
|
Members: [ 4947 ]
Topics: [ 8258 ]
Posts: [ 112606 ]
Newest member: [ https://rmid.forumotion.net/u4968 ]
|
|
|
|
|
|