Jump to content

Recommended Posts

Throw Items away v1.0

 

by Claimh

 

translated and edited by Albic

 

 

 

Introduction

This script allows you to throw items away by pressing "A" in the Item Menu

 

Features

- You can throw items away

 

Screenshots

Don't be angry, cause' of the german Names...

throwaway.png

 

How to Use

- Paste the script above main

 

Script

 

 

#==============================================================================
# ~~Throw Items Away~~															 v1.0 (26/03/2012)
#==============================================================================
# Script by:
#		Claimh
#
# Translation by:
#		Albic
#==============================================================================
# Terms of use:
# * You are allowed to use this script in commercial and non-commercial products,
#   but if you use it in a commercial product, you have to send me an e-mail, to
#   let me know to: "albic@spellcraftgaming.net"!
#
# * You are allowed to edit everything for yourself, but you are not allowed to
#   post this script as yours or post it at other websites without permission!
#
# * You have to credit me and Claimh as well!
#
# * You have to have a link to Code Crush:
#   http://www4.plala.or.jp/findias/codecrush/
#=============================================================================


#==============================================================================
# â–  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

 

 

 

Credit

- Albic

 

 

Terms of use

- You are not allowed to post this script at any other forum without my AND Claimh's permission

 

- You have to credit me and Claimh as well!

 

- You have to have a link to Code Crush;

http://www4.plala.or...dias/codecrush/

Edited by Albic

Share this post


Link to post
Share on other sites

Consider making the actual throw-away key something the user can customize, since a lot of people might be assigning stuff to the A key.

 

Yes, that would be an amazing idea. The script is nice, but having it as the "A" key is a tad obnoxious..

Share this post


Link to post
Share on other sites

Ya it would be nice, I can't stand that so many scripts use A(x) for things and you can't customize their keys.

Using another script I have to alter input controls though you could change the Input.trigger?(:X) part of the script I suppose.

but having it as the "A" key is a tad obnoxious.

I totally agree, and let that be a lesson to other scriptwriters lol.

Share this post


Link to post
Share on other sites

@RedRose.190 Let me point you to precisely where that is defined in the script.
 

Spoiler

 #--------------------------------------------------------------------------
 # â— The decision which throws away the item
 #--------------------------------------------------------------------------
 def item_dumpable?
item.is_a?(RPG::Item) ? !item.key_item? : (!item.nil?)
 end

 

I would do this:
item.is_a?(RPG::Item) # ? !item.key_item? : (!item.nil?)

Replace the item.is line with that one, and see if it helps any.

Share this post


Link to post
Share on other sites
2 hours ago, PhoenixSoul said:

@RedRose.190 Let me point you to precisely where that is defined in the script.
 

  Hide contents


 #--------------------------------------------------------------------------
 # â— The decision which throws away the item
 #--------------------------------------------------------------------------
 def item_dumpable?
item.is_a?(RPG::Item) ? !item.key_item? : (!item.nil?)
 end

 

I would do this:
item.is_a?(RPG::Item) # ? !item.key_item? : (!item.nil?)

Replace the item.is line with that one, and see if it helps any.

Thank you very much this made it to work!! 

Share this post


Link to post
Share on other sites
Posted (edited)
On 12/24/2020 at 7:33 AM, roninator2 said:

What PhoenixSoul said will work but this will allow more options

 

Choose one Constant settings or Switches


module R2_Throw_Item
  Key_Item = true # true lets you discard key items
  Weapon = true # ture lets you discard weapons
  Armor = true # true lets you discard armor
end
class Scene_Item < Scene_ItemBase
  def item_dumpable?
    return false if R2_Throw_Item::Key_Item == false && 
    item.is_a?(RPG::Item) && (item.key_item?)
    return false if R2_Throw_Item::Weapon == false && item.is_a?(RPG::Weapon)
    return false if R2_Throw_Item::Armor == false && item.is_a?(RPG::Armor)
    return true unless item.nil?
  end
end

module R2_Throw_Item
  Key_Item_SW = 2 # Switch on lets you discard key items
  Weapon_SW = 3 # switch on lets you discard weapons
  Armor_SW = 4 # switch on lets you discard armor
end
class Scene_Item < Scene_ItemBase
  def item_dumpable?
    return false if $game_switches[R2_Throw_Item::Key_Item_SW] == false && 
    item.is_a?(RPG::Item) && (item.key_item?)
    return false if $game_switches[R2_Throw_Item::Weapon_SW] == false && item.is_a?(RPG::Weapon)
    return false if $game_switches[R2_Throw_Item::Armor_SW] == false && item.is_a?(RPG::Armor)
    return true unless item.nil?
  end
end

Use either if you like. Do you also need items blocked?

You always post savior scripts... and you always helping me so much!! Thank you! 

Edit: if it is easy for you i would love item blocked thank you!

also i know the second part (class Scene....end) i know where to put.. the fist one? (module R2...end)

Edited by RedRose.190

Share this post


Link to post
Share on other sites
1 hour ago, roninator2 said:

It's one script. Add it to your script list in a new slot.

How do you need items to be blocked? A note tag? Specific items?

First of all happy new year!

i would assume like the above (i used the switch version) 

Share this post


Link to post
Share on other sites
Posted (edited)
On 1/8/2021 at 4:48 PM, RedRose.190 said:

like the above

Doesn't clarify for me which way you want it, but here...

Spoiler

# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Throw Items Addon            ║  Version: 1.01     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:  Patch                    ║   Date Created     ║
# ║      Allow to throw item only if    ╠════════════════════╣
# ║      feature is allowed.            ║    08 Jan 2021     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Requires: Claimh - Throw Items Away                      ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║                                                          ║
# ║ Original script allowed to throw items. This will        ║
# ║ block the item if it is not allowed.                     ║
# ║                                                          ║
# ║ Determine if you will use switches or                    ║
# ║ have the condition set for the entire game               ║
# ║                                                          ║
# ║ Specify note tag in the item to block it                 ║
# ║ from being discarded.                                    ║
# ║ <keep forever>                                           ║
# ║                                                          ║
# ║ obviously only if it is not a consumable item            ║
# ║ or sellable.                                             ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║ 1.00 - 08 Jan 2021 - Initial publish                     ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Follow the Original Authors terms                        ║
# ╚══════════════════════════════════════════════════════════╝

module R2_Throw_Item
	Use_Switches = true # will allow only one option to be used
  
	# These will be used if Use_Switches is false
	Key_Item = true # true lets you discard key items
  Weapon = true # ture lets you discard weapons
  Armor = true # true lets you discard armor
	
	# these will be used if Use_Switches is true
  Item_SW = 1 # switch on lets you discard items
	Key_Item_SW = 2 # Switch on lets you discard key items
	Weapon_SW = 3 # switch on lets you discard weapons
	Armor_SW = 4 # switch on lets you discard armor
	
	Item_Block = /<keep[-_ ]forever>/im
end

if R2_Throw_Item::Use_Switches == true
	class Scene_Item < Scene_ItemBase
		def item_dumpable?
      return false if item.note.match(R2_Throw_Item::Item_Block)
			return false if $game_switches[R2_Throw_Item::Item_SW] == false && 
			item.is_a?(RPG::Item)
			return false if $game_switches[R2_Throw_Item::Key_Item_SW] == false && 
			item.is_a?(RPG::Item) && (item.key_item?)
			return false if $game_switches[R2_Throw_Item::Weapon_SW] == false && item.is_a?(RPG::Weapon)
			return false if $game_switches[R2_Throw_Item::Armor_SW] == false && item.is_a?(RPG::Armor)
			return true unless item.nil?
		end
	end
