#==========================================================================
# ** SG Item Found Window
#==========================================================================
# sandgolem
# Version 1.6
# 14.05.07
#Modifed @ Hanmac
#==========================================================================
SG_FindWord_Default = 'Found:'
SG_NoFind_Default = 'nothing'
SG_Get_Item_Default = true
SG_gold_icon = '032-Item01'
SG_FindWin_CenterY = 120
SG_FindWin_Opacity = 160
SG_Max_items = 0#3
# Instruct: http://www.gamebaker.com/rmxp/scripts/item-found-window.htm
=begin
#==========================================================================
Versionslog
v1.6
Heldstatus hinzugef?gt
v1.5
variable hinzugef?gt
Titel kann ausgeblendet werden
v1.4
Gold hinzugef?gt
v1.3
"nichts" hinzuf?gt
v1.2
Zusatzfunktionen
v1.1
Anzahl und Item hinzuf?gen.
v1.0
Oginal von sandgolem
#========================
To-Do-List:
anzeige Status-erh?hung
#==========================================================================
#
# To check for updates or find more scripts, visit:
# http://www.gamebaker.com/rmxp/scripts/
#
# To use this script, copy it and insert it in a new section above "Main",
# but under the default scripts and the SDK if you're using it.
#
# Have problems? Official topic:
# http://forums.gamebaker.com/showthread.php?t=141
#
#==========================================================================
=end
begin
SDK.log('SG Item Found Window', 'sandgolem', 1.6, '07.05.07')
if SDK.state('SG Item Found Window') != true
@sg_itemfound_disabled = true
end
rescue
end
if !@sg_itemfound_disabled
#--------------------------------------------------------------------------
class Game_System
attr_accessor :sg_found_word
attr_accessor :sg_get_item
attr_accessor :sg_no_find
end
#--------------------------------------------------------------------------
class Scene_Map
attr_accessor :sg_find_window
attr_accessor :sg_find_window_titel
alias sg_findwindow_scenemap_update update
def update
if @sg_find_window != nil
sg_findwindow_update
else
sg_findwindow_scenemap_update
end
end
def sg_findwindow_update
$game_map.update
$game_system.update
$game_screen.update
@spriteset.update
@message_window.update
@sg_find_window.wait -= 1
if @sg_find_window.wait == 1 or Input.trigger?(Input::C) or Input.trigger?(Input::B)
#$game_player.disable_player_movement = false
#$game_player.disable_player_trigger = false
@sg_find_window.dispose
@sg_find_window = nil
@sg_find_window_titel.dispose
@sg_find_window_titel = nil
for i in 0..2
$sg_found[i] = []
$sg_found_number[i] = []
$sg_found_name[i] = []
end
$sg_found_gold = nil
if @window_sprites != nil
@window_sprites.each { |sprite| sprite.dispose if sprite.is_a?(Sprite_AnimatedIcon) }
end
end
end
end
#--------------------------------------------------------------------------
class Interpreter
def sg_find_window(wait = 100)
if $scene.is_a?(Scene_Map)
size = 0
for i in 0..2
if $sg_found[i] == nil
$sg_found[i] = []
end
size += $sg_found[i].size
end
if $sg_found_gold != nil or size == 0
size += 1
end
if SG_Max_items != nil && SG_Max_items != 0
max_items = SG_Max_items
else
max_items = 1
end
if max_items >= size
max_items = size
end
#$game_player.disable_player_movement = true
#$game_player.disable_player_trigger = true
$scene.sg_find_window = Window_SGFound.new(max_items,size)
$scene.sg_find_window_titel = Window_SGFound_Titel.new(max_items)
$scene.sg_find_window.wait = wait
end
end
#--------------------------------------------
#Standard ?nderung
#--------------------------------------------
def sg_find_word(word = SG_FindWord_Default)
$game_system.sg_found_word = word
end
#----------------------
def sg_get_item(bool = SG_Get_Item_Default)
$game_system.sg_get_item = bool
end
#----------------------
def sg_no_find(word = SG_NoFind_Default)
$game_system.sg_no_find = word
end
#----------------------
def get_item(item_typ,item,n=1)
case item_typ
when 0
$game_party.gain_item(item, n)
when 1
$game_party.gain_weapon(item, n)
when 2
$game_party.gain_armor(item, n)
end
end
#----------------------
def sg_get_hero(id,n=1,held_id=nil)
if held_id==nil
for i in 0..$game_party.actors.size-1
case id
when 0
$game_party.actors[i].maxhp += n
when 1
$game_party.actors[i].maxsp += n
when 2
$game_party.actors[i].exp += n
when 3
$game_party.actors[i].str += n
when 4
$game_party.actors[i].dex += n
when 5
$game_party.actors[i].agi += n
when 6
$game_party.actors[i].int += n
end
end
else
case id
when 0
$game_party.actors[held_id].maxhp += n
when 1
$game_party.actors[held_id].maxsp += n
when 2
$game_party.actors[held_id].exp += n
when 3
$game_party.actors[held_id].str += n
when 4
$game_party.actors[held_id].dex += n
when 5
$game_party.actors[held_id].agi += n
when 6
$game_party.actors[held_id].int += n
end
end
end
#--------------------------------------------
# Var-Find
#--------------------------------------------
def sg_find_var(id,n=1,name=nil)
if $sg_found == nil
$sg_found = []
$sg_found_name = []
$sg_found_number = []
end
if $sg_found[2]== nil
$sg_found[2] = []
$sg_found_nummer[2] = []
$sg_found_name[2] = []
end
$sg_found[2] += [id]
$sg_found_nummer[2] += [n]
if name != nil
$sg_found_name[2] += [name]
else
$sg_found_name[2] += [$data_system.variables[id]]
end
if $game_system.sg_get_item != nil
if $game_system.sg_get_item
$game_variables[id] += n
end
else
if SG_Get_Item_Default
$game_variables[id] += n
end
end
end
#--------------------------------------------
# Gold-Find
#--------------------------------------------
def sg_find_gold(gold)
if $sg_found_gold == nil
$sg_found_gold = 0
end
$sg_found_gold+=gold
if $game_system.sg_get_item != nil
if $game_system.sg_get_item
$game_party.gain_gold(gold)
end
else
if SG_Get_Item_Default
$game_party.gain_gold(gold)
end
end
end
#--------------------------------------------
# Held-Find
#--------------------------------------------
def sg_find_hero(id,var=1,held_id=nil,name=nil)
if $sg_found == nil
$sg_found = []
$sg_found_name = []
$sg_found_number = []
end
if $sg_found[2] == nil
$sg_found[2] = []
$sg_found_nummer[2] = []
$sg_found_name[2] = []
end
$sg_found_nummer[2] += [var]
$sg_found[2] += [held_id]
if name != nil
$sg_found_name[2] += [name]
else
case id
when 0
$sg_found_name[2] += [$data_system.words.hp]
when 1
$sg_found_name[2] += [$data_system.words.sp]
when 2
$sg_found_name[2] += ["EXP"]
when 3
$sg_found_name[2] += [$data_system.words.str]
when 4
$sg_found_name[2] += [$data_system.words.dex]
when 5
$sg_found_name[2] += [$data_system.words.agi]
when 6
$sg_found_name[2] += [$data_system.words.int]
end
end
if $game_system.sg_get_item != nil
if $game_system.sg_get_item
sg_get_hero(id,var,held_id)
end
else
if SG_Get_Item_Default
sg_get_hero(id,var,held_id)
end
end
end
#---------------------------------
def sg_find(item_typ,item,n=1,name = nil)
if $sg_found == nil
$sg_found = []
$sg_found_name = []
$sg_found_number = []
end
if $sg_found[0] == nil
$sg_found[0] = []
$sg_found_name[0] = []
$sg_found_number[0] = []
end
case item_typ
when 0
$sg_found[0] += [$data_items[item]]
if name == nil
$sg_found_name[0] += [$data_items[item].name]
end
when 1
$sg_found[0] += [$data_weapons[item]]
if name == nil
$sg_found_name[0] += [$data_weapons[item].name]
end
when 2
$sg_found[0] += [$data_armors[item]]
if name == nil
$sg_found_name[0] += [$data_armors[item].name]
end
end
if name != nil
$sg_found_name[0] += [name]
end
$sg_found_number[0] += [n]
if $game_system.sg_get_item != nil
if $game_system.sg_get_item
get_item(item_typ,item,n)
end
else
get_item(item_typ,item,n)
end
end
#--------------------------------------------
# Spezifische Find
#--------------------------------------------
def sg_find_item(item,n=1,name = nil)
sg_find(0,item,n,name)
end
#-------------------
def sg_find_weapon(item,n=1,name = nil)
sg_find(1,item,n,name)
end
#-------------------
def sg_find_armor(item,n=1,name = nil)
sg_find(2,item,n,name)
end
#-------------------
end
#--------------------------------------------
# Find Window
#--------------------------------------------
#-----------------
# Title window
#-----------------
class Window_SGFound_Titel < Window_Base
def initialize(max_items)
super(180, SG_FindWin_CenterY - max_items*16, 280, max_items*32+64)
self.contents = Bitmap.new(width - 32, 32)
self.opacity = SG_FindWin_Opacity
refresh
end
#-----------------
def refresh
if $game_system.sg_found_word != nil
if $game_system.sg_found_word != ''
self.contents.draw_text(0,0,self.width,32,$game_system.sg_found_word)
end
else
self.contents.draw_text(0,0,self.width,32,SG_FindWord_Default)
end
end
end
#-----------------
class Window_SGFound < Window_Base
attr_accessor :wait
#-----------------
def initialize(max_items,size)
@size=size
super(180, SG_FindWin_CenterY - max_items*16+32, 280, max_items*32+32)
@size = 1 if @size == 0
self.contents = Bitmap.new(width - 32, @size*32)
self.opacity = 0
refresh
end
#-----------------
def refresh
if SDK.enabled?('Animated Icons')
@window_sprites.each { |sprite| sprite.dispose if sprite.is_a?(Sprite_AnimatedIcon) }
end
y = 0
#-----------------
# no window
#-----------------
if $sg_found_gold == nil and @size == 0
if $game_system.sg_no_find != nil
self.contents.draw_text(0,y,self.width,32,$game_system.sg_no_find)
else
self.contents.draw_text(0,y,self.width,32,SG_NoFind_Default)
end
end
#-----------------
# Gold window
#-----------------
if $sg_found_gold != nil
if SDK.enabled?('Animated Icons')
sprite = Sprite_AnimatedIcon.new(0,y+4, SG_gold_icon, self)
@window_sprites << sprite
else
bitmap = RPG::Cache.icon(SG_gold_icon)
self.contents.blt(0,y+4,bitmap,Rect.new(0,0,24,24))
end
self.contents.draw_text(28,y,self.width,32,$data_system.words.gold)
self.contents.draw_text(28,y,self.width,32,$sg_found_gold,2)
y += 32
end
#-----------------
# window
#-----------------
for j in 0...$sg_found.size
for i in 0...$sg_found[j].size
case j
when 2
if $sg_found[2][i] != nil
self.contents.draw_text(28,y,self.width,32,"#{$sg_found_name[j][i]}(#{$game_party.actors[$sg_found[j][i]].name})")
else
self.contents.draw_text(28,y,self.width,32,"#{$sg_found_name[j][i]}(Alle)")
end
when 0
if SDK.enabled?('Animated Icons')
sprite = Sprite_AnimatedIcon.new(0,y+4, $sg_found[0][i].icon_name, self)
@window_sprites << sprite
else
bitmap = RPG::Cache.icon($sg_found[0][i].icon_name)
self.contents.blt(0,y+4,bitmap,Rect.new(0,0,24,24))
end
end
self.contents.draw_text(28,y,self.width,32,$sg_found_name[j][i]) if j <2
self.contents.draw_text(28,y,self.width-64,32,$sg_found_number[j][i].to_s,2)
y += 32
end
end
end
#-------------------
#taste
#-------------------
def update
if Input.press?(Input::UP)
self.oy -= 4 if self.oy > 0
elsif Input.press?(Input::DOWN)
self.oy += 4 if self.oy < self.contents.height - (self.height - 32)
end
end
end
#--------------------------------------------------------------------------
end