v.1.0
OriginalWij / Khai / Eccid
INTRO
I got both of these scripts a long time ago and really liked them, but they had a good deal of conflicts with each other, and a few of my other scripts. I riginally was just going to mod them for my game, but decided to clean them up and re-release them as a completed script here. Enjoy! Make sure to give credit to all three authors!!
[Show/Hide] Screenshots:
I wasn't sure the best way to show how the script works, so here's just what it looks like.




All information is at the top of the "Definitions" script below:
Definitions:
Insert this script above "main", and above the second part of the script.
[Show/Hide] Definitions
CODE
#==============================================================================
# Script : Item Popup / Item Found
#------------------------------------------------------------------------------
# Authors : OriginalWij - Item Pop-Up
# : Khai - Item Found (http://ktbanh.wordpress.com/)
# : Eccid - Item Popup/Item Found Integration and Modification
#------------------------------------------------------------------------------
# Versions : 1.0 - Item Pop-Up (Inital Release)
# : 1.3 - Item Found (Final Release of Version Used)
# : 1.0 - Item Popup/Item Found Integration and Modification
# (Initial Release)
#==============================================================================
# Description :
# - This script (when both scripts are activated) makes the item icon pop out
# from the chest and calls a box containing the item icon (when activated)
# along with the number recieved and name of an item, when a chest is
# specified by a comment box containing the "CHEST_WORD"
#------------------------------------------------------------------------------
# Features :
# - Easy to use
# - No call scripts needed to add items, uses the program default commands
# - Customizable call word used to specify chests
# - Almost completely customizable
# - Works when adding or subtracting items
#------------------------------------------------------------------------------
# How to Install :
# - Place both parts of the script in the "Materials" section above main
# - If you already have either script, it is reccomended you delete them
# or they could cause compatability issues
#------------------------------------------------------------------------------
# How to Use :
# - Make a comment at the beginning of your chest event containing what is
# set as the CHEST_WORD without the quotations around it ("CHEST" by
# default)
# - Use the add item, weapon, armor or gold commands from the event commands
# menu in the editor
# - When adding multiple items, insert a WAIT(1) between them
# - To make a message stating the chest is empty, make a comment containing
# the EMPTY_CHEST_WORD ("EMPTY" by default)
# NOTE: This is useful to put in the last page of a chest event (after
# the chest has been opened)
#------------------------------------------------------------------------------
# - As well, you may use the item found window on its own by using the
# script command "chest(type, index, amount, true)" (without quotations)
# - type (0-3)
# 0 = Gold
# 1 = Item
# 2 = Weapon
# 3 = Armor
#
# - index (Item Number)
#
# - amount (Number Recieved)
#
# - true (leave it true, it specifies the script called by an event)
#
# - Note: Using the call script also puts the item in your inventory,
# so there is no need to add it manually
#------------------------------------------------------------------------------
# Compatability Issues :
# - Anaryu's Particle Engine VX no longer seems to be affected by nor affects
# either of these script
#------------------------------------------------------------------------------
# Terms and Conditions :
# - Free to use as long as authors are credited
#------------------------------------------------------------------------------
# Credits :
# - OriginalWij (Item Pop-Up)
# - Khai (Item Found)(http://ktbanh.wordpress.com/)
# - Eccid (Item Popup/Item Found Integration and Modification)
#==============================================================================
# - PM me if you can think of more ways to make this customizable
#==============================================================================
#------------------------------------------------------------------------------
#==============================================================================
# �–� CUSTOMIZATION AREA �–�
#------------------------------------------------------------------------------
# Which scripts to use
USE_ITEM_POPUP = true
USE_ITEM_FOUND = true # You could set them both to false... but why?
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#[ITEM POPUP DEFINITIONS]
# "Gold" icon index
GOLD_ICON = 205
# Word used in a comment to specify an event is a chest
CHEST_WORD = "CHEST"
# Word used in a comment to specify an event is an empty chest
EMPTY_CHEST_WORD = "EMPTY"
# Choose if an icon pops-up for each multiple of the same item
MULTIPLE_ITEMS = false
# Choose to play sound on item popup
PLAY_POP_UP_SOUND = false
# Item Popup sound Settings
POPUP_SOUND = "Chime2"
POPUP_SOUND_VOLUME = 100
POPUP_SOUND_PITCH = 150
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#[ITEM FOUND WINDOW DEFINITIONS]
# Message to be shown when an item is gained
# (String states: [number recieved] [item name] MSG_ADD ex. 3 Potions Recieved)
MSG_ADD = "Recieved"
# Message to be shown when an item is lost
# (String states: [number removed] [item name] MSG_REMOVE ex. 25 Cards Lost)
MSG_REMOVE = "Lost"
# Message to be shown when a chest is empty
MSG_EMPTY = "The chest is empty"
# Windowskin to be used for the item found window
MSG_WINDOWSKIN = "Window_Classic"
# Text color number (0-31) corresponding to the color library in the
# bottom right-hand corner of the windowskin used
MSG_COLOR = 14
# Use an icon for gold in the icon window instead of a symbol("G" by default)
USE_GOLD_ICON = true
# Icon to use if above is true
GOLD_ICON = 205
# Don't show the icon window next to the item found window
NO_ICON_WINDOW = false
# Choose to play sound on item found window
PLAY_FOUND_WINDOW_SOUND = true
# Item Found sound settings
ITEM_GAIN = "Saint5"
GOLD_GAIN = "Saint5"
ITEM_REMOVE = "Saint5"
GOLD_REMOVE = "Saint5"
FOUND_SOUND_VOLUME = 100
FOUND_SOUND_PITCH = 100
#------------------------------------------------------------------------------
# �–� END OF CUSTOMIZATION AREA �–�
#==============================================================================
CHEST_DATA = []#<-DO NOT ALTER OR DELETE!(Or you'll regret it. HINT:Papa Smurf)
#==============================================================================
# Script : Item Popup / Item Found
#------------------------------------------------------------------------------
# Authors : OriginalWij - Item Pop-Up
# : Khai - Item Found (http://ktbanh.wordpress.com/)
# : Eccid - Item Popup/Item Found Integration and Modification
#------------------------------------------------------------------------------
# Versions : 1.0 - Item Pop-Up (Inital Release)
# : 1.3 - Item Found (Final Release of Version Used)
# : 1.0 - Item Popup/Item Found Integration and Modification
# (Initial Release)
#==============================================================================
# Description :
# - This script (when both scripts are activated) makes the item icon pop out
# from the chest and calls a box containing the item icon (when activated)
# along with the number recieved and name of an item, when a chest is
# specified by a comment box containing the "CHEST_WORD"
#------------------------------------------------------------------------------
# Features :
# - Easy to use
# - No call scripts needed to add items, uses the program default commands
# - Customizable call word used to specify chests
# - Almost completely customizable
# - Works when adding or subtracting items
#------------------------------------------------------------------------------
# How to Install :
# - Place both parts of the script in the "Materials" section above main
# - If you already have either script, it is reccomended you delete them
# or they could cause compatability issues
#------------------------------------------------------------------------------
# How to Use :
# - Make a comment at the beginning of your chest event containing what is
# set as the CHEST_WORD without the quotations around it ("CHEST" by
# default)
# - Use the add item, weapon, armor or gold commands from the event commands
# menu in the editor
# - When adding multiple items, insert a WAIT(1) between them
# - To make a message stating the chest is empty, make a comment containing
# the EMPTY_CHEST_WORD ("EMPTY" by default)
# NOTE: This is useful to put in the last page of a chest event (after
# the chest has been opened)
#------------------------------------------------------------------------------
# - As well, you may use the item found window on its own by using the
# script command "chest(type, index, amount, true)" (without quotations)
# - type (0-3)
# 0 = Gold
# 1 = Item
# 2 = Weapon
# 3 = Armor
#
# - index (Item Number)
#
# - amount (Number Recieved)
#
# - true (leave it true, it specifies the script called by an event)
#
# - Note: Using the call script also puts the item in your inventory,
# so there is no need to add it manually
#------------------------------------------------------------------------------
# Compatability Issues :
# - Anaryu's Particle Engine VX no longer seems to be affected by nor affects
# either of these script
#------------------------------------------------------------------------------
# Terms and Conditions :
# - Free to use as long as authors are credited
#------------------------------------------------------------------------------
# Credits :
# - OriginalWij (Item Pop-Up)
# - Khai (Item Found)(http://ktbanh.wordpress.com/)
# - Eccid (Item Popup/Item Found Integration and Modification)
#==============================================================================
# - PM me if you can think of more ways to make this customizable
#==============================================================================
#------------------------------------------------------------------------------
#==============================================================================
# �–� CUSTOMIZATION AREA �–�
#------------------------------------------------------------------------------
# Which scripts to use
USE_ITEM_POPUP = true
USE_ITEM_FOUND = true # You could set them both to false... but why?
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#[ITEM POPUP DEFINITIONS]
# "Gold" icon index
GOLD_ICON = 205
# Word used in a comment to specify an event is a chest
CHEST_WORD = "CHEST"
# Word used in a comment to specify an event is an empty chest
EMPTY_CHEST_WORD = "EMPTY"
# Choose if an icon pops-up for each multiple of the same item
MULTIPLE_ITEMS = false
# Choose to play sound on item popup
PLAY_POP_UP_SOUND = false
# Item Popup sound Settings
POPUP_SOUND = "Chime2"
POPUP_SOUND_VOLUME = 100
POPUP_SOUND_PITCH = 150
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#[ITEM FOUND WINDOW DEFINITIONS]
# Message to be shown when an item is gained
# (String states: [number recieved] [item name] MSG_ADD ex. 3 Potions Recieved)
MSG_ADD = "Recieved"
# Message to be shown when an item is lost
# (String states: [number removed] [item name] MSG_REMOVE ex. 25 Cards Lost)
MSG_REMOVE = "Lost"
# Message to be shown when a chest is empty
MSG_EMPTY = "The chest is empty"
# Windowskin to be used for the item found window
MSG_WINDOWSKIN = "Window_Classic"
# Text color number (0-31) corresponding to the color library in the
# bottom right-hand corner of the windowskin used
MSG_COLOR = 14
# Use an icon for gold in the icon window instead of a symbol("G" by default)
USE_GOLD_ICON = true
# Icon to use if above is true
GOLD_ICON = 205
# Don't show the icon window next to the item found window
NO_ICON_WINDOW = false
# Choose to play sound on item found window
PLAY_FOUND_WINDOW_SOUND = true
# Item Found sound settings
ITEM_GAIN = "Saint5"
GOLD_GAIN = "Saint5"
ITEM_REMOVE = "Saint5"
GOLD_REMOVE = "Saint5"
FOUND_SOUND_VOLUME = 100
FOUND_SOUND_PITCH = 100
#------------------------------------------------------------------------------
# �–� END OF CUSTOMIZATION AREA �–�
#==============================================================================
CHEST_DATA = []#<-DO NOT ALTER OR DELETE!(Or you'll regret it. HINT:Papa Smurf)
#==============================================================================
Item Popup / Item Found:
Insert Below "Definitions" and above "Main"
[Show/Hide] Item Pop-up/Item Found
CODE
#==============================================================================
# Chest Item Pop-Up
#------------------------------------------------------------------------------
# Original Author : OriginalWij
# Version : 1.0
#==============================================================================
# Game_Interpreter
#==============================================================================
class Game_Event < Game_Character
alias chest_update update
def update
chest_update
$event = @event
end
end
class Game_Interpreter
#--------------------------------------------------------------------------
# Get X
#--------------------------------------------------------------------------
def get_x
events = $game_map.events
x_coord = events[@event_id]
return x_coord.screen_x
end
#--------------------------------------------------------------------------
# Get Y
#--------------------------------------------------------------------------
def get_y
events = $game_map.events
y_coord = events[@event_id]
return y_coord.screen_y
end
#--------------------------------------------------------------------------
# Change Gold
#--------------------------------------------------------------------------
def command_125
value = operate_value(@params[0], @params[1], @params[2])
$game_party.gain_gold(value)
x_value = get_x
y_value = get_y
for i in 0...@list.size
$scene = Chest_Popup.new(x_value, y_value, 0, value, 1) if @list[i].code == 108 and @list[i].parameters == [CHEST_WORD]
end
return true
end
#--------------------------------------------------------------------------
# Change Items
#--------------------------------------------------------------------------
def command_126
value = operate_value(@params[1], @params[2], @params[3])
$game_party.gain_item($data_items[@params[0]], value)
$game_map.need_refresh = true
x_value = get_x
y_value = get_y
for i in 0...@list.size
$scene = Chest_Popup.new(x_value, y_value, 1, value, @params[0]) if @list[i].code == 108 and @list[i].parameters == [CHEST_WORD]
end
return true
end
#--------------------------------------------------------------------------
# Change Weapons
#--------------------------------------------------------------------------
def command_127
value = operate_value(@params[1], @params[2], @params[3])
$game_party.gain_item($data_weapons[@params[0]], value, @params[4])
x_value = get_x
y_value = get_y
for i in 0...@list.size
$scene = Chest_Popup.new(x_value, y_value, 2, value, @params[0]) if @list[i].code == 108 and @list[i].parameters == [CHEST_WORD]
end
return true
end
#--------------------------------------------------------------------------
# Change Armor
#--------------------------------------------------------------------------
def command_128
value = operate_value(@params[1], @params[2], @params[3])
$game_party.gain_item($data_armors[@params[0]], value, @params[4])
x_value = get_x
y_value = get_y
for i in 0...@list.size
$scene = Chest_Popup.new(x_value, y_value, 3, value, @params[0]) if @list[i].code == 108 and @list[i].parameters == [CHEST_WORD]
end
return true
end
#--------------------------------------------------------------------------
# Empty Chest
#--------------------------------------------------------------------------
alias empty_chest_execute_command execute_command
def execute_command
for i in 0...@list.size
chest(-1,0,0,false) if @list[i].code == 108 and @list[i].parameters == [EMPTY_CHEST_WORD]
end
empty_chest_execute_command
end
end
#==============================================================================
# Item Popup Window
#==============================================================================
class Item_Popup_Window < Window_Base
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
def initialize(x, y)
super(0, 0, 544, 416)
self.opacity = 0
@x = x - 26
@y = y - 56
end
#--------------------------------------------------------------------------
# Pop-Up
#--------------------------------------------------------------------------
def pop_up(icon_index, x, y)
self.contents.clear
draw_icon(icon_index, x, y, true)
end
end
#==============================================================================
# Chest_Popup
#==============================================================================
class Chest_Popup < Scene_Base
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
def initialize(x, y, type, amount, index)
@x = x
@y = y
@amount = amount
$iftype=type;$ifamount=amount;$ifindex=index
case type
when 0 # gold
@amount = 1
@icon_index = GOLD_ICON
when 1 # items
@icon_index = $data_items[index].icon_index
when 2 # weapons
@icon_index = $data_weapons[index].icon_index
when 3 # armors
@icon_index = $data_armors[index].icon_index
end
end
#--------------------------------------------------------------------------
# Start
#--------------------------------------------------------------------------
def start
create_background
@popup_window = Item_Popup_window.new(@x, @y)
end
#--------------------------------------------------------------------------
# Terminate
#--------------------------------------------------------------------------
def terminate
@popup_window.dispose
@menuback_sprite.dispose
end
#--------------------------------------------------------------------------
# Return Scene
#--------------------------------------------------------------------------
def return_scene(type,index,amount,popup)
$scene = Scene_Map.new
if USE_ITEM_FOUND;chest(type,index,amount,popup);end
end
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
def update
super
@popup_window.update
@menuback_sprite.update
if USE_ITEM_POPUP;do_popup;else;return_scene($iftype,$ifindex,$ifamount,false);end
end
#--------------------------------------------------------------------------
# Update Basic
#--------------------------------------------------------------------------
def update_basic
Graphics.update
Input.update
$game_map.update
end
#--------------------------------------------------------------------------
# Wait
#--------------------------------------------------------------------------
def wait(duration)
for i in 0...duration
update_basic
end
end
#--------------------------------------------------------------------------
# Create Background
#--------------------------------------------------------------------------
def create_background
@menuback_sprite = Sprite.new
@menuback_sprite.bitmap = $game_temp.background_bitmap
@menuback_sprite.update
end
#--------------------------------------------------------------------------
# Do Pop-Up
#--------------------------------------------------------------------------
def do_popup
Audio.se_play("Audio/SE/#{POPUP_SOUND}", POPUP_SOUND_VOLUME, POPUP_SOUND_PITCH) if PLAY_POP_UP_SOUND
if MULTIPLE_ITEMS
for i in 1..@amount
for i in 0..4
@popup_window.pop_up(@icon_index, @x - 26, @y - (i * 4) - 48)
@popup_window.update
wait(2)
end
wait(5) if i != @amount
end
else
for i in 0..4
@popup_window.pop_up(@icon_index, @x - 26, @y - (i * 4) - 48)
@popup_window.update
wait(2)
end
wait(5) if i != @amount
end
return_scene($iftype,$ifindex,$ifamount,false)
end
end
#==============================================================================
#------------------------------------------------------------------------------
#==============================================================================
# Item_Found
#------------------------------------------------------------------------------
# Original Author : Khai(http://ktbanh.wordpress.com/)
# Version : 1.3
#==============================================================================
class Chest_Window_Base < Window_Base
def initialize
super(0, 0, CHEST_DATA[0], WLH + 32)
self.windowskin = Cache.system(MSG_WINDOWSKIN)
end
#------------------------------------------------------------------------------
def set_text(text, align = 1)
if text != @text
@text = text
self.contents.clear
self.contents.font.color = text_color(MSG_COLOR)
self.contents.draw_text(0, 0, self.width - 32, WLH, text, align)
end
end
end
#------------------------------------------------------------------------------
class Chest_Window_Addon < Window_Base
def initialize(index,type)
super(0, 0, CHEST_DATA[1], WLH + 32)
self.windowskin = Cache.system(MSG_WINDOWSKIN)
if USE_GOLD_ICON and type==3;type=4;end
self.draw_icon($data_items[index].icon_index, 0, 0, true)if type == 0
self.draw_icon($data_armors[index].icon_index, 0, 0, true)if type == 1
self.draw_icon($data_weapons[index].icon_index, 0, 0, true)if type == 2
self.draw_icon(GOLD_ICON, 0, 0, true) if type == 4
self.contents.font.color = text_color(MSG_COLOR)
self.contents.draw_text(6, 0, CHEST_DATA[1], WLH, $data_system.terms.gold) if type == 3
end
end
#------------------------------------------------------------------------------
def chest(type,index,value,mapcall)
case type;when 0;type=3;when 1;type=0;when 2;type=2;when 3;type=1;end
if mapcall==true;case type;when 0;$game_party.gain_item($data_items[index],value)
when 1;$game_party.gain_item($data_armors[index],value)
when 2;$game_party.gain_item($data_weapons[index],value)
when 3;$game_party.gain_gold(value);end;end
$scene = Scene_Chest.new(type,index,value)
end
#------------------------------------------------------------------------------
class Scene_Chest < Scene_Base
def initialize(type,index,num)
@index = index;@setting = type;@num = num;@spriteset = Spriteset_Map.new
CHEST_DATA[1] = 56
if USE_GOLD_ICON;if type == 3; CHEST_DATA[1] = 56;end
else;if type == 3; CHEST_DATA[1] = width_set($data_system.terms.gold);end;end
@khai_icon_window = Chest_Window_Addon.new(index, type)
case type;when 0;@type=$data_items[@index].name
when 1;@type=$data_armors[@index].name
when 2;@type=$data_weapons[@index].name
when 3;@type=Vocab::gold;else;@text=MSG_EMPTY;@khai_icon_window.width=0;end
#Add Type(0-2) item/armors/weapons
@text = "#{num} #{@type}s #{MSG_ADD}" if type<3&&type>-1&&num>=0
#Add Type(3) gold
@text = "#{num} #{@type} #{MSG_ADD}" if type==3&&num>=0
#Remove Type(0-2) item/armors/weapons
@text = "#{num*-1} #{@type}s #{MSG_REMOVE}" if type<3&&type>-1&&num<0&&num!=-1
#Remove Type(3) Gold
@text = "#{num*-1} #{@type} #{MSG_REMOVE}" if type==3&&num<0
#Remove Single
@text = "#{@type} #{MSG_REMOVE}" if type<3&&type>-1&&num==-1
#Add Single
@text = "#{@type} #{MSG_ADD}" if type<3&&type>-1&&num==1
CHEST_DATA[0] = width_set(@text)
#Window Properties
@khai_icon_window.width=0 if NO_ICON_WINDOW
@khai_info_window=Chest_Window_Base.new
@khai_info_window.width=width_set(@text)
@khai_info_window.set_text(@text)
@khai_info_window.x=(544-(@khai_info_window.width-@khai_icon_window.width))/2
@khai_icon_window.x=(544-(@khai_info_window.width+@khai_icon_window.width))/2
@khai_icon_window.y=(416-@khai_icon_window.height)/2
@khai_info_window.y=(416-@khai_info_window.height)/2
play_se
end
#------------------------------------------------------------------------------
def width_set(n)
self.width_set_bitmap.text_size(n).width + 42
end
#------------------------------------------------------------------------------
def width_set_bitmap
Bitmap.new(32,32)
end
#------------------------------------------------------------------------------
def play_se
#Item Gain SE
Audio.se_play("Audio/SE/#{ITEM_GAIN}", FOUND_SOUND_VOLUME, FOUND_SOUND_PITCH)if@setting<3&&@setting>-1&&@num>0&&ITEM_GAIN != "" if PLAY_FOUND_WINDOW_SOUND
#Gold Gain SE
Audio.se_play("Audio/SE/#{GOLD_GAIN}", FOUND_SOUND_VOLUME, FOUND_SOUND_PITCH)if@setting==3&&@num>=0&&GOLD_GAIN != "" if PLAY_FOUND_WINDOW_SOUND
#Item Remove SE
Audio.se_play("Audio/SE/#{ITEM_REMOVE}", FOUND_SOUND_VOLUME, FOUND_SOUND_PITCH)if@setting<3&&@setting>-1&&@num<0&&ITEM_REMOVE != "" if PLAY_FOUND_WINDOW_SOUND
#Gold Remove SE
Audio.se_play("Audio/SE/#{GOLD_REMOVE}", FOUND_SOUND_VOLUME, FOUND_SOUND_PITCH)if@setting==3&&@num<0&&GOLD_REMOVE != "" if PLAY_FOUND_WINDOW_SOUND
end
#------------------------------------------------------------------------------
def terminate
@spriteset.dispose
@khai_icon_window.dispose
@khai_info_window.dispose
end
#------------------------------------------------------------------------------
def update
@khai_info_window.update
@khai_icon_window.update
@spriteset.update # enables sprite update (weather)
$game_map.update # enables event update (event movement)
$scene = Scene_Map.new if Input.trigger?(Input::B) or Input.trigger?(Input::C)
end
#------------------------------------------------------------------------------
end
#==============================================================================
# Chest Item Pop-Up
#------------------------------------------------------------------------------
# Original Author : OriginalWij
# Version : 1.0
#==============================================================================
# Game_Interpreter
#==============================================================================
class Game_Event < Game_Character
alias chest_update update
def update
chest_update
$event = @event
end
end
class Game_Interpreter
#--------------------------------------------------------------------------
# Get X
#--------------------------------------------------------------------------
def get_x
events = $game_map.events
x_coord = events[@event_id]
return x_coord.screen_x
end
#--------------------------------------------------------------------------
# Get Y
#--------------------------------------------------------------------------
def get_y
events = $game_map.events
y_coord = events[@event_id]
return y_coord.screen_y
end
#--------------------------------------------------------------------------
# Change Gold
#--------------------------------------------------------------------------
def command_125
value = operate_value(@params[0], @params[1], @params[2])
$game_party.gain_gold(value)
x_value = get_x
y_value = get_y
for i in 0...@list.size
$scene = Chest_Popup.new(x_value, y_value, 0, value, 1) if @list[i].code == 108 and @list[i].parameters == [CHEST_WORD]
end
return true
end
#--------------------------------------------------------------------------
# Change Items
#--------------------------------------------------------------------------
def command_126
value = operate_value(@params[1], @params[2], @params[3])
$game_party.gain_item($data_items[@params[0]], value)
$game_map.need_refresh = true
x_value = get_x
y_value = get_y
for i in 0...@list.size
$scene = Chest_Popup.new(x_value, y_value, 1, value, @params[0]) if @list[i].code == 108 and @list[i].parameters == [CHEST_WORD]
end
return true
end
#--------------------------------------------------------------------------
# Change Weapons
#--------------------------------------------------------------------------
def command_127
value = operate_value(@params[1], @params[2], @params[3])
$game_party.gain_item($data_weapons[@params[0]], value, @params[4])
x_value = get_x
y_value = get_y
for i in 0...@list.size
$scene = Chest_Popup.new(x_value, y_value, 2, value, @params[0]) if @list[i].code == 108 and @list[i].parameters == [CHEST_WORD]
end
return true
end
#--------------------------------------------------------------------------
# Change Armor
#--------------------------------------------------------------------------
def command_128
value = operate_value(@params[1], @params[2], @params[3])
$game_party.gain_item($data_armors[@params[0]], value, @params[4])
x_value = get_x
y_value = get_y
for i in 0...@list.size
$scene = Chest_Popup.new(x_value, y_value, 3, value, @params[0]) if @list[i].code == 108 and @list[i].parameters == [CHEST_WORD]
end
return true
end
#--------------------------------------------------------------------------
# Empty Chest
#--------------------------------------------------------------------------
alias empty_chest_execute_command execute_command
def execute_command
for i in 0...@list.size
chest(-1,0,0,false) if @list[i].code == 108 and @list[i].parameters == [EMPTY_CHEST_WORD]
end
empty_chest_execute_command
end
end
#==============================================================================
# Item Popup Window
#==============================================================================
class Item_Popup_Window < Window_Base
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
def initialize(x, y)
super(0, 0, 544, 416)
self.opacity = 0
@x = x - 26
@y = y - 56
end
#--------------------------------------------------------------------------
# Pop-Up
#--------------------------------------------------------------------------
def pop_up(icon_index, x, y)
self.contents.clear
draw_icon(icon_index, x, y, true)
end
end
#==============================================================================
# Chest_Popup
#==============================================================================
class Chest_Popup < Scene_Base
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
def initialize(x, y, type, amount, index)
@x = x
@y = y
@amount = amount
$iftype=type;$ifamount=amount;$ifindex=index
case type
when 0 # gold
@amount = 1
@icon_index = GOLD_ICON
when 1 # items
@icon_index = $data_items[index].icon_index
when 2 # weapons
@icon_index = $data_weapons[index].icon_index
when 3 # armors
@icon_index = $data_armors[index].icon_index
end
end
#--------------------------------------------------------------------------
# Start
#--------------------------------------------------------------------------
def start
create_background
@popup_window = Item_Popup_window.new(@x, @y)
end
#--------------------------------------------------------------------------
# Terminate
#--------------------------------------------------------------------------
def terminate
@popup_window.dispose
@menuback_sprite.dispose
end
#--------------------------------------------------------------------------
# Return Scene
#--------------------------------------------------------------------------
def return_scene(type,index,amount,popup)
$scene = Scene_Map.new
if USE_ITEM_FOUND;chest(type,index,amount,popup);end
end
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
def update
super
@popup_window.update
@menuback_sprite.update
if USE_ITEM_POPUP;do_popup;else;return_scene($iftype,$ifindex,$ifamount,false);end
end
#--------------------------------------------------------------------------
# Update Basic
#--------------------------------------------------------------------------
def update_basic
Graphics.update
Input.update
$game_map.update
end
#--------------------------------------------------------------------------
# Wait
#--------------------------------------------------------------------------
def wait(duration)
for i in 0...duration
update_basic
end
end
#--------------------------------------------------------------------------
# Create Background
#--------------------------------------------------------------------------
def create_background
@menuback_sprite = Sprite.new
@menuback_sprite.bitmap = $game_temp.background_bitmap
@menuback_sprite.update
end
#--------------------------------------------------------------------------
# Do Pop-Up
#--------------------------------------------------------------------------
def do_popup
Audio.se_play("Audio/SE/#{POPUP_SOUND}", POPUP_SOUND_VOLUME, POPUP_SOUND_PITCH) if PLAY_POP_UP_SOUND
if MULTIPLE_ITEMS
for i in 1..@amount
for i in 0..4
@popup_window.pop_up(@icon_index, @x - 26, @y - (i * 4) - 48)
@popup_window.update
wait(2)
end
wait(5) if i != @amount
end
else
for i in 0..4
@popup_window.pop_up(@icon_index, @x - 26, @y - (i * 4) - 48)
@popup_window.update
wait(2)
end
wait(5) if i != @amount
end
return_scene($iftype,$ifindex,$ifamount,false)
end
end
#==============================================================================
#------------------------------------------------------------------------------
#==============================================================================
# Item_Found
#------------------------------------------------------------------------------
# Original Author : Khai(http://ktbanh.wordpress.com/)
# Version : 1.3
#==============================================================================
class Chest_Window_Base < Window_Base
def initialize
super(0, 0, CHEST_DATA[0], WLH + 32)
self.windowskin = Cache.system(MSG_WINDOWSKIN)
end
#------------------------------------------------------------------------------
def set_text(text, align = 1)
if text != @text
@text = text
self.contents.clear
self.contents.font.color = text_color(MSG_COLOR)
self.contents.draw_text(0, 0, self.width - 32, WLH, text, align)
end
end
end
#------------------------------------------------------------------------------
class Chest_Window_Addon < Window_Base
def initialize(index,type)
super(0, 0, CHEST_DATA[1], WLH + 32)
self.windowskin = Cache.system(MSG_WINDOWSKIN)
if USE_GOLD_ICON and type==3;type=4;end
self.draw_icon($data_items[index].icon_index, 0, 0, true)if type == 0
self.draw_icon($data_armors[index].icon_index, 0, 0, true)if type == 1
self.draw_icon($data_weapons[index].icon_index, 0, 0, true)if type == 2
self.draw_icon(GOLD_ICON, 0, 0, true) if type == 4
self.contents.font.color = text_color(MSG_COLOR)
self.contents.draw_text(6, 0, CHEST_DATA[1], WLH, $data_system.terms.gold) if type == 3
end
end
#------------------------------------------------------------------------------
def chest(type,index,value,mapcall)
case type;when 0;type=3;when 1;type=0;when 2;type=2;when 3;type=1;end
if mapcall==true;case type;when 0;$game_party.gain_item($data_items[index],value)
when 1;$game_party.gain_item($data_armors[index],value)
when 2;$game_party.gain_item($data_weapons[index],value)
when 3;$game_party.gain_gold(value);end;end
$scene = Scene_Chest.new(type,index,value)
end
#------------------------------------------------------------------------------
class Scene_Chest < Scene_Base
def initialize(type,index,num)
@index = index;@setting = type;@num = num;@spriteset = Spriteset_Map.new
CHEST_DATA[1] = 56
if USE_GOLD_ICON;if type == 3; CHEST_DATA[1] = 56;end
else;if type == 3; CHEST_DATA[1] = width_set($data_system.terms.gold);end;end
@khai_icon_window = Chest_Window_Addon.new(index, type)
case type;when 0;@type=$data_items[@index].name
when 1;@type=$data_armors[@index].name
when 2;@type=$data_weapons[@index].name
when 3;@type=Vocab::gold;else;@text=MSG_EMPTY;@khai_icon_window.width=0;end
#Add Type(0-2) item/armors/weapons
@text = "#{num} #{@type}s #{MSG_ADD}" if type<3&&type>-1&&num>=0
#Add Type(3) gold
@text = "#{num} #{@type} #{MSG_ADD}" if type==3&&num>=0
#Remove Type(0-2) item/armors/weapons
@text = "#{num*-1} #{@type}s #{MSG_REMOVE}" if type<3&&type>-1&&num<0&&num!=-1
#Remove Type(3) Gold
@text = "#{num*-1} #{@type} #{MSG_REMOVE}" if type==3&&num<0
#Remove Single
@text = "#{@type} #{MSG_REMOVE}" if type<3&&type>-1&&num==-1
#Add Single
@text = "#{@type} #{MSG_ADD}" if type<3&&type>-1&&num==1
CHEST_DATA[0] = width_set(@text)
#Window Properties
@khai_icon_window.width=0 if NO_ICON_WINDOW
@khai_info_window=Chest_Window_Base.new
@khai_info_window.width=width_set(@text)
@khai_info_window.set_text(@text)
@khai_info_window.x=(544-(@khai_info_window.width-@khai_icon_window.width))/2
@khai_icon_window.x=(544-(@khai_info_window.width+@khai_icon_window.width))/2
@khai_icon_window.y=(416-@khai_icon_window.height)/2
@khai_info_window.y=(416-@khai_info_window.height)/2
play_se
end
#------------------------------------------------------------------------------
def width_set(n)
self.width_set_bitmap.text_size(n).width + 42
end
#------------------------------------------------------------------------------
def width_set_bitmap
Bitmap.new(32,32)
end
#------------------------------------------------------------------------------
def play_se
#Item Gain SE
Audio.se_play("Audio/SE/#{ITEM_GAIN}", FOUND_SOUND_VOLUME, FOUND_SOUND_PITCH)if@setting<3&&@setting>-1&&@num>0&&ITEM_GAIN != "" if PLAY_FOUND_WINDOW_SOUND
#Gold Gain SE
Audio.se_play("Audio/SE/#{GOLD_GAIN}", FOUND_SOUND_VOLUME, FOUND_SOUND_PITCH)if@setting==3&&@num>=0&&GOLD_GAIN != "" if PLAY_FOUND_WINDOW_SOUND
#Item Remove SE
Audio.se_play("Audio/SE/#{ITEM_REMOVE}", FOUND_SOUND_VOLUME, FOUND_SOUND_PITCH)if@setting<3&&@setting>-1&&@num<0&&ITEM_REMOVE != "" if PLAY_FOUND_WINDOW_SOUND
#Gold Remove SE
Audio.se_play("Audio/SE/#{GOLD_REMOVE}", FOUND_SOUND_VOLUME, FOUND_SOUND_PITCH)if@setting==3&&@num<0&&GOLD_REMOVE != "" if PLAY_FOUND_WINDOW_SOUND
end
#------------------------------------------------------------------------------
def terminate
@spriteset.dispose
@khai_icon_window.dispose
@khai_info_window.dispose
end
#------------------------------------------------------------------------------
def update
@khai_info_window.update
@khai_icon_window.update
@spriteset.update # enables sprite update (weather)
$game_map.update # enables event update (event movement)
$scene = Scene_Map.new if Input.trigger?(Input::B) or Input.trigger?(Input::C)
end
#------------------------------------------------------------------------------
end
#==============================================================================
DEMO!!!
Sorry for taking so long to upload the demo, been hectic lately ENJOY.
I'm glad you guys like the integration.
