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

MeoDenLuoiMeoDenLuoi Posts: 1,425Registered
[size=large]Script giúp bạn vứt những item không cần thiết đi.[/size]
2w0jmBM.png
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

  • Dark TrollDark Troll Posts: 201Registered
    :thoaimai::thoaimai: cái vứt item là thiếu xót của RPG maker
  • leequangsonleequangson Posts: 730Registered
    Rất hữu ích! Nếu dùng với item limit hoặc weight limit thì quá tuyệt vời!
  • MeoDenLuoiMeoDenLuoi Posts: 1,425Registered
    Dark Troll wrote:
    :thoaimai::thoaimai: cái vứt item là thiếu xót của RPG maker

    Tại sao người ta lại có thể quên 1 lỗi nhỏ như vậy :uynhnhau:
  • sanggameboysanggameboy Posts: 1,943Registered
    Thay vì vứt thì sao không đem vào Shop bán nhỉ :3
    Vừa vứt được của nợ, vừa được tiền :thoaimai:
  • CryingWOLFCryingWOLF Posts: 1,766Registered
    Vậy đang trên đường đi ko có shop nhặt được đồ quý đáng giá bằng cả kho đồ của mình trong khi rương đầy thì sao?
  • leequangsonleequangson Posts: 730Registered
    Netro wrote:
    Vậy đang trên đường đi ko có shop nhặt được đồ quý đáng giá bằng cả kho đồ của mình trong khi rương đầy thì sao?

    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
  • chechaochechao Posts: 164Registered
    cái quan trọng là mặc định RM không giới hạn số lượng item :)) nên cái này chỉ cần thiết khi bạn giới hạn số lượng item thôi :)) chính vì ko giới hạn nên mặc định người ta ko cho thêm chức năng vất đi, đó ko phải là thiếu sót mà cho thêm vào sẽ thành thừa :))
  • gaubaccucgaubaccuc Posts: 22Registered
    cái này save ở mục nào trong scritp Editor vậy ?
  • sanggameboysanggameboy Posts: 1,943Registered
    gaubaccuc wrote:
    cái này save ở mục nào trong scritp Editor vậy ?

    Bạn bỏ vào F9 > chèn trên MAIN
Sign In or Register to comment.