- Joined
- Dec 14, 2016
- Messages
- 3
- Reaction score
- 0
- First Language
- English
- Primarily Uses
Hello everyone,
first off, thank you for taking time to read this! I've been on RPGMaker Forums since 2009 and have been making
games ever since. That being said, I'll be glad to answer further questions about the script I'd love to have made.
An Item Drop Script that allows you to drop an item in your inventory and it appears on the map. (Screenshots attached)
This was made by Reedo back in 2010 for RPGMaker VX. I'd love a carbon copy of it, but for RPGMaker MV. I will attach the script below. If you need more information please ask me! No rush on this and I thank you for anyone attempting it as it would make
Role-Playing games a lot more realistic and fun.
Some of the Original Features: - Could drop and Item and you could come back later and pick it up
- Customize options like if an item should decay and how long until it's gone from the
place it was dropped.
- A helpful script that also allows the player to decorate in-game by allow certain items to be
placed on a wall or table.
first off, thank you for taking time to read this! I've been on RPGMaker Forums since 2009 and have been making
games ever since. That being said, I'll be glad to answer further questions about the script I'd love to have made.
An Item Drop Script that allows you to drop an item in your inventory and it appears on the map. (Screenshots attached)
This was made by Reedo back in 2010 for RPGMaker VX. I'd love a carbon copy of it, but for RPGMaker MV. I will attach the script below. If you need more information please ask me! No rush on this and I thank you for anyone attempting it as it would make
Role-Playing games a lot more realistic and fun.
Some of the Original Features: - Could drop and Item and you could come back later and pick it up
- Customize options like if an item should decay and how long until it's gone from the
place it was dropped.
- A helpful script that also allows the player to decorate in-game by allow certain items to be
placed on a wall or table.
Code:
The Original Script -
##############################################################################
## On-Map Item Drops
## Version 1.3
## November 27, 2010
## By Reedo
###############################################################################
## SOURCE
##
## currently: http://www.rpgmakervx.net/index.php?showtopic=23660
###############################################################################
## REFERENCES
##
## None. This is an original script by Reedo.
## Based on a request by Gaurdiankight on the forum thread:
## http://www.rpgmakervx.net/index.php?showtopic=23660
##
## The following forum members have also contributed to the development:
## Benzu, Topaz, skyrty, Venndetta
###############################################################################
## UPDATE 1.3
##
## Fixed issue with leaving/returning to map twice and drops disappearing.
## Bug found by Guardianknight.
###############################################################################
## UPDATE 1.2
##
## Fixed issue with game version changes & save files. Bug found by Venndetta.
###############################################################################
## DESCRIPTION
##
## This script extends the Item_Scene to include a View/Drop question window.
## Select View to proceed to the default Item_Scene. Select Drop to view all
## items in the party inventory and press confirm on the selected item to
## drop that item onto the map. The image used for the item on the map* is
## taken from the icon of the item which was dropped. The player can step on
## the map event to pickup the item again. The message displayed can be set
## in the configuration options below. You can specify whether the player
## must press the action button to pickup an item, or if they only need to
## step on it. The sounds played for drop and pickup can also be configured.
## * You can also set a specific graphic for the drop. See below...
##
## Set ENEMIES_DROP_ITEMS equal to 'true' to have enemy loot dropped on screen
## instead of being placed in the inventory. Works with default battle system.
## May or may not be compatible with custom battle systems.
##
## If the player is facing a counter tile when the item is dropped, then
## the item will be placed on the counter and must be approached and selected
## to be picked up again. Otherwise the item is dropped at the player's feet
## and they must step onto it again to pick it up.
##
## You can specify a "drop front" tag which will cause an item with that tag
## in its note text box to always drop in front of the player. These items
## must be picked up by standing in front of them. Note that this will allow
## the player to drop the item on any tile (walls and water included!).
##
## Similar to the "drop front" tag, this tag will cause the item to drop
## the specified number of tiles in front of the player. Note that this
## tag can easily drop item out of reach of the player if the distance is
## greater than 1. Note that using a distance of 1 is the same as using
## the "drop front" tag.
##
## You can specify a "no drop" tag which can be placed in an item's note
## text box. Any item with a "no drop" tag will not be selectable in the
## drop item window. You can also specify "no drop switch" and "no drop
## variable comparison" tags which only make the item dropable if the specified
## switch is on or if the variable comparison is true.
##
## You can specify a "no pickup" tag which will prevent an item from being
## picked up again, once dropped.
##
## You can specify a "drop image" tag which will let you set the image on the
## map to a character graphic, or a tile from Tile Sets B-E.
##
## You can specify a "drop decay" tag which cause a dropped item to disappear
## from the map after the specified number of game seconds have elapsed.
###############################################################################
## COMPATIBILITY
##
## Should be compatible with most other scripts.
###############################################################################
## REQUIREMENTS
##
## None
###############################################################################
## INSTALLATION
##
## Plug-and-play.
## Insert below Materials, or other Reedo scripts.
###############################################################################
## RIGHTS & RESTRICTIONS
##
## As with most Reedo scripts, this script is free to re-use, as-is,
## in personal, educational, and commercial RPGVX development projects,
## providing that: this script, as well as the rpgmakervx.net forum link
## from which it was obtained, are credited in writing displayed readily
## to the user of the final compiled code assembly.
##
## Reedo and rgpmakervx.net retain all rights of intellect and ownership.
## You forego all rights of warranty by utilizing this script.
###############################################################################
## USAGE
##
## Specify user options according to the comments below.
###############################################################################
###############################################################################
## USER OPTIONS
###############################################################################
module REEDO_ON_MAP_ITEM_DROPS
# The command displayed to view the normal items window
ITEM_WINDOW_COMMAND = "View"
# The command displayed to view the drop item window
DROP_WINDOW_COMMAND = "Drop"
# The width of the view/drop dialog window
COMMAND_WINDOW_WIDTH = 150
# The messaeg displayed when a dropped item is picked up
FOUND_MESSAGE = "Found {n}!" # use {n} for item name
# Settings for the sound to play when an item is dropped from the item scene
DROP_SOUND_NAME = "Cancel"
DROP_SOUND_VOLUME = 80
DROP_SOUND_PITCH = 100
# Settings for the sound to play when a dropped item is picked up from the map.
PICKUP_SOUND_NAME = "Item1"
PICKUP_SOUND_VOLUME = 80
PICKUP_SOUND_PITCH = 100
# 'false' to use action button to pick up items from the ground; 'true' to
# pick up items on the ground when you step on them.
ACQUIRE_ON_STEP = false
# Set to 'true' to have enemies drop items on screen instead of going straight
# into the party's inventory. Works with default battle system - may not be
# compatible with custom battle scenes.
ENEMIES_DROP_ITEMS = true
# The player will not be able to drop any item with this tag in its note
# text box. The item will be grayed out in the list and will buzz when selected.
EXCLUDE_TAG = "<no drop>"
# Once dropped, items with this tag cannot be picked up again.
NO_PICKUP_TAG = "<no pickup>"
# Items containing this tag in their note text will always drop in front of
# the player. The player must stand in front of an item with this tag to
# pick it up again (they cannot be standing on top of it).
ALWAYS_DROP_IN_FRONT_TAG = "<drop front>"
# NOTE
# The following constants specify the templates for item tags. Any parameters
# needed in a tag are specified between {} curly braces. The templates contain
# an appropriate regex pattern for finding a number or string in the spot
# where the parameter goes when you write the actual tags in item notes.
# It is not recommended to change the regex portion of the tag, but you can
# change the keywords to meet compatibility with other scripts, or to suit
# your own personal taste.
# Similar to the "drop front" tag, an item with this tag will always be dropped
# the specified number of tiles in front of the player.
ALWAYS_DROP_AHEAD_TAG = "<drop ahead{([0-9]+)}>"
# EXAMPLE TAG: <drop ahead{2}> = the item will appear 2 tiles in front of
# the player.
# Items with this tag will have a decay rate set when dropped on the map.
# After the specified number of seconds have elapsed in game, the item
# will disappear from the map if the player has not yet picked it up.
# Note that the decay timing is approximate, but near accurate (the timing
# itself is accurate, the actual comparisons are driven by game updates -
# there are performance reasons for the model and the result is completely
# acceptable).
DECAY_TAG = "<drop decay{([0-9]+)}>"
# EXAMPLE TAG: <drop decay{300}> = the item will disappear 5 mintues after
# being dropped on the map.
# Items with this tag will only be droppable if the specified game switch
# is 'on'. Specify the switch ID to check for sw{}.
CHECK_SWITCH_TAG = "<no drop sw{([0-9]+)}>"
# EXAMPLE TAG: <no drop sw{3}> = switch 3 must be 'on' to drop
# Items with this tag will only be droppable if the specified variable
# meets the specified condition. Specify the variable ID to check for
# var{}, the comparison type for cmp{}, and the value to compare against
# for val{}.
CHECK_VARIABLE_TAG = "<no drop var{([0-9]+)} cmp{([0-9]+)} val{([0-9\-]+)}>"
# EXAMPLE TAG: <no drop var{7} cmp{1} val{4}> = variable 7 must be
# greater than 4 to drop. Use 0-5 for cmp value where:
# 0 =, 1 >, 2 <, 3 >=, 4 <=, 5 !=
# Items containing this tag will use a custom image when dropped on the map
# instead of their normal icon. Specify the character graphic name for
# img{}, the index for i{}, the direction for d{}, and the pattern for p{}.
# If you want to use a tile graphic instead, enter the tile index for img{},
# and specify 0 for each of i{}, d{}, and p{}.
DROP_IMAGE_TAG = "<drop img{([0-9A-Za-z_!\$]*)} i{([0-9]+)} d{([0-9]+)} p{([0-9]+)}>"
# EXAMPLE TAG: <drop img{!Other3} i{3} d{4} p{2}> = bag image from !Other3
# EXAMPLE TAG: <drop img{4} i{0} d{0} p{0}> = the bag sign tile on Tile Set B
# Do not fiddle with this unless you have some script which modifies the
# tiles in Tile Set A which are recognized as counter tiles.
COUNTER_TILES = [(3152 .. 3199), (3536 .. 3583),
(3920 .. 3967), (4304 .. 4351)]
# This list contains the tiles which should never have an item dropped on them.
# The list contains the autotiles from the first two rows of Tile Set A,
# the empty and black tiles, and all of the "fade to empty" wall tiles (those
# meant to be the bottom of a wall which drops off into blackness). If an item
# has a "drop front/ahead" tag, but the tile in front of the player is in the
# following list, the item will drop at their feet instead.
FORBIDDEN_TILES = [(2048 .. 2815), [1536, 1551], (1544 .. 1548),
(1561 .. 1567), (1576 .. 1583), (1592 .. 1599)]
end
###############################################################################
## MAIN SCRIPT
###############################################################################
## EDITS BEYOND THIS POINT ARE AT YOUR OWN RISK!!!
###############################################################################
# $game_reedo_item_drops = hash of map id => hash of event id => array of event, item
class Reedo_Drop_Event
@@Decay_Drops = {} # = hash of Game_Event => Array of drop time integer, decay time integer
def self.clear_map_drops(map_id)
data = $game_reedo_item_drops[$game_map.map_id]
remove = []
if data != nil
data.keys.each do |event_id|
remove.push(event_id)
end
Reedo_Drop_Event.decay_drops.keys.each do |gev|
if remove.include?(gev.id)
Reedo_Drop_Event.decay_drops.delete(gev)
end
end
data.clear
$game_map.reedo_clear_drops(remove)
end
end
def self.create_new(item)
id = $game_map.reedo_get_eventID
p = RPG::Event::page.new
p.move_type = 0
p.direction_fix = true
p.through = true
p.priority_type = 0
p.trigger = 1 if REEDO_ON_MAP_ITEM_DROPS::ACQUIRE_ON_STEP
x = $game_player.x
y = $game_player.y
delta_x = 0
delta_y = 0
case $game_player.direction
when 2; delta_y = 1
when 4; delta_x = -1
when 6; delta_x = 1
when 8; delta_y = -1
end
drop_front = false
test_tile = $game_map.data[x + delta_x, y + delta_y, 0]
REEDO_ON_MAP_ITEM_DROPS::COUNTER_TILES.each do |rng|
if rng.include?(test_tile)
drop_front = true
break
end
end
text = item.note
tag = REEDO_ON_MAP_ITEM_DROPS::ALWAYS_DROP_IN_FRONT_TAG
drop_front = true if text[/#{tag}/i] != nil
tag = REEDO_ON_MAP_ITEM_DROPS::ALWAYS_DROP_AHEAD_TAG
matches = text.scan(/#{tag}/i)
if matches != nil
if matches.length > 0
val = matches[0][0].to_i
delta_x *= val
delta_y *= val
drop_front = true
end
end
front_tile = $game_map.data[x + delta_x, y + delta_y, 0]
REEDO_ON_MAP_ITEM_DROPS::FORBIDDEN_TILES.each do |rng|
if rng.include?(front_tile)
drop_front = false
break
end
end
if drop_front
x += delta_x
y += delta_y
p.trigger = 0
p.priority_type = 1
end
ev = RPG::Event.new(x, y)
ev.id = id
case item
when RPG::Item
command = 126
when RPG::Weapon
command = 127
when RPG::Armor
command = 128
end
tag = REEDO_ON_MAP_ITEM_DROPS::NO_PICKUP_TAG
if text[/#{tag}/i] == nil
se_name = REEDO_ON_MAP_ITEM_DROPS::pICKUP_SOUND_NAME
se_volume = REEDO_ON_MAP_ITEM_DROPS::pICKUP_SOUND_VOLUME
se_pitch = REEDO_ON_MAP_ITEM_DROPS::pICKUP_SOUND_PITCH
se = RPG::SE.new(se_name, se_volume, se_pitch)
ec = RPG::EventCommand.new(250, 0, [se])
p.list.push(ec)
ec = RPG::EventCommand.new(command, 0, [item.id, 0, 0, 1])
p.list.push(ec)
ec = RPG::EventCommand.new(101, 0, ["", 0, 0, 2])
p.list.push(ec)
message = REEDO_ON_MAP_ITEM_DROPS::FOUND_MESSAGE.gsub(/{n}/, item.name)
ec = RPG::EventCommand.new(401, 0, [message])
p.list.push(ec)
ec = RPG::EventCommand.new(214, 0, [])
p.list.push(ec)
ec = RPG::EventCommand.new(0, 0, [])
p.list.push(ec)
ev.pages.push(p)
end
return ev
end
def self.drop_item(item, from_party = true)
return if item == nil
ev = Reedo_Drop_Event.create_new(item)
data = $game_reedo_item_drops[$game_map.map_id]
data = {} if data == nil
data[ev.id] = [ev, item]
$game_reedo_item_drops[$game_map.map_id] = data
$game_map.reedo_add_drop(ev, item)
$game_party.gain_item(item, -1, false) if from_party
end
def self.decay_drops
return @@Decay_Drops
end
def self.decay_drops=(new_drops)
@@Decay_Drops = new_drops
end
def self.play_time
return (Graphics.frame_count / Graphics.frame_rate).to_i
end
end
class Game_Map
alias reedo_osid_gm_initialize initialize
def initialize
reedo_osid_gm_initialize
end
alias reedo_osid_gm_setup setup
def setup(map_id)
reedo_osid_gm_setup(map_id)
@reedo_loaded_drops = []
data = $game_reedo_item_drops[@map_id]
if data != nil
data.values.each do |vals|
$game_map.reedo_add_drop(vals[0], vals[1])
@reedo_loaded_drops.push(vals[0])
end
end
end
alias reedo_osid_gm_update update
def update
Reedo_Drop_Event.decay_drops.keys.each do |gev|
play_time = Reedo_Drop_Event.play_time
data = Reedo_Drop_Event.decay_drops[gev]
if play_time - data[0] >= data[1]
Reedo_Drop_Event.decay_drops.delete(gev)
gev.erase
end
end
reedo_osid_gm_update
end
def reedo_get_eventID
baseID = 1
if @events.length > 0
baseID = @events.keys.max + 1
end
return baseID
end
def reedo_clear_drops(drop_list)
drop_list.each do |i|
@events.erase
end
end
def reedo_add_drop(event, item)
image_set = false
text = item.note
tag = REEDO_ON_MAP_ITEM_DROPS::DROP_IMAGE_TAG
matches = text.scan(/#{tag}/i)
if matches.length > 0
match = matches[0]
if match[0].to_i == 0
event.pages[1].graphic.character_name = match[0]
event.pages[1].graphic.character_index = match[1].to_i
event.pages[1].graphic.direction = match[2].to_i
event.pages[1].graphic.pattern = match[3].to_i
else
event.pages[1].graphic.tile_id = match[0].to_i
end
image_set = true
end
gev = Game_Event.new(@map_id, event)
gev.reedo_icon_index = item.icon_index if !image_set
@events[event.id] = gev
tag = REEDO_ON_MAP_ITEM_DROPS::DECAY_TAG
matches = text.scan(/#{tag}/i)
if matches.length > 0
match = matches[0]
dd = Reedo_Drop_Event.decay_drops
exists = false
dd.keys.each do |key|
if key.id == event.id
exists = true
break
end
end
dd[gev] = [Reedo_Drop_Event.play_time, match[0].to_i] if !exists
end
end
end
class Game_Event
def reedo_icon_index
return @reedo_icon_index
end
def reedo_icon_index=(new_index)
@reedo_icon_index = new_index
end
alias reedo_osid_ge_erase erase
def erase
@reedo_icon_index = nil
drop_data = $game_reedo_item_drops[$game_map.map_id]
drop_data.delete(@event.id) if drop_data != nil
reedo_osid_ge_erase
end
end
class Sprite_Character
alias reedo_osid_si_update_bitmap update_bitmap
def update_bitmap
if @character.is_a?(Game_Event)
icon_index = @character.reedo_icon_index
if icon_index != nil
self.bitmap = Bitmap.new(24, 24)
rct = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.bitmap.blt(0, 0, Cache.system("Iconset"), rct)
self.src_rect.set(0, 0, 24, 24)
self.ox = 12
self.oy = 24
return
end
end
reedo_osid_si_update_bitmap
end
end
class Window_ReedoDropItem< Window_Selectable
def initialize(x, y, width, height)
super(x, y, width, height)
@column_max = 2
self.index = 0
refresh
end
def item
itm = @data[self.index]
if item_enabled?(itm)
return itm
else
return nil
end
end
def items
return @data
end
def include?(item)
return false if item == nil
if $game_temp.in_battle
return false unless item.is_a?(RPG::Item)
end
return true
end
def item_enabled?(item)
return false if item == nil
text = item.note
tag = REEDO_ON_MAP_ITEM_DROPS::EXCLUDE_TAG
return false if text[/#{tag}/i] != nil
result = true
tag = REEDO_ON_MAP_ITEM_DROPS::CHECK_SWITCH_TAG
matches = text.scan(/#{tag}/i)
if matches.length > 0
matches.each do |match|
result = false if !$game_switches[match[0].to_i]
end
end
tag = REEDO_ON_MAP_ITEM_DROPS::CHECK_VARIABLE_TAG
matches = text.scan(/#{tag}/i)
if matches.length > 0
matches.each do |match|
case match[1].to_i
when 0
result = false if !($game_variables[match[0].to_i] = match[2].to_i)
when 1
result = false if !($game_variables[match[0].to_i] > match[2].to_i)
when 2
result = false if !($game_variables[match[0].to_i] < match[2].to_i)
when 3
result = false if !($game_variables[match[0].to_i] >= match[2].to_i)
when 4
result = false if !($game_variables[match[0].to_i] <= match[2].to_i)
when 5
result = false if !($game_variables[match[0].to_i] != match[2].to_i)
end
end
end
return result
end
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
rect.width -= 4
is_enabled = item_enabled?(item)
draw_item_name(item, rect.x, rect.y, is_enabled)
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
end
end
def update_help
itm = @data[self.index]
@help_window.set_text(itm == nil ? "" : itm.description)
end
end
class Scene_Title
alias reedo_osid_st_command_new_game command_new_game
def command_new_game
$game_reedo_item_drops = {}
Reedo_Drop_Event.decay_drops = {}
reedo_osid_st_command_new_game
end
end
class Scene_Item
alias reedo_osid_si_start start
def start
reedo_osid_si_start
v = REEDO_ON_MAP_ITEM_DROPS::ITEM_WINDOW_COMMAND
d = REEDO_ON_MAP_ITEM_DROPS::DROP_WINDOW_COMMAND
width = REEDO_ON_MAP_ITEM_DROPS::COMMAND_WINDOW_WIDTH
@mode_window = Window_Command.new(width, [v, d], 1, 2, 0)
@mode_window.y = 56
@drop_window = Window_ReedoDropItem.new(0, 56, 544, 360)
@drop_window.help_window = @help_window
@drop_window.viewport = @viewport
@base_item_window = @item_window
@base_item_window.visible = false
@item_window = @mode_window
se_name = REEDO_ON_MAP_ITEM_DROPS::DROP_SOUND_NAME
se_volume = REEDO_ON_MAP_ITEM_DROPS::DROP_SOUND_VOLUME
se_pitch = REEDO_ON_MAP_ITEM_DROPS::DROP_SOUND_PITCH
@drop_sound = RPG::SE.new(se_name, se_volume, se_pitch)
end
alias reedo_osid_si_terminate terminate
def terminate
@item_window = @base_item_window
@base_item_window = nil
reedo_osid_si_terminate
@drop_window.dispose
@mode_window.dispose
end
alias reedo_osid_si_update update_item_selection
def update_item_selection
if @item_window.is_a?(Window_Command)
reedo_process_mode_update
elsif @item_window.is_a?(Window_ReedoDropItem)
reedo_process_drop_update
else
reedo_osid_si_update
end
end
def reedo_process_mode_update
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
Sound.play_decision
command = @item_window.commands[@item_window.index]
case command
when REEDO_ON_MAP_ITEM_DROPS::ITEM_WINDOW_COMMAND
@item_window = @base_item_window
@item_window.visible = true
@drop_window.visible = false
when REEDO_ON_MAP_ITEM_DROPS::DROP_WINDOW_COMMAND
@item_window = @drop_window
@item_window.visible = true
@base_item_window.visible = false
end
@mode_window.visible = false
end
end
def reedo_process_drop_update
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
item = @item_window.item
Sound.play_buzzer if item == nil
reedo_do_drop_item(item) if item != nil
end
end
def reedo_do_drop_item(item)
@drop_sound.play
Reedo_Drop_Event.drop_item(item)
@drop_window.refresh
end
end
class Scene_File
alias reedo_osid_sf_read_save_data read_save_data
def read_save_data(file)
begin
filej = File.open(@savefile_windows[@index].filename + "idd", "rb")
data = Marshal.load(filej)
$game_reedo_item_drops = data[0]
Reedo_Drop_Event.decay_drops = data[1]
filej.close
rescue
$game_reedo_item_drops = {}
end
reedo_osid_sf_read_save_data(file)
end
alias reedo_osid_sf_write_save_data write_save_data
def write_save_data(file)
reedo_osid_sf_write_save_data(file)
filej = File.open(@savefile_windows[@index].filename + "idd", "wb")
data =[$game_reedo_item_drops, Reedo_Drop_Event.decay_drops]
Marshal.dump(data, filej)
filej.close
end
end
class Scene_Battle
alias reedo_osid_sb_display_drop_items display_drop_items
def display_drop_items
reedo_osid_sb_display_drop_items
if REEDO_ON_MAP_ITEM_DROPS::ENEMIES_DROP_ITEMS
drop_items = $game_troop.make_drop_items
for item in drop_items
Reedo_Drop_Event.drop_item(item)
end
end
end
end
Attachments
-
85.6 KB Views: 80
-
93 KB Views: 75
-
85.3 KB Views: 79
-
253.9 KB Views: 74
Last edited:

