Guest Access
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
Here's another script that was taken from
the GAMBA ABS demo, translated, and modified
so that it could be used with XAS. enjoy!
the GAMBA ABS demo, translated, and modified
so that it could be used with XAS. enjoy!
- Spoiler:
- Code:
################################################################################
#
# Icon Popup for XAS 3.6
# Translated and Modified
# by Gameface101
# 11-9-09
#
# Original script by Tibuda
#
#--------------------------------------------------------------------------
# module Popup_Item
#--------------------------------------------------------------------------
module Popup_Item
# disable fade?
FADE_LOSE = false
# display time for icon
ICON_TIME = 40
# delay time for icon to display
ICON_DELAY = 24
# name of the icon used for gold
GOLD_ICON = ""
# name of image for graphic background
BACKGROUND = ""
# name of font
NUMBER_FONT = "AddElectricCity"
# font size
NUMBER_SIZE = 12
# default font color
NUMBER_COLOR = Color.new(255, 255, 255)
# gold font color
GOLD_NUMBER_COLOR = Color.new(255, 255, 0)
# item font color
ITEM_NUMBER_COLOR = {}
# armour font color
ARMOR_NUMBER_COLOR = {}
# weapon font color
WEAPON_NUMBER_COLOR = {}
# set true if using "Trickster's Method & Class Library".
TRICK_MACL = false
end
#--------------------------------------------------------------------------
# Game_Character
#--------------------------------------------------------------------------
class Game_Character
attr_accessor :popup_icons
alias popup_gm_party_init initialize
def initialize
popup_gm_party_init
@popup_icons = []
end
def popup_icon(icon_name, number = 1, color = Popup_Item::NUMBER_COLOR)
@popup_icons.push([icon_name, number, color])
end
def fade_icon(icon_name, number = 1, color = Popup_Item::NUMBER_COLOR)
@fade_icons.push([icon_name, number, color])
end
end
#--------------------------------------------------------------------------
# Game_Party
#--------------------------------------------------------------------------
class Game_Party
def popup_icon(icon_name, number = 1, color = Popup_Item::NUMBER_COLOR)
$game_player.popup_icon(icon_name, number, color)
end
def fade_icon(icon_name, number = 1, color = Popup_Item::NUMBER_COLOR)
$game_player.fade_icon(icon_name, number, color)
end
alias popup_gm_party_gain_gold gain_gold
def gain_gold(n)
popup_gm_party_gain_gold(n)
if Popup_Item::GOLD_ICON != "040-Item09" and $scene.is_a?(Scene_Map)
if Popup_Item::GOLD_NUMBER_COLOR.is_a?(Color)
color = Popup_Item::GOLD_NUMBER_COLOR
else
color = Popup_Item::NUMBER_COLOR
end
popup_icon(Popup_Item::GOLD_ICON, n, color)
end
end
alias popup_gm_party_gain_item gain_item
def gain_item(id, n)
popup_gm_party_gain_item(id, n)
return if id < 1 or id >= $data_items.size
if $scene.is_a?(Scene_Map)
if Popup_Item::ITEM_NUMBER_COLOR[id].is_a?(Color)
color = Popup_Item::ITEM_NUMBER_COLOR[id]
elsif Popup_Item::ITEM_NUMBER_COLOR[0].is_a?(Color)
color = Popup_Item::ITEM_NUMBER_COLOR[0]
else
color = Popup_Item::NUMBER_COLOR
end
popup_icon($data_items[id].icon_name, n, color)
end
end
alias popup_gm_party_gain_weapon gain_weapon
def gain_weapon(id, n)
popup_gm_party_gain_weapon(id, n)
return if id < 1 or id >= $data_weapons.size
if $scene.is_a?(Scene_Map)
if Popup_Item::WEAPON_NUMBER_COLOR[id].is_a?(Color)
color = Popup_Item::WEAPON_NUMBER_COLOR[id]
elsif Popup_Item::WEAPON_NUMBER_COLOR[0].is_a?(Color)
color = Popup_Item::WEAPON_NUMBER_COLOR[0]
else
color = Popup_Item::NUMBER_COLOR
end
popup_icon($data_weapons[id].icon_name, n, color)
end
end
alias popup_gm_party_gain_armor gain_armor
def gain_armor(id, n)
popup_gm_party_gain_armor(id, n)
return if id < 1 or id >= $data_armors.size
if $scene.is_a?(Scene_Map)
if Popup_Item::ARMOR_NUMBER_COLOR[id].is_a?(Color)
color = Popup_Item::ARMOR_NUMBER_COLOR[id]
elsif Popup_Item::ARMOR_NUMBER_COLOR[0].is_a?(Color)
color = Popup_Item::ARMOR_NUMBER_COLOR[0]
else
color = Popup_Item::NUMBER_COLOR
end
popup_icon($data_armors[id].icon_name, n, color)
end
end
end
#--------------------------------------------------------------------------
# module RPG
#--------------------------------------------------------------------------
module RPG
#--------------------------------------------------------------------------
# RPG::Sprite
#--------------------------------------------------------------------------
class Sprite
def popup_icon(name, number = 1, color = Popup_Item::NUMBER_COLOR)
return if name == "" or name == nil
return if number.is_a?(Numeric) and number < 0 and !Popup_Item::FADE_LOSE
@icons = [] if !@icons.is_a?(Array)
icon = {}
icon["time"] = 0 - @icons.size * Popup_Item::ICON_DELAY
if number.is_a?(Numeric) and number < 0
icon["fade"] = true
number = - number
else
icon["fade"] = false
end
icon["sprite"] = RPG::Sprite.new(self.viewport)
if Popup_Item::BACKGROUND != ""
bitmap = RPG::Cache.picture(Popup_Item::BACKGROUND)
icon["sprite"].bitmap = Bitmap.new(bitmap.width, bitmap.height)
icon["sprite"].bitmap.blt(0, 0, bitmap, Rect.new(0,0,bitmap.width,bitmap.width))
else
icon["sprite"].bitmap = Bitmap.new(32,32)
end
bitmap = RPG::Cache.icon(name)
icon["sprite"].bitmap.blt(4, 4, bitmap, Rect.new(0,0,24,24))
if Popup_Item::NUMBER_SIZE > 0 and number != 1 and number != ""
icon["sprite"].bitmap.font.outline = true if Popup_Item::TRICK_MACL
icon["sprite"].bitmap.font.name = Popup_Item::NUMBER_FONT
icon["sprite"].bitmap.font.size = Popup_Item::NUMBER_SIZE
icon["sprite"].bitmap.font.color = color
icon["sprite"].bitmap.draw_text(5, 28 - Popup_Item::NUMBER_SIZE - 1, 27, Popup_Item::NUMBER_SIZE, number.to_s)
end
icon["sprite"].ox = 0
icon["sprite"].oy = 20
icon["sprite"].x = self.x
icon["sprite"].y = self.y - self.oy / 2 + 1 - icon["time"]
icon["sprite"].z = 3000
icon["sprite"].visible = false
@icons.push(icon)
end
def update_icons
return unless @icons.is_a?(Array)
return if Graphics.frame_count % 2 != 0
i = 0
while i < @icons.size
if @icons[i]["time"] > Popup_Item::ICON_TIME
@icons[i]["sprite"].bitmap.dispose
@icons[i]["sprite"].dispose
@icons.delete_at(i)
else
@icons[i]["time"] += 1
if @icons[i]["fade"]
op = [255 * (1 - @icons[i]["time"] / Popup_Item::ICON_TIME),0].max
@icons[i]["sprite"].opacity = op
else
@icons[i]["sprite"].y -= 1
end
@icons[i]["sprite"].visible = @icons[i]["time"] >= 0
i += 1
end
end
end
alias popup_sprite_update update
def update
popup_sprite_update
update_icons
end
end
end
#--------------------------------------------------------------------------
# Sprite_Character
#--------------------------------------------------------------------------
class Sprite_Character
alias popup_spr_char_update update
def update
popup_spr_char_update
if @character.is_a?(Game_Character)
while @character.popup_icons.size > 0
popup_icon(@character.popup_icons[0][0], @character.popup_icons[0][1],
@character.popup_icons[0][2])
@character.popup_icons.delete_at(0)
end
end
update_icons
end
end
Administrator
Show Signature
||||||||||
||||||||||
||||||||||
profile
supercow
profile
why hasnt anyone comented on this yet?
tried it and it looks great
seriously, why? its been on 2009 ago
tried it and it looks great
seriously, why? its been on 2009 ago
||||||||||
Show Signature
||||||||||
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
I dunno? ~ all good, I'm dusting off some of these old scripts to make them more easier to use. If I recall this tends to show duplcate icons at times.
I'll be certain to update this one as well. ^,^
thx supercow
I'll be certain to update this one as well. ^,^
thx supercow
Administrator
Show Signature
EVENTALIST
EVENTALIST