duongtiep Level 15
Danh hiệu : The King Tổng số bài gửi : 1229 MGV Xu : 2677 Danh tiếng : 45 Ngày tham gia : 10/12/2010 Đến từ : Quảng Ninh
| Tiêu đề: Hiện thông báo khi nhận được item 15/12/2010, 21:16 | |
| Get Item Window II Version 2.0 by Woratana Release Date: 19/12/2008 Giới thiệu:Tạo ra bảng thông báo khi ta nhận được item. Tính năng: Phiên bản 1.0 - Hiển thị biểu tượng, số tiền, tên của các mục - Tự động thêm các mục đó hiển thị trên cửa sổ - Bạn có thể thiết lập số lượng bao lâu cửa sổ sẽ ở lại Phiên bản 2.0 - Kịch bản bây giờ là hỗ trợ để hiển thị vũ khí và áo giáp Screenshots: Script: [left] Bản mới[b] - Code:
-
#=============================================================== # ● [VX] ◦ Get Item Window ◦ □ # * Show window to tell player what item he/she got~ #-------------------------------------------------------------- # ◦ by Woratana [woratana@hotmail.com] # ◦ Thaiware RPG Maker Community # ◦ Released on: 19/12/2008 # ◦ Version: 2.0 #-------------------------------------------------------------- # ● How to Use ● #-------------------------------------------------------------- # Call Script: # $scene.new_itemwin(type, item_ID, quantity, *auto_add_item?, *wait_count) # * type: 0 for Item, 1 for Weapon, 2 for Armor # * Item_ID: ID of the item you want to show # * Quantity: Amount of the item the player got # * Auto_Add_Item (Optional): Do you want the script to add item for you? # (Or you can just use event command to add item yourself) # * Wait_Count (Optional): How long (in frame) the item window will stay on screen? # (Default is 160 frames) #-------------------------------------------------------------- # ● Examples ● #-------------------------------------------------------------- # $scene.new_itemwin(0, 1, 5) # ^ The window will show that player got 5 Potions. # $scene.new_itemwin(0, 1, 5, true) # ^ The window will show that player got 5 Potions and also add 5 Potions to # player's inventory immediately. # $scene.new_itemwin(0, 1, 5, false, 100) # ^ The window will show that player got 5 Potions, but will not add 5 the items # to player's inventory. The window will stay for 100 frames before dissappear. #-------------------------------------------------------------- # ● Extra! ● #-------------------------------------------------------------- # You can put an array in item_ID and the item will give out randomly, # for example, # $scene.new_itemwin(0, [1,2,3], 5, true) # ^ It will randomly give 5 of Potion/Hi Potion/or Full Potion. #===============================================================
class Window_GetItem < Window_Base
def initialize(type, items, quantity, auto_add = false, wait_count = nil) super(0,0, 200, WLH + 32) # Default Wait Count wait_count = 160 if wait_count.nil? @wait_count = wait_count # if random item case type when 0; dbase = $data_items when 1; dbase = $data_weapons when 2; dbase = $data_armors end if items.is_a?(Array) items = items[rand(items.size)] end items = dbase[items] # THAI # memname = $game_party.members.size == 1 ? $game_party.members[0].name : 'คุณ' # text = memname + ' ได้รับ ' + items.name + ' x ' + quantity.to_s
# ENGLISH memname = $game_party.members.size == 1 ? $game_party.members[0].name : 'You' text = memname + ' got ' + items.name + ' x ' + quantity.to_s
# Auto Add Item $game_party.gain_item(items, quantity) if auto_add # Calculate Size w_w = self.contents.text_size(text).width + 32 + 24 + 8 w_w = Graphics.width if w_w > Graphics.width self.width = w_w create_contents self.x = (Graphics.width - self.width) / 2 self.y = (Graphics.height - self.height) / 2 # Draw Item Data draw_icon(items.icon_index, 0, 0) self.contents.draw_text(24 + 8, 0, self.contents.width, WLH, text) @opac_per_sec = (255 / @wait_count) if @wait_count != 0 end
def update if @wait_count > 0 @wait_count -= 1 self.opacity -= @opac_per_sec if !@opac_per_sec.nil? else dispose end end
end
class GetItem_Controller attr_accessor :data
def initialize @data = [] end
def update @data.each {|d| d.update if !d.nil? and !d.disposed?} end
def terminate @data.each {|d| d.dispose if (!d.nil? and !d.disposed?) } end
def create(*args) @data.each_index do |i| if !@data[i].nil? @data[i].dispose if !@data[i].disposed? @data[i] = nil end end @data.push (Window_GetItem.new(*args)) end end
class Scene_Map < Scene_Base alias wora_scemap_str_getitemwin start alias wora_scemap_upd_getitemwin update alias wora_scemap_ter_getitemwin terminate
def start wora_scemap_str_getitemwin @getitem_control = GetItem_Controller.new end
def update wora_scemap_upd_getitemwin @getitem_control.update end
def terminate @getitem_control.terminate wora_scemap_ter_getitemwin end
# Create Get Item Window def new_itemwin(*args) @getitem_control.create(*args) end end
|
|