[Script] [ACE] [RMVXA] Vứt Item 1.1

in RPG Maker
[size=large]Script giúp bạn vứt những item không cần thiết đi.[/size]

Scripts
Credit đầy đủ tên tác giả
[size=x-large]Credit[/size]
Ublic
[align=right]Đã cộng 3 cash :-bd[/align]

Scripts
#==============================================================================
# ~~Throw Items Away~~ v1.1 đẹp trai lai chó
#==============================================================================
# Script by:
# Ublic
#
#==============================================================================
# Terms of use:
# * You are allowed to edit everything for yourself, but you are not allowed to
#
# * You have to credit me and Claimh as well!
#
# * You have to have a link to Code Crush:
#=============================================================================
#==============================================================================
# ■ Window_ItemList
#==============================================================================
class Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● Handling processing such as decision and cancellation
#--------------------------------------------------------------------------
def process_handling
return unless open? && active
return call_handler(:append_x) if handle?(:append_x) && Input.trigger?(:X)
super
end
end
#==============================================================================
# ■ Window_ItemNumber
#==============================================================================
class Window_ItemNumber < Window_ShopNumber
#--------------------------------------------------------------------------
# ● Open instance variable
#--------------------------------------------------------------------------
attr_reader :number # The input quantity
#--------------------------------------------------------------------------
# ● Object initialization
#--------------------------------------------------------------------------
def initialize
x = (Graphics.width - window_width) / 2
super(x, 200, line_height*2 + 32)
@item = nil
@max = 1
@number = 1
end
#--------------------------------------------------------------------------
# ● Setting of item and maximum quantity
#--------------------------------------------------------------------------
def set(item, max)
@item = item
@max = max
@number = 1
refresh
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
contents.draw_text(0, 0, 200, line_height, "Throw away:")
draw_item_name(@item, 4, line_height)
draw_number
end
#--------------------------------------------------------------------------
# ● Y-coordinate of item name display line
#--------------------------------------------------------------------------
def item_y
line_height
end
end
#==============================================================================
# ■ Scene_Item
#==============================================================================
class Scene_Item < Scene_ItemBase
#--------------------------------------------------------------------------
# ● Start processing
#--------------------------------------------------------------------------
alias start_dump start
def start
start_dump
create_item_dump_window
end
#--------------------------------------------------------------------------
# ● Compilation of item window
#--------------------------------------------------------------------------
alias create_item_window_dump create_item_window
def create_item_window
create_item_window_dump
@item_window.set_handler(:append_x, method(:on_item_dump))
end
#--------------------------------------------------------------------------
# ● Compilation of item several selective windows
#--------------------------------------------------------------------------
def create_item_dump_window
@number_window = Window_ItemNumber.new
@number_window.viewport = @viewport
@number_window.hide
@number_window.set_handler(:ok, method(:on_number_ok))
@number_window.set_handler(:cancel, method(:on_number_cancel))
end
#--------------------------------------------------------------------------
# ● Item(You throw away)
#--------------------------------------------------------------------------
def on_item_dump
if item_dumpable?
Sound.play_ok
@number_window.set(item, max_item)
@number_window.show.activate
@item_window.deactivate
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# ● Quantity input (decision)
#--------------------------------------------------------------------------
def on_number_ok
Sound.play_ok
do_item_dump(@number_window.number)
@number_window.hide
activate_item_window
end
#--------------------------------------------------------------------------
# ● Quantity input (cancellation)
#--------------------------------------------------------------------------
def on_number_cancel
Sound.play_cancel
@number_window.hide
activate_item_window
end
#--------------------------------------------------------------------------
# ● Throw away
#--------------------------------------------------------------------------
def do_item_dump(number)
$game_party.lose_item(item, number)
end
#--------------------------------------------------------------------------
# ● The decision which throws away the item
#--------------------------------------------------------------------------
def item_dumpable?
item.is_a?(RPG::Item) ? !item.key_item? : (!item.nil?)
end
#--------------------------------------------------------------------------
# ● Acquisition of the frequency of possession
#--------------------------------------------------------------------------
def max_item
$game_party.item_number(item)
end
end
[size=x-large]Điều khoản sử dụng [/size]Credit đầy đủ tên tác giả
[size=x-large]Credit[/size]
Ublic
[align=right]Đã cộng 3 cash :-bd[/align]
Comments
Tại sao người ta lại có thể quên 1 lỗi nhỏ như vậy :uynhnhau:
Vừa vứt được của nợ, vừa được tiền :thoaimai:
nếu đã dùng limit thì tất nhiên là phải dùng vứt item rồi
mà tất cả những script limit item đều có chức năng throw away
Bạn bỏ vào F9 > chèn trên MAIN