else
	class Scene_Item < Scene_ItemBase
		def item_dumpable?
      return false if item.note.match(R2_Throw_Item::Item_Block)
			return false if (R2_Throw_Item::Key_Item == false && 
			item.is_a?(RPG::Item) && (item.key_item?)) || item.note.match(R2_Throw_Item::Item_Block)
			return false if (R2_Throw_Item::Weapon == false && item.is_a?(RPG::Weapon)) ||
			item.note.match(R2_Throw_Item::Item_Block)
			return false if (R2_Throw_Item::Armor == false && item.is_a?(RPG::Armor)) ||
			item.note.match(R2_Throw_Item::Item_Block)
			return true unless item.nil?
		end
	end
end

 

 

Edited by roninator2
typo

Share this post


Link to post
Share on other sites
On 1/8/2021 at 11:53 PM, roninator2 said:

Doesn't clarify for me which way you want it, but here...

  Hide contents


# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Throw Items Addon            ║  Version: 1.01     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:  Patch                    ║   Date Created     ║
# ║      Allow to throw item only if    ╠════════════════════╣
# ║      feature is allowed.            ║    08 Jan 2021     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Requires: Claimh - Throw Items Away                      ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║                                                          ║
# ║ Original script allowed to throw items. This will        ║
# ║ block the item if it is not allowed.                     ║
# ║                                                          ║
# ║ Determine if you will use switches or                    ║
# ║ have the condition set for the entire game               ║
# ║                                                          ║
# ║ Specify note tag in the item to block it                 ║
# ║ from being discarded.                                    ║
# ║ <keep forever>                                           ║
# ║                                                          ║
# ║ obviously only if it is not a consumable item            ║
# ║ or sellable.                                             ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║ 1.00 - 08 Jan 2021 - Initial publish                     ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Follow the Original Authors terms                        ║
# ╚══════════════════════════════════════════════════════════╝

module R2_Throw_Item
	Use_Switches = true # will allow only one option to be used
  
	# These will be used if Use_Switches is false
	Key_Item = true # true lets you discard key items
  Weapon = true # ture lets you discard weapons
  Armor = true # true lets you discard armor
	
	# these will be used if Use_Switches is true
  Item_SW = 1 # switch on lets you discard items
	Key_Item_SW = 2 # Switch on lets you discard key items
	Weapon_SW = 3 # switch on lets you discard weapons
	Armor_SW = 4 # switch on lets you discard armor
	
	Item_Block = /<keep[-_ ]forever>/im
end

if R2_Throw_Item::Use_Switches == true
	class Scene_Item < Scene_ItemBase
		def item_dumpable?
      return false if item.note.match(R2_Throw_Item::Item_Block)
			return false if $game_switches[R2_Throw_Item::Item_SW] == false && 
			item.is_a?(RPG::Item)
			return false if $game_switches[R2_Throw_Item::Key_Item_SW] == false && 
			item.is_a?(RPG::Item) && (item.key_item?)
			return false if $game_switches[R2_Throw_Item::Weapon_SW] == false && item.is_a?(RPG::Weapon)
			return false if $game_switches[R2_Throw_Item::Armor_SW] == false && item.is_a?(RPG::Armor)
			return true unless item.nil?
		end
	end
else
	class Scene_Item < Scene_ItemBase
		def item_dumpable?
      return false if item.note.match(R2_Throw_Item::Item_Block)
			return false if (R2_Throw_Item::Key_Item == false && 
			item.is_a?(RPG::Item) && (item.key_item?)) || item.note.match(R2_Throw_Item::Item_Block)
			return false if (R2_Throw_Item::Weapon == false && item.is_a?(RPG::Weapon)) ||
			item.note.match(R2_Throw_Item::Item_Block)
			return false if (R2_Throw_Item::Armor == false && item.is_a?(RPG::Armor)) ||
			item.note.match(R2_Throw_Item::Item_Block)
			return true unless item.nil?
		end
	end
end

 

I meant what you did anyway so no worries haha! THANK YOU! 

The note tag option was also useful ty!

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted