Reveloiz_Blizzard Newbie
Posts : 6 Thanked : 0 Engine : RMVX Skill : Beginner Type : Writer
| Subyek: [SOLVED] Discount Shop 2010-07-25, 11:02 | |
| Allow... boleh nanya ga? gimana cara-nya kontrol string item price di script-nya Ruby supaya harga-nya bisa kit arubah sewaktu - waktu pake event. kayak lagi ada diskon, harga yang beda- beda di tiap kota? kalo bwt item yang sama kan kebanyakan | |
|
Spooky Kitaro Novice
Posts : 164 Thanked : 0 Engine : Multi-Engine User Skill : Very Beginner Type : Developer
| Subyek: Re: [SOLVED] Discount Shop 2010-07-25, 22:16 | |
| [b]Dari Pada. Scripting coba tax system saja http://www.hbgames.org/forums/viewtopic.php?f=11&t=69976 | |
|
el_musketeer Advance
Posts : 540 Thanked : 1 Engine : RMVX Skill : Intermediate Type : Event Designer
| Subyek: Re: [SOLVED] Discount Shop 2010-07-26, 07:00 | |
| errr, pancing pake event aja kk. coba kombinasiin switch, variabel sama conditional branch.. masalahnya adalah: - Quote :
- kalo bwt item yang sama kan kebanyakan
butuh pengorbanan untuk membuat game keren (maaf kalo ga banyak ngebantu) | |
|
rusted_71 Scripter Karatan
Posts : 392 Thanked : 11 Engine : RMVX Skill : Beginner Type : Scripter
| Subyek: Re: [SOLVED] Discount Shop 2010-07-26, 08:19 | |
| @TS: kayknya gw bisa bantu... tar gw coba dulu yah... edit: neh coba pake script ini, taro di atas main di bawah scene_debug... di atas semua custom script tuh harga di toko bakal berubah tergantung ama angka di variable diskon. variable diskon bisa di isi sama angka dari 0-100... - Spoiler:
- Code:
-
module CONSTANT DISC_RATE = 1 #nomor variable diskon, ganti aja sama variable yang dimaksud end
class Window_ShopBuy < Window_Selectable def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end price = item.price * $game_variables[CONSTANT::DISC_RATE] / 100 if price <= $game_party.gold and number < 99 self.contents.font.color = normal_color else self.contents.font.color = disabled_color end x = 4 y = index * 32 rect = Rect.new(x, y, self.width - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 88, 32, price.to_s, 2) end end
class Scene_Shop def update_buy # Set status window item @status_window.item = @buy_window.item # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Change windows to initial mode @command_window.active = true @dummy_window.visible = true @buy_window.active = false @buy_window.visible = false @status_window.visible = false @status_window.item = nil # Erase help text @help_window.set_text("") return end # If C button was pressed if Input.trigger?(Input::C) # Get item @item = @buy_window.item @price = @item.price * $game_variables[CONSTANT::DISC_RATE] / 100 p @price # If item is invalid, or price is higher than money possessed if @item == nil or @price > $game_party.gold # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Get items in possession count case @item when RPG::Item number = $game_party.item_number(@item.id) when RPG::Weapon number = $game_party.weapon_number(@item.id) when RPG::Armor number = $game_party.armor_number(@item.id) end # If 99 items are already in possession if number == 99 # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) # Calculate maximum amount possible to buy max = @price == 0 ? 99 : $game_party.gold / @price max = [max, 99 - number].min # Change windows to quantity input mode @buy_window.active = false @buy_window.visible = false @number_window.set(@item, max, @price) @number_window.active = true @number_window.visible = true end end #-------------------------------------------------------------------------- # * Frame Update (when sell window is active) #-------------------------------------------------------------------------- def update_sell # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Change windows to initial mode @command_window.active = true @dummy_window.visible = true @sell_window.active = false @sell_window.visible = false @status_window.item = nil # Erase help text @help_window.set_text("") return end # If C button was pressed if Input.trigger?(Input::C) # Get item @item = @sell_window.item @price = @item.price * $game_variables[CONSTANT::DISC_RATE] / 100 # Set status window item @status_window.item = @item # If item is invalid, or item price is 0 (unable to sell) if @item == nil or @price == 0 # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) # Get items in possession count case @item when RPG::Item number = $game_party.item_number(@item.id) when RPG::Weapon number = $game_party.weapon_number(@item.id) when RPG::Armor number = $game_party.armor_number(@item.id) end # Maximum quanitity to sell = number of items in possession max = number # Change windows to quantity input mode @sell_window.active = false @sell_window.visible = false @number_window.set(@item, max, @price / 2) @number_window.active = true @number_window.visible = true @status_window.visible = true end end #-------------------------------------------------------------------------- # * Frame Update (when quantity input window is active) #-------------------------------------------------------------------------- def update_number # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Set quantity input window to inactive / invisible @number_window.active = false @number_window.visible = false # Branch by command window cursor position case @command_window.index when 0 # buy # Change windows to buy mode @buy_window.active = true @buy_window.visible = true when 1 # sell # Change windows to sell mode @sell_window.active = true @sell_window.visible = true @status_window.visible = false end return end # If C button was pressed if Input.trigger?(Input::C) # Play shop SE $game_system.se_play($data_system.shop_se) # Set quantity input window to inactive / invisible @number_window.active = false @number_window.visible = false # Branch by command window cursor position case @command_window.index when 0 # buy # Buy process $game_party.lose_gold(@number_window.number * @price) case @item when RPG::Item $game_party.gain_item(@item.id, @number_window.number) when RPG::Weapon $game_party.gain_weapon(@item.id, @number_window.number) when RPG::Armor $game_party.gain_armor(@item.id, @number_window.number) end # Refresh each window @gold_window.refresh @buy_window.refresh @status_window.refresh # Change windows to buy mode @buy_window.active = true @buy_window.visible = true when 1 # sell # Sell process $game_party.gain_gold(@number_window.number * (@price / 2)) case @item when RPG::Item $game_party.lose_item(@item.id, @number_window.number) when RPG::Weapon $game_party.lose_weapon(@item.id, @number_window.number) when RPG::Armor $game_party.lose_armor(@item.id, @number_window.number) end # Refresh each window @gold_window.refresh @sell_window.refresh @status_window.refresh # Change windows to sell mode @sell_window.active = true @sell_window.visible = true @status_window.visible = false end return end end end
OOT: @el musketer: ikutan usm juga? good luck deh... gw tunggu di kampus jurangmangu... hehehehe | |
|
Reveloiz_Blizzard Newbie
Posts : 6 Thanked : 0 Engine : RMVX Skill : Beginner Type : Writer
| Subyek: Re: [SOLVED] Discount Shop 2010-08-08, 11:51 | |
| Thank u smua-na ^^ wkt itu prnh pk switch di script-na, eh malah dipotong trs harga-nya tiap gnt scene. hihihi, kykny slh msk-in command switch-na, jd pararel event. huff | |
|
Sponsored content
| Subyek: Re: [SOLVED] Discount Shop | |
| |
|