Help - Search - Members - Calendar
Full Version: Chest Item Pop-Up v3.0
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS2-Submissions
Pages: 1, 2
originalwij
Chest Item Pop-Up

Version: 3.0
Author: OriginalWij
Release Date: 5/29/2009


Introduction
This script enables gold/items to have their respective icons pop-up when added into inventory.

Features
v1.0
  • Works with gold, items, weapons, and armors
  • VERY easy to implement

v1.1
  • Added automatic description window

v1.2
  • Bug fix and added forgotten aliases

v1.3
  • Added option to only pop-up once when gaining many of the same item

v2.0
  • Added option to turn popup sound on/off
  • Added option to turn popup text on/off
  • Added icon to name popup and the ability to turn it on/off
  • Added adjustable X & Y coordinates for name popup window
  • Reworked name popup window (won't show "1 x" if only one item)
  • Reworked gold display (more efficient)
  • Added "call" feature - with and without adding the item to inventory
  • Added option to wait for button or time for popup name window
  • Added options to define button and time for popup name window wait
  • Added option to enable/disable the "close window" sound
  • Added options to define "close window" sound

v2.1
  • Added option to have popup always active
  • Added option for overlay graphic
  • Added auto-adjust name window location, depending on actor X/Y
  • Fixed moving event bug

v3.0
  • Bugfix for when called from a common event
  • Reworked main popup scene for new X/Y determination
  • Added option for 2nd window cancellation button
  • Added option to center the text window or auto-move to not cover the player
  • Added option to popup items & gold after battle


Script
CODE

#==============================================================================
# Chest Item Pop-Up
#==============================================================================
# Author : OriginalWij
# Version : 3.0
#==============================================================================

#==============================================================================
# v1.0
# - Initial release
# v1.1
# - Added description window
# v1.2
# - Bug fix and added forgotten aliases
# v1.3
# - Added option to only popup once for many of the same item
# v2.0
# - Reworked name popup window (won't show "1 x" if only one item)
# - Reworked gold display (more efficient)
# - Added option to turn popup sound on/off
# - Added option to turn popup text on/off
# - Added icon to name popup and the ability to turn it on/off
# - Added adjustable X & Y coordinates for name popup window
# - Added "call" feature - with and without adding the item to inventory
# - Added option to wait for button or time for popup name window
# - Added options to define button and time for popup name window wait
# - Added option to enable/disable the "close window" sound
# - Added options to define "close window" sound
# v2.1
# - Fixed moving event bug
# - Added option to have popup always active
# - Added option for overlay graphic
# - Added auto-adjust name window location, depending on actor X/Y
# v2.2
# - Several minor (non-bug) display fixes
# - Removed overlay option due to compatibility problems
# - Optimized script
# v3.0
# - Bugfix for when called from a common event
# - Reworked main popup scene for new X/Y determination
# - Added option for 2nd window cancellation button
# - Added option to center the text window or auto-move to not cover the player
# - Added option to popup items & gold after battle
#==============================================================================

#==============================================================================
# To use:
#
# Normal Mode : turn on the switch (designated below) BEFORE
# each gold/item addition
# Automatic Mode : turn on the switch (designated below) if you DON'T want
# popups and then turn the switch off when done
#
# To call manually:
#
# (useful if using a break-limits script and popping-up 100+ of one item)
#
# $scene = Chest_Popup.new(type, amount, index, add = false, x = pX, y = pY)
# type : 0 :gold, 1 :items, 2 :weapons, 3 :armor
# amount : number of items "gaining"
# index : item ID
# add : adds item(s) shown into inventory if true (default = false)
# x : custom X coordinate to pop-up at (default = player X)
# y : custom Y coordinate to pop-up at (default = player Y)
#==============================================================================

#==============================================================================
# NOTE: when adding multiple (different) items in an event, insert a WAIT(1)
# between them (insert the WAIT(1) even if in AUTOMATIC mode)
#==============================================================================
# NOTE: the switch turns itself off after each "add item/gold" event command
# UNLESS in automatic mode (you MUST turn it off MANUALLY in auto-mode)
#==============================================================================
# NOTE: insert a WAIT(7) between a text message and adding items in events
# (allows time for the message window to close)
#==============================================================================

# Automatic popup mode
# (true = ALWAYS popup UNLESS $game_switches[POPUP_SWITCH] is on)
AUTO_POPUP = true
# Switch to activate/deactivate popups
# (activate if AUTO_POPUP = false) (deactivate if AUTO_POPUP = true)
POPUP_SWITCH = 1
# "Gold" icon index
GOLD_ICON = 205
# Only popup once (if many of the same item)
ONLY_SHOW_ONE = true
# Popup gold/items gained in battle (pops-up after battle)
BATTLE_POP = true
# Battle reward prefix text for popup text window
# (if BATTLE_POP = true)
BATTLE_REWARD = 'Battle Reward: '

# Play sound on popup?
PLAY_P_SND = true
#######################################################
# 3 options below are valid ONLY if PLAY_P_SND = true #
#######################################################
# Sound to play upon popup
P_SND = 'Audio/SE/Chime2'
P_SND_V = 100
P_SND_P = 150

# Play "close window" sound?
PLAY_C_SND = true
#######################################################
# 3 options below are valid ONLY if PLAY_C_SND = true #
#######################################################
# Sound to play upon popup close
C_SND = 'Audio/SE/Cancel'
C_SND_V = 80
C_SND_P = 100

# Show popup text?
SHOW_POPUP_TEXT = true
##############################################################
# ALL options below are valid ONLY if SHOW_POPUP_TEXT = true #
##############################################################
# Show icon with popup text?
SHOW_POPUP_TEXT_ICON = true
# Auto adjust window if over player
TEXT_WINDOW_MOVE = true
# Popup text window Y coordinate
TEXT_WINDOW_Y = 180
# Popup text window X coordinate offset
# 0 (Zero) : centered in the window
# negative integer : offset left (centered)
# positive integer : offset right (centered)
TEXT_WINDOW_X_OFFSET = 0
# Wait for button to close? (false = wait for time)
WAIT_FOR_BUTTON = true
# Buttons to wait for
# (if WAIT_FOR_BUTTON = true)
# (Set both to the same button to check for only one)
BUTTON_TO_WAIT_FOR1 = Input::C
BUTTON_TO_WAIT_FOR2 = Input::B
# Frames to wait
# (if WAIT_FOR_BUTTON = false)
WAIT_FOR_TIME = 120

#==============================================================================
# Game_System
#==============================================================================

class Game_System
#--------------------------------------------------------------------------
# Public Instance Variables (Added)
#--------------------------------------------------------------------------
attr_accessor :battle_pop # holds items to popup after battle
attr_accessor :battle_pop_gold # holds gold to popup after battle
#--------------------------------------------------------------------------
# Initialize (Mod)
#--------------------------------------------------------------------------
alias chest_pop_gs_initialize initialize unless $@
def initialize
chest_pop_gs_initialize
@battle_pop = nil
@battle_pop_gold = 0
end
#--------------------------------------------------------------------------
# Get Battle Pop (New)
#--------------------------------------------------------------------------
def battle_pop
return @battle_pop
end
#--------------------------------------------------------------------------
# Set Battle Pop (New)
#--------------------------------------------------------------------------
def battle_pop=(items)
@battle_pop = items
end
#--------------------------------------------------------------------------
# Get Battle Pop Gold (New)
#--------------------------------------------------------------------------
def battle_pop_gold
return @battle_pop_gold
end
#--------------------------------------------------------------------------
# Set Battle Pop Gold (New)
#--------------------------------------------------------------------------
def battle_pop_gold=(gold)
@battle_pop_gold = gold
end
end

#==============================================================================
# Game_Interpreter
#==============================================================================

class Game_Interpreter
#--------------------------------------------------------------------------
# Change Gold (Mod)
#--------------------------------------------------------------------------
alias chest_pop_command_125 command_125 unless $@
def command_125
value = operate_value(@params[0], @params[1], @params[2])
# Pop-up
if $game_switches[POPUP_SWITCH] != AUTO_POPUP and @params[0] == 0
$scene = Chest_Popup.new(0, value, 1)
end
chest_pop_command_125
end
#--------------------------------------------------------------------------
# Change Items (Mod)
#--------------------------------------------------------------------------
alias chest_pop_command_126 command_126 unless $@
def command_126
value = operate_value(@params[1], @params[2], @params[3])
# Pop-up
if $game_switches[POPUP_SWITCH] != AUTO_POPUP and @params[1] == 0
$scene = Chest_Popup.new(1, value, @params[0])
end
chest_pop_command_126
end
#--------------------------------------------------------------------------
# Change Weapons (Mod)
#--------------------------------------------------------------------------
alias chest_pop_command_127 command_127 unless $@
def command_127
value = operate_value(@params[1], @params[2], @params[3])
# Pop-up
if $game_switches[POPUP_SWITCH] != AUTO_POPUP and @params[1] == 0
$scene = Chest_Popup.new(2, value, @params[0])
end
chest_pop_command_127
end
#--------------------------------------------------------------------------
# Change Armor (Mod)
#--------------------------------------------------------------------------
alias chest_pop_command_128 command_128 unless $@
def command_128
value = operate_value(@params[1], @params[2], @params[3])
# Pop-up
if $game_switches[POPUP_SWITCH] != AUTO_POPUP and @params[1] == 0
$scene = Chest_Popup.new(3, value, @params[0])
end
chest_pop_command_128
end
end

#==============================================================================
# Item Popup Window (New)
#==============================================================================

class Item_Popup_Window < Window_Base
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
def initialize(x, y)
super(0, 0, 544, 416)
self.opacity = 0
# Adjust X/Y to proper origin
@x, @y = x - 27, y - 60
end
#--------------------------------------------------------------------------
# Pop-Up
#--------------------------------------------------------------------------
def pop_up(icon_index, x_offset, y_offset)
self.contents.clear
# Draw pop-up icon
draw_icon(icon_index, @x + x_offset, @y + y_offset, true)
end
end

#==============================================================================
# Name window (New)
#==============================================================================

class Name_Window < Window_Base
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
def initialize(x, y, desc, no_desc, index, gold = false, icon = 0)
super(x, y, 56, WLH + 32)
# Adjust window to content's size and center
icon_x = self.contents.text_size(index).width + 6
width = self.contents.text_size(desc).width
self.width = width + 32
self.x = ((544 - self.width) / 2) + TEXT_WINDOW_X_OFFSET
create_contents
# Draw pop-up text
ix = no_desc ? 0 : icon_x
item_check = $game_system.battle_pop
gold_check = $game_system.battle_pop_gold
if BATTLE_POP and (item_check != nil or gold_check > 0) # If battle reward
ix += self.contents.text_size(BATTLE_REWARD).width + 2
end
tx = gold ? 4 : 0
draw_icon(icon, ix, 0) if SHOW_POPUP_TEXT_ICON and !gold
self.contents.draw_text(tx, 0, width, WLH, desc, 0)
draw_icon(GOLD_ICON, width - 24, 0, true) if gold
end
end

#==============================================================================
# Scene_Base
#==============================================================================

class Scene_Base
#--------------------------------------------------------------------------
# Initialize (New)
#--------------------------------------------------------------------------
def initialize
@disable_blur = false
end
#--------------------------------------------------------------------------
# Disable blur (New)
#--------------------------------------------------------------------------
def disable_blur=(enabled)
@disable_blur = enabled
end
#--------------------------------------------------------------------------
# Create Snapshot for Using as Background of Another Screen (Rewrite)
#--------------------------------------------------------------------------
def snapshot_for_background
$game_temp.background_bitmap.dispose
$game_temp.background_bitmap = Graphics.snap_to_bitmap
# Don't blur if disabled
$game_temp.background_bitmap.blur unless @disable_blur # changed
end
end

#==============================================================================
# Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# Start (Mod)
#--------------------------------------------------------------------------
alias chest_pop_start start unless $@
def start
chest_pop_start
# Popup battle rewards
if BATTLE_POP
if $game_system.battle_pop_gold > 0 # gold
gold = $game_system.battle_pop_gold
$game_system.battle_pop_gold = 0
$scene = Chest_Popup.new(0, gold, 0, true)
elsif $game_system.battle_pop != nil # items
item = $game_system.battle_pop.shift
if item == nil
$game_system.battle_pop = nil
else
type = 1 if item.is_a?(RPG::Item)
type = 2 if item.is_a?(RPG::Weapon)
type = 3 if item.is_a?(RPG::Armor)
$scene = Chest_Popup.new(type, 1, item.id, true)
end
end
end
end
end

#==============================================================================
# Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# Display Gained Experience and Gold (Rewrite)
#--------------------------------------------------------------------------
def display_exp_and_gold
# Save gold to popup after battle
$game_system.battle_pop_gold = $game_troop.gold_total if BATTLE_POP # added
exp = $game_troop.exp_total
gold = BATTLE_POP ? 0 : $game_troop.gold_total # changed
$game_party.gain_gold(gold) unless BATTLE_POP # changed
text = sprintf(Vocab::Victory, $game_party.name)
$game_message.texts.push('\|' + text)
if exp > 0
text = sprintf(Vocab::ObtainExp, exp)
$game_message.texts.push('\.' + text)
end
if gold > 0
text = sprintf(Vocab::ObtainGold, gold, Vocab::gold)
$game_message.texts.push('\.' + text)
end
wait_for_message
end
#--------------------------------------------------------------------------
# Display Gained Drop Items (Mod)
#--------------------------------------------------------------------------
alias chest_pop_display_drop_items display_drop_items unless $@
def display_drop_items
# Save items to popup after battle
$game_system.battle_pop = $game_troop.make_drop_items if BATTLE_POP
return if BATTLE_POP
chest_pop_display_drop_items
end
end

#==============================================================================
# Chest_Popup (New)
#==============================================================================

class Chest_Popup < Scene_Base
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
def initialize(type, amount, index, add = false, x = nil, y = nil)
x = $game_player.screen_x if x == nil
y = $game_player.screen_y if y == nil
$game_switches[POPUP_SWITCH] = !AUTO_POPUP
$scene.disable_blur = true
@x, @y, @amount = x, y, amount
@gold = @no_desc = false
case type
when 0 # Gold
$game_party.gain_gold(amount) if add
@icon = GOLD_ICON
@desc_amount = ''
@desc = @amount.to_s
@amount = 1
@gold = true
when 1 # Items
$game_party.gain_item($data_items[index], amount) if add
@icon = $data_items[index].icon_index
@desc_amount = @amount.to_s + ' x'
@desc_amount = '' if @amount == 1
@no_desc = true if @amount == 1
@desc = $data_items[index].name
@amount = 1 if ONLY_SHOW_ONE
when 2 # Weapons
$game_party.gain_item($data_weapons[index], amount) if add
@icon = $data_weapons[index].icon_index
@desc_amount = @amount.to_s + ' x'
@desc_amount = '' if @amount == 1
@no_desc = true if @amount == 1
@desc = $data_weapons[index].name
@amount = 1 if ONLY_SHOW_ONE
when 3 # Armors
$game_party.gain_item($data_armors[index], amount) if add
@icon = $data_armors[index].icon_index
@desc_amount = @amount.to_s + ' x'
@desc_amount = '' if @amount == 1
@no_desc = true if @amount == 1
@desc = $data_armors[index].name
@amount = 1 if ONLY_SHOW_ONE
end
# Set index
@index = @desc_amount
# Add description to text
if @gold
@desc = @desc + ' '
else
if SHOW_POPUP_TEXT_ICON
@desc = @desc_amount + ' ' + @desc
else
@desc = @desc_amount + ' ' + @desc if @desc_amount != ''
end
end
# If battle reward
item_check = $game_system.battle_pop
gold_check = $game_system.battle_pop_gold
if BATTLE_POP and (item_check != nil or gold_check > 0)
@desc = BATTLE_REWARD + @desc
end
end
#--------------------------------------------------------------------------
# Start
#--------------------------------------------------------------------------
def start
create_background
# Create pop-up window
@popup_window = Item_Popup_window.new(@x, @y)
end
#--------------------------------------------------------------------------
# Terminate
#--------------------------------------------------------------------------
def terminate
# Dispose windows
@popup_window.dispose
@menuback_sprite.dispose
@name_window.dispose if SHOW_POPUP_TEXT
end
#--------------------------------------------------------------------------
# Return Scene
#--------------------------------------------------------------------------
def return_scene
# Turn off blur and pop-up switch
$scene.disable_blur = false
$game_switches[POPUP_SWITCH] = false
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
def update
super
# Update pop-up window
@popup_window.update
@menuback_sprite.update
# Do the actual popping-up
do_popup
end
#--------------------------------------------------------------------------
# Update Basic
#--------------------------------------------------------------------------
def update_basic
Graphics.update
Input.update
end
#--------------------------------------------------------------------------
# Wait
#--------------------------------------------------------------------------
def wait(duration)
# Wait for DURATION frames
for i in 0..duration
update_basic
end
end
#--------------------------------------------------------------------------
# Wait for close
#--------------------------------------------------------------------------
def wait_for_close
count = 0
loop do
update_basic
count += 1
# Close if button 1 pressed
break if Input.trigger?(BUTTON_TO_WAIT_FOR1) and WAIT_FOR_BUTTON
# Close if button 2 pressed
break if Input.trigger?(BUTTON_TO_WAIT_FOR2) and WAIT_FOR_BUTTON
# Close if time elapsed
break if count >= WAIT_FOR_TIME and !WAIT_FOR_BUTTON
end
end
#--------------------------------------------------------------------------
# Create Background
#--------------------------------------------------------------------------
def create_background
# Create modified background
@menuback_sprite = Sprite.new
@menuback_sprite.bitmap = $game_temp.background_bitmap
@menuback_sprite.update
end
#--------------------------------------------------------------------------
# Show Name
#--------------------------------------------------------------------------
def show_name
x = 272
y = TEXT_WINDOW_Y
py = $game_player.screen_y - 32
cy = (py - y).abs
# Offset Y if text box is above player's position
if cy < 128 and TEXT_WINDOW_MOVE
y = py < y ? y + (y / 2) : y - (y / 2)
end
# Create Window
@name_window = Name_window.new(x, y, @desc, @no_desc, @index, @gold, @icon)
# Wait for button(s) or time
wait_for_close
# Play sound
Audio.se_play(C_SND, C_SND_V, C_SND_P) if WAIT_FOR_BUTTON and PLAY_C_SND
end
#--------------------------------------------------------------------------
# Do Pop-Up
#--------------------------------------------------------------------------
def do_popup
# Pop-up icon(s)
for i in 1..@amount
Audio.se_play(P_SND, P_SND_V, P_SND_P) if PLAY_P_SND
for i in 0..4
@popup_window.pop_up(@icon, 0, i * -4)
@popup_window.update
wait(2)
end
wait(5) if i != @amount and !ONLY_SHOW_ONE
end
wait(5)
# Pop-up text
show_name if SHOW_POPUP_TEXT
# Exit
return_scene
end
end


Customization
All customizable options are listed at the top of the script

Compatibility
Overwrites some base code, so other similar scripts probably will conflict.

Screenshot
Click to view attachment

DEMO
Updated to v3.0
Click to view attachment

Installation
Place above main (plug and play).

To use in normal mode:
Turn on the switch (specified in the script) just BEFORE each add gold/item event command.
(switch turns off automatically)
(see the demo for examples)

To use in automatic mode:
Turn on the switch (specified in the script) if you DON'T want popups AND then turn the switch off manually when done.
(switch does NOT turn off automatically)

NOTE: when obtaining multiple items (different items), add a WAIT(1) event command between them.
(even when in automatic mode)

FAQ
Comments welcome.

Terms and Conditions
Free to use. Please credit me.

Credits
Me
boomerang
Great script! I'm definitely going to use this. happy.gif
Twilight27
QUOTE (boomerang @ Nov 29 2008, 06:09 PM) *
Great script! I'm definitely going to use this. happy.gif


Yea, great script! It's fun to get multiple items biggrin.gif
Legendary Hero
nice script really good job I'll definitely use this in my game keep up the good work thumbsup.gif
grafikal007
Does this work with other things besides chests? For instance, characters that give a player an item or quest item of some sort? Would I just turn the switch on before the +item event command and then of course include the wait event commands for multiple items?
originalwij
@grafikal007
Yes, it will work anytime you use an event command to increase gold, items, weapons, or armor,
provided you put the switch in (and wait if multiple) like you said.
grafikal007
Absolutely amazing then, it's just want I've been looking for, for some time now. I'll have to begin using it as soon as I make it back to the apartment.

Update: So I finally got around to using this, I LOVE IT! That's all. smile.gif
slaQ
Great script! I'm using it in my game aswell now.

IF my game ever gets publicly released, you will be sure to find your name in the credits smile.gif

Thanks!
Lalakoops
Man!!! Mine does not work. It says a syntaks error on line :165 @popup_window=Item_Popup_window(@x,@y)


Help sad.gif

Ok.. I found the error... Thanks for the script anyways... It is Awesome!!
Twilight27
Hey, can you combine this with Woratona's chest script? If you check his topic, you'd see I asked him the same question, but he hasn't really replied to it yet...
originalwij
@Twilight27

I didn't combine the scripts, but I added a description window (per your request)
(see 1st post for updated script)
Midnight Assassin
Great script! Can't wait to see what you come up with next!








































RubyCrystal
I have a small question regarding this script. Is there a way to make an item appear dramatically? Let's say you get an important item, like in Zelda, and the item appears slowly. Can that be done?
originalwij
@RubyCrystal

sure, try adjusting the wait times at the end of the script
Twilight27
QUOTE (originalwij @ Dec 9 2008, 01:30 AM) *
@RubyCrystal

sure, try adjusting the wait times at the end of the script


Oh, so this will slow down the speed at which the icon comes out of the chess, for the dramatic effect, right? Is there a script where you can zoom in on the character? (Since the game is 2D, we can't spin around him like it does for zelda games). Even making the character jump is dramatic enough too, I guess...
originalwij
@Twilight27
Yes, that controls the speed.

I've seen a zoom script before, can't remember which site, but it gets really pixelated.

You could easily add a "jump" event command (in "set move route") after the item is received.
Dark Gaia
Hey man, great script! It's nice little touches like these that really add to a game. I'll be using this.
Ark Reaver
Excellent script. Tis is definitely going in my game (is it me, or do half the people who come across a good script say that?) A shout out will definitely be going to you in the credits. Nice work. Keep it up.
Dark Gaia
QUOTE (Ark Reaver @ Dec 14 2008, 12:27 AM) *
Excellent script. Tis is definitely going in my game (is it me, or do half the people who come across a good script say that?) A shout out will definitely be going to you in the credits. Nice work. Keep it up.


Personally, I think you may have crafted the new Tankentai's here. I see this script being present in every game.
originalwij
Thanks to everyone for their encouraging comments.
I'm glad to share my creation with the community. I made it for my own game and posted it because I figured that it might be useful to someone else, but I had no idea that it would get such a positive response.
Feedback like this is what makes me want to create more scripts!
originalwij
NOTICE: there is a bug in v1.0 and v1.1

I fixed it and updated the initial post with v1.2a demo.
If you have a previous version, please update to v1.2a

Sorry for the inconvenience ....
BigEd781
There is an error on line 198

CODE
@popup_window = Item_Popup_window.new(@x, @y)


should be

CODE
@popup_window = Item_Popup_Window.new(@x, @y)


(capital 'W') Same problem on line 263

CODE
@name_window = Name_window.new(x, y, @desc, @gold)


Also, as you overwrite methods instead of aliasing them, there are bound to be compatibility errors. there is no reason to overwrite methods like command_125 (change gold) when they could easily be aliased with no code change at all.
Twilight27
QUOTE (originalwij @ Dec 14 2008, 04:57 PM) *
NOTICE: there is a bug in v1.0 and v1.1

I fixed it and updated the initial post with v1.2 script and demo.
If you have a previous version, please update to v1.2

Sorry for the inconvenience ....


Was the error something to do with removing gold and items?
originalwij
@BigEd781
I removed the script, everytime I tried to re-copy and paste the script in the post, it changes those "W"s to small ones.
Weird. But, thanks for pointing that out.
I posted the corrected version with the aliases (forgot to add them, thanks again for noticing!)

@Twilight27
Yes, the error was when removing items (now fixed).
BigEd781
No problem, it is a nice feature for a game. I'm surprised that no one made it earlier.
Gytheriden
this script is so great thumbsup.gif u did a very good job!!!
Kovu
This is exactly what ive been looking for! smile.gif

You= FTW!
icecold49
Thank you originalwij, this is definitely a great script. However, I only need a part of it. How do I make the script only show the icon pop-up and ignore/remove the window message all together?
originalwij
@icecold49

just comment-out 2 lines of code:

@name_window.dispose in the Terminate method,
and show_name in the Do Pop-Up method.
icecold49
Thanks for the help, it works great. I was wondering if this could be made compatible with woratana's Get Item Window script. Both of these scripts combined can create a really nice effect. I already tried using them at the same time but I get an error.
Midnight Assassin
It only works with items. Can you make it work with weapons.
Twilight27
QUOTE (Midnight Assassin @ Dec 20 2008, 05:59 PM) *
It only works with items. Can you make it work with weapons.


How odd. Weapons appear when I use the script, =p
originalwij
@Midnight Assassin
Are you sure you are setting it up right?
It still seems to work for me .....
meganew2
Ill give this Script Try.

Kudos to you
smile.gif
wortana
This script remids me of zelda.. 10/10
originalwij
Update:

V1.3
- added option to only popup once when gaining many of the same item

see original post ....
KAZRCRW_ME
Thank You,my friend.

You are very good to us...

About comment,I have no comments yet to share with you.

Thank you^^
KAZRCRW_ME
With the name of God who He is Loving and Compassionate..

Sorry because double post..

I think you are very good at scripter..
I was use you mouse system v1.8 made by yours..
Great.It is really great.It wonderful.I am very like it.


QUOTE (icecold49 @ Dec 21 2008, 05:33 AM) *
Thanks for the help, it works great. I was wondering if this could be made compatible with woratana's Get Item Window script. Both of these scripts combined can create a really nice effect. I already tried using them at the same time but I get an error.

QUOTE
@icecold49

just comment-out 2 lines of code:

@name_window.dispose in the Terminate method,
and show_name in the Do Pop-Up method.



Maybe if you combine with the Woratana Get Item Window maybe good.

Because It description is complete with image/icon set.than yours.You only gold that has description..
Maybe if you combined this,Many people will be happy to you because use your script.

[Show/Hide] This is Woratana Get Item Window v2.0
CODE
#===============================================================
# ● [VX] ◦ Get Item Window ◦ □
# * Show window to tell player what item he/she got~
#--------------------------------------------------------------
# ◦ by Woratana [woratana@hotmail.com]
# ◦ Thaiware RPG Maker Community
# ◦ Released on: 19/12/2008
# ◦ Version: 2.0
#--------------------------------------------------------------
# ● How to Use ●
#--------------------------------------------------------------
# Call Script:
#     $scene.new_itemwin(type, item_ID, quantity, *auto_add_item?, *wait_count)
# * type: 0 for Item, 1 for Weapon, 2 for Armor
# * Item_ID: ID of the item you want to show
# * Quantity: Amount of the item the player got
# * Auto_Add_Item (Optional): Do you want the script to add item for you?
# (Or you can just use event command to add item yourself)
# * Wait_Count (Optional): How long (in frame) the item window will stay on screen?
# (Default is 160 frames)
#--------------------------------------------------------------
# ● Examples ●
#--------------------------------------------------------------
#  $scene.new_itemwin(0, 1, 5)
# ^ The window will show that player got 5 Potions.
#  $scene.new_itemwin(0, 1, 5, true)
# ^ The window will show that player got 5 Potions and also add 5 Potions to
# player's inventory immediately.
#  $scene.new_itemwin(0, 1, 5, false, 100)
# ^ The window will show that player got 5 Potions, but will not add 5 the items
# to player's inventory. The window will stay for 100 frames before dissappear.
#--------------------------------------------------------------
# ● Extra! ●
#--------------------------------------------------------------
# You can put an array in item_ID and the item will give out randomly,
# for example,
#  $scene.new_itemwin(0, [1,2,3], 5, true)
# ^ It will randomly give 5 of Potion/Hi Potion/or Full Potion.
#===============================================================

class Window_GetItem < Window_Base
  
  def initialize(type, items, quantity, auto_add = false, wait_count = nil)
    super(0,0, 200, WLH + 32)
    # Default Wait Count
    wait_count = 160 if wait_count.nil?
    @wait_count = wait_count
    # if random item
    case type
    when 0; dbase = $data_items
    when 1; dbase = $data_weapons
    when 2; dbase = $data_armors
    end
    if items.is_a?(Array)
      items = items[rand(items.size)]
    end
    items = dbase[items]
    # THAI
    # memname = $game_party.members.size == 1 ? $game_party.members[0].name : 'คุณ'
    # text = memname + ' ได้รับ ' + items.name + ' x ' + quantity.to_s
    
    # ENGLISH
    memname = $game_party.members.size == 1 ? $game_party.members[0].name : 'You'
    text = memname + ' got ' + items.name + ' x ' + quantity.to_s
    
    # Auto Add Item
    $game_party.gain_item(items, quantity) if auto_add
    # Calculate Size
    w_w = self.contents.text_size(text).width + 32 + 24 + 8
    w_w = Graphics.width if w_w > Graphics.width
    self.width = w_w
    create_contents
    self.x = (Graphics.width - self.width) / 2
    self.y = (Graphics.height - self.height) / 2
    # Draw Item Data
    draw_icon(items.icon_index, 0, 0)
    self.contents.draw_text(24 + 8, 0, self.contents.width, WLH, text)
    @opac_per_sec = (255 / @wait_count) if @wait_count != 0
  end
  
  def update
    if @wait_count > 0
      @wait_count -= 1
      self.opacity -= @opac_per_sec if !@opac_per_sec.nil?
    else
      dispose
    end
  end
  
end

class GetItem_Controller
  attr_accessor :data
  
  def initialize
    @data = []
  end

  def update
    @data.each {|d| d.update if !d.nil? and !d.disposed?}
  end
  
  def terminate
    @data.each {|d| d.dispose if (!d.nil? and !d.disposed?) }
  end
  
  def create(*args)
    @data.each_index do |i|
      if !@data[i].nil?
        @data[i].dispose if !@data[i].disposed?
        @data[i] = nil
      end
    end
    @data.push (Window_GetItem.new(*args))
  end
end

class Scene_Map < Scene_Base
  alias wora_scemap_str_getitemwin start
  alias wora_scemap_upd_getitemwin update
  alias wora_scemap_ter_getitemwin terminate
  
  def start
    wora_scemap_str_getitemwin
    @getitem_control = GetItem_Controller.new
  end
  
  def update
    wora_scemap_upd_getitemwin
    @getitem_control.update
  end
  
  def terminate
    @getitem_control.terminate
    wora_scemap_ter_getitemwin
  end
  
  # Create Get Item Window
  def new_itemwin(*args)
    @getitem_control.create(*args)
  end
end


I am apologizes if I do mistake..

Lastly,I hope you combined this script.


May God Bless us.^^
originalwij
Updated to v2.0

BIG update ... see first post for details!
KAZRCRW_ME
With the name of God who He is Loving and Compassionate..

May peace upon you, friend^^

Wow! What a great script.Very Great.It may very useful for others.Other member will happy and thank to you.

I know that is hard to change or combine this script.Other person may be glad.

Thank you, you are kind and helpful person.

May God Bless you, originalwij ^^
originalwij
Updated to v2.1

See original post for new instructions for automatic mode ...
zimonk
I have this and it has worked very good for me but now it doesn't work anymore ohmy.gif
The items doesn't pop-up from the chests!
I don't know what has happened. What can the problem be?
originalwij
Updated to v3.0! (see original post)

@zimonk
You either changed setting(s) or added a conflicting script are my best guesses with the lack of information you gave.
It's hard to tell from "It doesn't work"
buny
great i hope for more item can use more long to up..
or may be when pops up we already can walk
Maroda
i keep getting an error on line 466 it says theres an unitialized constant...sad.gif


Please don't necropost, create another topic in the Script Support section instead ~ Regashi
LordHeinrich
Can you post a demo or at least a screen shot or some additional info. I am not a scripter, but maybe I can help.

Edit: Just tried it out. Seems like RPG Maker is finicky about capitalization. In line 466, window should be Window <<notice the capital "W". After you change it, you'll get another error. You basically have to do the same thing. That's probably all you need to do.
captainregal
Do you think you could make this script compatible with stars chest script?

The Script
#=========================================================================
=====
# ★RGSS2
# STR20_GetInfo v1.2 09/03/17
#
# ◇Requires STEMB_Base!
#
# - This is a popup that displays the item you just obtained, the skill you have
# learned on map.
# ・表示内容は 任意指定の名目+アイテム名+ヘルプメッセージとなります。
# ・アイテムのメモ欄に info[/任意の文字列/] と記述することで
#  通常とは別の説明文をインフォに表示させることができ
す。(v1.1)
# [仕様]インフォが表示されている間も移動できます。
#    移動させたくない場合はウェイトを入れてください

#------------------------------------------------------------------------------
#
# Changelog:
# ◇1.1→1.2
# メッセージウィンドウより上に表示されてしまうのを修
(Z座標を変更した)
# ◇1.0→1.1
# 通常とは別の説明文をインフォに表示できるようになっ

#
#==============================================================================
# ■ Window_Getinfo
#==============================================================================
class Window_Getinfo < Window_Base
# Set preferences
G_ICON = 144 # gold icon ID
Y_TYPE = 1 # Y Coorinates(0 = 上基準 1 = 下基準)
Z = 188 # Z Coordinates (Do not change unless a problem happens).
TIME = 180 # display time in frames (1 = 1/60sec)
OPACITY = 32 # opacity
B_COLOR = Color.new(0, 0, 0, 160) # background color
INFO_SE = RPG::SE.new("Chime2", 80, 100) # sound effect
STR20W = "info"# Set word notes (do not change if you don't need to).
end

if false
# ★use the following in events----------------------★
# type / 0=item, 1=weapon, 2=armor, 3=skill, 4=gold
type = 0
# ID/ammount of gold if ID = 4
id = 1
# text / invalid if gold
text = "Found items!"
#
e = $game_temp.streffect
e.push(Window_Getinfo.new(id, type, text))
# ★end----------------------------------------------★
#
# ◇スキル修得時などにアクター名を直接打ち込むと
#  アクターの名前が変えられるゲームなどで問題が生じま

#  なので、以下のようにtext部分を改造するといいかもしれ
せん。
#
# Get the name of the actor with the specified ID
t = $game_actors[1].name
text = t + " / aquired skill!"

end
#==============================================================================
# ■ Window_Getinfo
#==============================================================================
class Window_Getinfo < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize(id, type, text = "")
super(-16, 0, Graphics.width + 32, 38 + 32)
self.z = Z
self.contents_opacity = 0
self.back_opacity = 0
self.opacity = 0
@count = 0
@i = $game_temp.getinfo_size.index(nil)
@i = $game_temp.getinfo_size.size if (@i == nil)
if Y_TYPE == 0
self.y = -14 + (@i * 40)
else
self.y = 416 - 58 - (@i * 40)
end
$game_temp.getinfo_size[@i] = true
refresh(id, type, text)
INFO_SE.play
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
$game_temp.getinfo_size[@i] = nil
super
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
self.viewport = nil
@count += 1
unless @count >= TIME
self.contents_opacity += OPACITY
else
if Y_TYPE == 0
self.y -= 1
else
self.y += 1
end
self.contents_opacity -= OPACITY
dispose if self.contents_opacity == 0
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(id, type, text = "")
case type
when 0 ; data = $data_items[id]
when 1 ; data = $data_weapons[id]
when 2 ; data = $data_armors[id]
when 3 ; data = $data_skills[id]
when 4 ; data = id
else ; p "Bad value for type><;"
end
c = B_COLOR
self.contents.fill_rect(0, 14, Graphics.width, 24, c)
if type < 4
draw_item_name(data, 4, 14)
self.contents.draw_text(204, 14, 340, WLH, description(data))
else
draw_icon(G_ICON, 4, 14)
self.contents.draw_text(28, 14, 176, WLH, data.to_s + Vocab::gold)
end
self.contents.font.size = 14
w = self.contents.text_size(text).width
self.contents.fill_rect(0, 0, w + 4, 14, c)
self.contents.draw_text_f(4, 0, 340, 14, text)
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ● 解説文取得
#--------------------------------------------------------------------------
def description(data)
return $1.gsub!(/[\t\n\r\f]*/,"") if (data.note[/#{STR20W}\[\/(.*)\/\]/im]) != nil
return data.description
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :getinfo_size
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_str20 initialize
def initialize
initialize_str20
@getinfo_size = []
end
end
#==============================================================================
# ■ Bitmap
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# ● 文字縁取り描画
#--------------------------------------------------------------------------
def draw_text_f(x, y, width, height, str, align = 0, color = Color.new(64,32,128))
shadow = self.font.shadow
b_color = self.font.color.dup
font.shadow = false
font.color = color
draw_text(x + 1, y, width, height, str, align)
draw_text(x - 1, y, width, height, str, align)
draw_text(x, y + 1, width, height, str, align)
draw_text(x, y - 1, width, height, str, align)
font.color = b_color
draw_text(x, y, width, height, str, align)
font.shadow = shadow
end
def draw_text_f_rect(r, str, align = 0, color = Color.new(64,32,128))
draw_text_f(r.x, r.y, r.width, r.height, str, align = 0, color)
end
end
crobak1
LOVE you man xxD

Don't necropost unless you have a question or a bug report. ~Kread
Alerec
Hey thanks for this script, It works great =), Although there was an issue I had with it, When I just took the script directly, I would get an error and the game would crash when I got an item, But when I just ripped the code from the demo itself, it worked perfectly so I don't know what that was about.
Adrien.
This does not seem to work on a map with a series of events like people walking, smoke whisping and what not. I tested this on my "gm map" with one character, one chest (the chest is copied from your demo) and it works. Placing the same chest in a area with lots of events all happening at once such as whats stated above, the chest opens, you get the item but there is no pop up.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.