This script is currently being updated. Don't use it at the moment unless you really want to. There are a few annoying bugs & kinks to work out.
SG Event Icons
Version: 2
Introduction
Allows you to have icons that will be shown on events and follow them around the screen.
Note for wannabe scripters: Don't try to learn from this one!
Screenshots
From alexia testing out an earlier version,
http://i145.photobucket.com/albums/r228 ... sticon.png[/IMG]
More screenshots are a couple posts down.
Features
Instructions
Script goes somewhere above main, under the other default scripts.
Icons are triggered to appear & go away via call scripts. You can either do this by autorun events or during any others.
To make an icon appear:
Puts icon #1 above character 4 at the default position
Puts icon '003-Weapon03' above character 27
Puts icon #1 above character 11 at a new x & y coordinate based on his own. You'll need to play around with the numbers a little.
To get rid of all the icons associated with one event:
Compatibility
Should work with everything, though if you're using other scripts and there's a problem please post a link to it.
Last minute bug report: Breaks old saved games if you decide to switch icons being remembered per map. I'm not going to bother fixing that one unless someone really needs it
Merci Beaucoups
Alexia for requesting a script I actually wanted to make
SG Event Icons
Version: 2
Introduction
Allows you to have icons that will be shown on events and follow them around the screen.
Note for wannabe scripters: Don't try to learn from this one!
Screenshots
From alexia testing out an earlier version,
http://i145.photobucket.com/albums/r228 ... sticon.png[/IMG]
More screenshots are a couple posts down.
Features
- Compatible with almost everything
- Fades in while appearing
- Optional saved settings per map, or reset after changing maps
- Preset optional icon coordinate placement for RTP characters, centered above them
- Shortcuts for often used icons
- Very easy to set up
- Very simple call script per icon
Code:
#==========================================================================
# ** SG Event Icons
#==========================================================================
# sandgolem
# Version 2
# 21.01.07
#==========================================================================
SG_EventIcon_DefaultOpacity = 60
SG_EventIcon_MaxOpacity = 180
SG_EventIcon_FadeInSpeed = 3
SG_EventIcon_MapMemory = true
# Switch this to false to disable the map's icons from being remembered.
SG_EventIcon_Types = {
1 => '001-Weapon01',
2 => '002-Weapon02' }
# These are shortcuts you can use instead of always putting in a file name.
#==========================================================================
#
# To check for updates or find more scripts, visit:
# http://www.gamebaker.com/rmxp/scripts/
#
# Need help? Support topic:
# http://forums.gamebaker.com/showthread.php?t=701
#
#==========================================================================
if Object.const_defined?('SDK')
SDK.log('SG Event Icons', 'sandgolem', 2, '21.01.07')
if SDK.state('SG Event Icons') != true
@sg_eventicons_disabled = true
end
end
if !@sg_eventicons_disabled
#--------------------------------------------------------------------------
class Game_Temp
attr_accessor :sg_eventicon_sprites
def sg_eventicon_dispose
return if !@sg_eventicon_sprites
@sg_eventicon_sprites.each { |i| i.dispose if i != nil }
@sg_eventicon_sprites = []
end
end
class Game_Map
attr_accessor :sg_eventicons
def sg_geteventicons
return @sg_eventicons if !SG_EventIcon_MapMemory
return @sg_eventicons[@map_id]
end
def sg_geteventicons=(new)
if !SG_EventIcon_MapMemory
@sg_eventicons = (new)
else
@sg_eventicons[@map_id] = (new)
end
end
def sg_cleareventicons
for i in 0...@sg_eventicons[@map_id].size
return if @sg_eventicons[@map_id][i] != nil
end
@sg_eventicons[@map_id] = nil
end
alias sandgolem_eventicons_mapsetup setup
def setup(map_id)
if !@sg_eventicons or @map_id != map_id
if !SG_EventIcon_MapMemory
@sg_eventicons = []
else
@sg_eventicons = {} if !@sg_eventicons
sg_cleareventicons if @sg_eventicons[@map_id]
@sg_eventicons[map_id] = [] if !@sg_eventicons[map_id]
end
$game_temp.sg_eventicon_dispose
$game_temp.sg_eventicon_sprites = []
end
sandgolem_eventicons_mapsetup(map_id)
end
def sg_eventicon_opacity(opac = SG_EventIcon_DefaultOpacity)
return if !$game_temp.sg_eventicon_sprites
$game_temp.sg_eventicon_sprites.each { |i| i.opacity = opac if i != nil }
end
def sg_eventicon_show
# Called by the start of Scene_Map, redraws old icons
if !$game_map.sg_geteventicons
$game_map.sg_geteventicons = []
$game_temp.sg_eventicon_sprites = []
end
return if $game_map.sg_geteventicons == []
for i in 0...$game_map.sg_geteventicons.size
z = $game_map.sg_geteventicons[i]
next if z == nil
sg_eventicon(z[0],z[1],z[2],z[3])
end
sg_eventicon_opacity
end
def sg_eventicon(event,type,xoff,yoff)
$game_temp.sg_eventicon_sprites = [] if !$game_temp.sg_eventicon_sprites
icon = SG_EventIcon.new
$game_temp.sg_eventicon_sprites += [icon]
icon.event = @events[event]
icon.xoff = xoff
icon.yoff = yoff
icon.x = @events[event].screen_x + xoff
icon.y = @events[event].screen_y + yoff
icon.bitmap = RPG::Cache.icon(type)
icon.z = 541
icon.opacity = SG_EventIcon_DefaultOpacity
end
end
class Scene_Map
alias sandgolem_eventicons_transfer transfer_player
def transfer_player
$game_map.sg_eventicon_opacity(0)
sandgolem_eventicons_transfer
$game_map.sg_eventicon_show
end
alias sandgolem_eventicons_mapmain main
def main
$game_map.sg_eventicon_show
sandgolem_eventicons_mapmain
$game_temp.sg_eventicon_dispose
end
alias sandgolem_eventicons_mapupdate update
def update
sandgolem_eventicons_mapupdate
$game_temp.sg_eventicon_sprites.each { |i| i.update if i != nil }
end
end
def sg_eventicon(event,type,xoff = -12,yoff = -74)
type = SG_EventIcon_Types[type] if type.is_a?(Numeric)
$game_map.sg_geteventicons += [[event,type,xoff,yoff]]
$game_map.sg_eventicon(event,type,xoff,yoff)
end
def sg_uneventicon(event)
z = $game_map.sg_geteventicons
for i in 0...z.size
if z[i] != nil && z[i][0] == event
z[i] = nil
$game_temp.sg_eventicon_sprites[i].dispose
$game_temp.sg_eventicon_sprites[i] = nil
end
end
z.delete(nil)
$game_temp.sg_eventicon_sprites.delete(nil)
end
class SG_EventIcon < Sprite
attr_accessor :eventid, :event, :xoff, :yoff, :type
def update
if self.opacity < SG_EventIcon_MaxOpacity
self.opacity += SG_EventIcon_FadeInSpeed
end
self.x = @event.screen_x + @xoff
self.y = @event.screen_y + @yoff
end
end
#--------------------------------------------------------------------------
end
Instructions
Script goes somewhere above main, under the other default scripts.
Icons are triggered to appear & go away via call scripts. You can either do this by autorun events or during any others.
To make an icon appear:
Code:
sg_eventicon(4,1)
Code:
sg_eventicon(27,'003-Weapon03')
Code:
sg_eventicon(11,1,-12,-50)
To get rid of all the icons associated with one event:
Code:
sg_uneventicon(9)
Compatibility
Should work with everything, though if you're using other scripts and there's a problem please post a link to it.
Last minute bug report: Breaks old saved games if you decide to switch icons being remembered per map. I'm not going to bother fixing that one unless someone really needs it
Merci Beaucoups
Alexia for requesting a script I actually wanted to make