Good evening, everyone.
So, I'm using Falcao's Minimap Set.
In it, there's a function that makes a button (ALT) call this scene.
I would like a snippet on this script that disables this function with a switch. If said switch is on, the minimap scene won't be activated when you press the button or via script call.
The script can be found below.
Thanks in advance.
So, I'm using Falcao's Minimap Set.
In it, there's a function that makes a button (ALT) call this scene.
I would like a snippet on this script that disables this function with a switch. If said switch is on, the minimap scene won't be activated when you press the button or via script call.
The script can be found below.
Thanks in advance.
Ruby:
#===========================================================================#
# #*****************# Minimap Set 1.1 Falcao script, display a set #
# #*** By Falcao ***# of minimaps where the player can teleport, #
# #*****************# event objects can be displayed on minimap #
# RMXP Release date: 25/4/2011 #
# makerpalace.onlinegoo.com Translated date: 28/4/2011 #
#===========================================================================#
#----------------------------------------------------------------------------
# * Main features
#
# - Display a minimap where the player
# - Allow to save minimaps and then teleport
# - Display player location on the minimap
# - Display exact location of events on mainimaps
# - Support a second index called dungeon
# - Allow you to hide your current location wherever you want
# - Easy to use
#----------------------------------------------------------------------------
# * Instructions
#
# Copy and paste the script above main.
#
# Press 'ALT' button to call the script, but it can be called manually using
# the following command: $scene = Teletrans.new
#
# - To save or remove maps from the map list use the followings commands
#
# $game_map.savemap(X) Add map id 'X' to the map list (Saved Maps)
# Example: $game_map.savemap(1) add map id 1
#
#
# $game_map.remove_map(X) Remove map 'X' form the list (Saved Maps)
# Example: $game_map.remove_map(1) remove map id 1
#
# Coodenates are added automatically, but it can be added manually using the
# following command:
#
# $game_map.savemap(id,x,y) id = map id
# x = map x y = map y
#----------------------------------------------------------------------------
#
# - To add or clear maps form the dungeon map set use the followings commands
#
# $game_map.dungeon(X) Add map id 'X' to the dungeon list
# Example: $game_map.dungeon(1) add map 1 as dungeon
#
# $game_map.dungeon_clear Clear dungeon map set
#----------------------------------------------------------------------------
#
# $game_map.hide_player Hide player location on the minimap
# $game_map.display_player Show player location on the minimap
#
# $game_map.hide_minimap(value) Hide current minimap, so you cannot see where
# you are, change value for true or false
# Example: $game_map.hide_minimap(true)
#----------------------------------------------------------------------------
#
# * Type the following commads on the 'Comment' from the events commands
# Allows you to displays events on minimaps such as chests, bosses, npc etc.
#
# EVENT_POINT Display a point icon on minimap
# EVENT_CHEST Display a chest icon on minimap
# EVENT_BOSS Display a boss icon on minimap
# EVENT_TELEPORT Display a teleport icon on minimap
# EVENT_NPC Display a npc icon on minimap
#---------------------------------------------------------------------------
#
# License: This script is for non-comercial games, for comercial games please
# contact me.
#---------------------------------------------------------------------------
module Faltrans
# Each map descriptions
# A = Map id B = Description (A=>B)
MapDescription = {
1=> 'Lugar de recreacion donde los usuarios de Maker Palace descansan',
2=> 'Espeso bosque donde los mas probable es perderse xd',
3=> 'Caverna con muchas sorpresas lo mejor es tener una linterna',
5=> 'Lugar donde Falcao descansa en paz y se inspira',
4=> 'Kysis Dungeon salon prinsipal',
6=> 'Kysis Dungeon salon acuatico',
7=> 'Kysis Dungeon trono del Rey Falcao',
}
# Script call button
Call_Script = Input::ALT
# Disable script call by the button
Disable_Trans_call = false
# Transition
Transition = "015-Diamond01"
# Font for the script
FalFont = "Georgia"
# Icons
Point = "047-Skill04"
Chest = "034-Item03"
Boss = "046-Skill03"
Teleport = "035-Item04"
Npc = "011-Head02"
# Vacabulary
Vocab_Title = "Map list"
Saved = "Saved Maps"
Dungeon = "Dungeon Maps"
#Icons vocabulary
Vocab_Point = "Key Point"
Vocab_Chest = "Chest"
Vocab_Boss = "Boss"
Vocab_Teleport = "Teleport"
Vocab_Npc = "Npc"
end
#-----------------------------------------------------------------------
# * Game map
#-----------------------------------------------------------------------
class Game_Map
attr_accessor :falmap_data
attr_accessor :falmap_added
attr_accessor :falhide
attr_accessor :mess_var
attr_accessor :read_index
attr_reader :hideminimap
alias falcaominimapset_ini initialize
def initialize
@falmap_data = {}
@falmap_added = []
@falhide = false
@read_index = 0
@mess_var = [tranfer = false, time = 0, [], []]
@falcmap = load_data("Data/MapInfos.rxdata")
@faldelay = 0
@hideminimap = false
falcaominimapset_ini
end
alias falcaoset_fade_setup setup
def setup(map_id)
falcaoset_fade_setup(map_id)
if @mess_var[0]
$game_screen.start_tone_change($falcao_tone_rescue, 15)
@mess_var[1] = 16
end
end
def savemap(id, x=$game_player.x, y=$game_player.y)
unless @falmap_data.has_key?(id)
@falmap_data[id] = [load_data(sprintf("Data/Map%03d.rxdata", id)),
@falcmap[id].name, id, x, y] rescue ala_mierda(id)
@falmap_added.push(id) unless $from_falmenu
end
end
def remove_map(id)
if @falmap_data.has_key?(id)
@falmap_data.delete(id)
end
end
def dungeon(id)
unless @mess_var[2].include?(id)
@mess_var[2].push(id)
end
end
def dungeon_clear
return @mess_var[2] = []
end
def ala_mierda(id)
p "Falcao script error: Map id #{id.to_s} has not been created"
$scene = nil
end
def hide_player
player_manager(true)
end
def display_player
player_manager(false)
end
def player_manager(value)
@falhide = value
$game_player.refresh
end
def hide_minimap(value)
@hideminimap = value
$game_player.refresh
end
def delaytime(time)
loop do
Graphics.freeze
@faldelay += 1
if @faldelay == time
@faldelay = 0
Graphics.transition
break
end
end
end
end
#-----------------------------------------------------------------------
# * Minimap display
#-----------------------------------------------------------------------
class MapDisplay
attr_reader :map
attr_reader :panorama
def initialize
@panorama = Sprite.new
@panorama.bitmap = RPG::Cache.panorama($game_map.panorama_name,
$game_map.panorama_hue)
@panorama.x = 192
@panorama.y = 68
@panorama.zoom_x = 0.94
@panorama.zoom_y = 0.684
@map_width = 448
@map_height = 328
@map = Sprite.new
@map.bitmap = Bitmap.new(width, height)
@map.x = 191
@map.y = 68
end
def dispose
@map.bitmap.dispose
@map.dispose
@panorama.dispose
@panorama.bitmap.dispose
end
def width
return @map_width
end
def height
return @map_height
end
def refresh(showmap)
if Input.press?(Input::UP) or Input.press?(Input::DOWN) or
Input.press?(Input::RIGHT) or Input.press?(Input::LEFT)
@map.bitmap.clear
end
tileset = $data_tilesets[showmap.tileset_id]
if $game_map.read_index != $game_map.map_id
@panorama.bitmap = RPG::Cache.panorama(tileset.panorama_name,
tileset.panorama_hue)
else
@panorama.bitmap = RPG::Cache.panorama($game_map.panorama_name,
$game_map.panorama_hue)
end
bitmap = Bitmap.new(showmap.width * 32, showmap.height * 32)
for i in 0...(showmap.width * showmap.height)
x = i % showmap.width
y = i / showmap.width
for level in 0...3
tile_id = showmap.data[x, y, level]
if tile_id >= 384
tileset_bitmap = RPG::Cache.tile(tileset.tileset_name, tile_id, 0)
src_rect = Rect.new(0, 0, 32, 32)
bitmap.blt(x * 32, y * 32, tileset_bitmap, src_rect)
end
if tile_id >= 48 and tile_id < 384
id = tile_id / 48 - 1
tileset_bitmap = RPG::Cache.autotile(tileset.autotile_names[id])
src_rect = Rect.new(32, 64, 32, 32)
bitmap.blt(x * 32, y * 32, tileset_bitmap, src_rect)
end
end
end
d_rect = Rect.new(0, 0, width, height)
s_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
@map.bitmap.stretch_blt(d_rect, bitmap, s_rect)
bitmap.clear
bitmap.dispose
end
end
#-----------------------------------------------------------------------
# * Window icons
#-----------------------------------------------------------------------
class Window_KeyIcons < Window_Base
include Faltrans
def initialize
super(0, 315, 190, 165)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
draw_icons(Point, 0, 0)
draw_icons(Chest, 0, 28)
draw_icons(Boss, 0, 54)
draw_icons(Teleport, 0, 79)
draw_icons(Npc, 0, 105)
self.contents.draw_text(35, 0, self.width, 32, Vocab_Point)
self.contents.draw_text(35, 27, self.width, 32, Vocab_Chest)
self.contents.draw_text(35, 52, self.width, 32, Vocab_Boss)
self.contents.draw_text(35, 78, self.width, 32, Vocab_Teleport)
self.contents.draw_text(35, 103, self.width, 32, Vocab_Npc)
end
def draw_icons(name, x, y)
src_rect = Rect.new(0, 0, 24, 24)
icon = RPG::Cache.icon(name)
self.contents.blt(x , y,icon, src_rect)
end
end
#-----------------------------------------------------------------------
# * Indice de mapas
#-----------------------------------------------------------------------
class Map_Indice < Window_Selectable
def initialize(x=0,y=0, act = false)
super(x, y, 190, 226)
@column_max = 1
@action = act
$from_falmenu = true
refresh
self.index = 0
end
def map
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
#---
if @action
data_save = $game_map.falmap_data
$game_map.falmap_data = {}
for d in $game_map.mess_var[2]
$game_map.savemap(d)
end
for i in $game_map.falmap_data.values
@data.push(i)
end
$game_map.falmap_data = data_save
else
$game_map.savemap($game_map.map_id)
for i in $game_map.falmap_data.values
@data.push(i)
end
end
if not @action
for c in @data
if c[2] == $game_map.map_id
@data.delete(c)
temp = @data[0]
@data[0] = c
end
end
@data.push(temp) unless $game_map.falmap_added.empty? or temp.nil?
end
#----
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
map_name = @data[index]
x, y = 4, index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
if contents.text_size(map_name[1]).width > self.width - 12
letters = map_name[1].scan(/./)
map_name[1] = ""
for i in letters
text_size = contents.text_size(map_name[1]).width
break if text_size > self.width - 55
map_name[1] += i
end
map_name[1] += "..."
end
if not @action
index > 0 ? self.contents.font.color = normal_color :
self.contents.font.color = Color.new(128, 255, 128, 255)
end
self.contents.draw_text(x, y, self.width, 32, map_name[1])
end
end
#-----------------------------------------------------------------------
# * Each map description
#-----------------------------------------------------------------------
class Falmap_info < Window_Base
include Faltrans
def initialize
super(189, 400, 451, 80)
self.contents = Bitmap.new(width - 32, height - 32)
@tiempo = 0
@scroll = 0
end
def clear_data(cont=false)
@tiempo = 0
@scroll = 0
self.contents.clear if cont
end
def refresh(map_id)
self.contents.clear
draw_description(map_id)
end
def draw_description(map_id)
if MapDescription.has_key?(map_id)
MapDescription.each do |id, value|
if id == map_id
cx = contents.text_size(value).width
scroll_text(value)
self.contents.draw_text(@scroll, -4, cx + 10, 32 , value)
end
end
else
text = "
Descripcion no disponible
Falcao Script Minimap Teletransport v 1.1"
scroll_text(text,false)
cx = contents.text_size(text).width
self.contents.draw_text(@scroll, -4, cx + 10, 32, text)
end
end
def scroll_text(texto, result_ok=true)
cx = contents.text_size(texto).width
if cx > self.width - 25
@tiempo += 1
if @tiempo > 60
@scroll -= 1 if @result == nil
if @scroll == -cx
@result = true
end
end
end
if @result
result_ok ? @scroll += 10 : @scroll = 0
if @scroll >= 0
@scroll = 0; @tiempo = 0
@result = nil
end
end
if Input.press?(Input::UP) or Input.press?(Input::DOWN)
@scroll = 0; @tiempo = 0; @result = nil
end
end
end
#-----------------------------------------------------------------------
# * Extra windows
#-----------------------------------------------------------------------
class Extra_Info < Window_Base
include Faltrans
def initialize(x=0, y=0, w=190, h=91)
super(x, y, w, h)
self.contents = Bitmap.new(width - 32, height - 32)
end
def draw_title_contents(action="Current location")
self.contents.clear
self.contents.draw_text(0, 0, self.width, 32, Vocab_Title)
self.contents.draw_text(0, 30, self.width, 32, action)
end
def draw_texto(map_name)
self.contents.clear
self.contents.draw_text(0, 0, self.width, 32,
"Teletrasportarse a #{map_name}?")
end
def draw_nodata
self.contents.clear
self.opacity = 0
self.z = 500
self.contents.fill_rect(0, 0, 448, 328, Color.new(0, 0, 0, 255))
self.contents.font.size = 30
self.contents.draw_text(-12, 120, self.width, 32, "No data", 1)
end
end
#-----------------------------------------------------------------------
# * Seleccion inicial
#-----------------------------------------------------------------------
class Ini_Selection < Window_Selectable
def initialize(x=0,y=0)
super(x, y, 451, 64)
@column_max = 2
refresh
self.index = 0
end
def ini_index
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
ini = [Faltrans::Saved, Faltrans::Dungeon]
for i in ini
@data.push(i)
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
name = @data[index]
x = 4 + index % 2 * (237 - 9)
y = 0
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.draw_text(x, y, self.width, 32, name)
end
end
#-----------------------------------------------------------------------
# * Scene Teletrans
#-----------------------------------------------------------------------
class Teletrans
include Faltrans
def initialize
$falcao_tone_rescue = $game_screen.tone
$game_screen.start_tone_change(Tone.new(-255, -255, -255, 0), 0)
end
def main
@viewport1 = Viewport.new(191, 68, 448, 328)
@viewport1.z = 200
@indice_map = Map_Indice.new(0, 90)
@key_sprites = []
@time_count = 0
@temp_data = []
@keyicon_window = Window_KeyIcons.new
@dungeon_indice = Map_Indice.new(0, 90, true)
@dungeon_indice.active = false
@dungeon_indice.visible = false
@nodata = Extra_Info.new(175, 52, 481, 360)
@nodata.draw_nodata
$game_map.hideminimap ? @nodata.visible = true : @nodata.visible = false
@display_map = MapDisplay.new
@info_map = Falmap_info.new
@title = Extra_Info.new
@sprite =Sprite_Pos.new(@viewport1,@indice_map.map[0],$game_party.actors[0])
@title.draw_title_contents
@selection_ini = Ini_Selection.new(189, 0)
@question = Extra_Info.new(0, 0, 330, 64)
@question.visible = false
@question.z = 600
@question.x = 250
@question.y = 137
@command_question = Window_Command.new(330, ["Yes", "No"])
@command_question.active = false
@command_question.visible = false
@command_question.x = 250
@command_question.y = 200
@command_question.z = 600
if !$game_map.falmap_data.empty?
@display_map.refresh(@indice_map.map[0])
@info_map.refresh(@indice_map.map[2])
@sprite.update_direction(@indice_map.map[0])
$game_map.mess_var[3] = @indice_map.map[0]
$game_map.read_index = @indice_map.map[2]
end
draw_icons(@indice_map.map[0], @indice_map.map[2])
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
unless $game_map.falmap_added.include?($game_map.map_id)
$game_map.remove_map($game_map.map_id)
end
@display_map.dispose
@info_map.dispose
@title.dispose
@dungeon_indice.dispose
@nodata.dispose
@selection_ini.dispose
@indice_map.dispose
@viewport1.dispose
@keyicon_window.dispose
@sprite.dispose
@command_question.dispose
@question.dispose
for sprite in @key_sprites
sprite.dispose
end
$from_falmenu = false
if $game_map.mess_var[0]
Graphics.transition(60, "Graphics/Transitions/" + Faltrans::Transition)
else
$game_screen.start_tone_change($falcao_tone_rescue, 0)
end
end
def update
@indice_map.update
@dungeon_indice.update
@sprite.update
@selection_ini.update
@command_question.update if @command_question.active
for sprite in @key_sprites
sprite.update
end
refresh_display
refresh_icons
update_teletrans
if Input.trigger?(Input::B) or
Input.trigger?(Faltrans::Call_Script)
salir
end
end
def refresh_display
return if @command_question.active
case @selection_ini.index
when 0
@dungeon_indice.active = false
@dungeon_indice.visible = false
@indice_map.visible = true
@indice_map.active = true
if $game_map.hideminimap and @indice_map.index == 0
@nodata.visible = true
else
@nodata.visible = false
end
if Input.press?(Input::UP) or Input.press?(Input::DOWN) or
Input.press?(Input::RIGHT) or Input.press?(Input::LEFT)
@info_map.clear_data
@indice_map.index > 0 ? @title.draw_title_contents("Saved maps") :
@title.draw_title_contents
if !$game_map.falmap_data.empty?
@time_count = 1
@temp_data = [@indice_map.map[0], @indice_map.map[2]]
$game_map.mess_var[3] = @indice_map.map[0]
@display_map.refresh(@indice_map.map[0])
end
end
@info_map.refresh(@indice_map.map[2]) if !$game_map.falmap_data.empty?
$game_map.read_index = @indice_map.map[2]
@sprite.update_direction(@indice_map.map[0])
when 1
@indice_map.active = false
@indice_map.visible = false
@dungeon_indice.active = true
@dungeon_indice.visible = true
if Input.press?(Input::UP) or Input.press?(Input::DOWN) or
Input.press?(Input::RIGHT) or Input.press?(Input::LEFT)
@info_map.clear_data
@title.draw_title_contents("Dungeon set")
if $game_map.mess_var[2].empty?
@nodata.visible = true
@info_map.clear_data(true)
else
@nodata.visible = false
end
if !$game_map.falmap_data.empty? and !$game_map.mess_var[2].empty?
@time_count = 1
@temp_data = [@dungeon_indice.map[0], @dungeon_indice.map[2]]
$game_map.mess_var[3] = @dungeon_indice.map[0]
@display_map.refresh(@dungeon_indice.map[0])
end
end
if !$game_map.falmap_data.empty? and !$game_map.mess_var[2].empty?
@info_map.refresh(@dungeon_indice.map[2])
$game_map.read_index = @dungeon_indice.map[2]
@sprite.update_direction(@dungeon_indice.map[0])
end
end
end
def refresh_icons
if @time_count > 0
@time_count += 1
case @time_count
when 1..3
clear_icons
when 4
draw_icons(@temp_data[0], @temp_data[1])
@time_count = 0
end
end
end
def draw_icons(map, map_id)
@events = {}
for i in map.events.keys
@events[i] = Game_Event.new(map_id, map.events[i])
end
for event in @events.values
next if event.page.nil?
if event.event_point
sprite = Sprite_Keys.new(@viewport1, map, Point, event)
@key_sprites.push(sprite)
elsif event.event_chest
sprite = Sprite_Keys.new(@viewport1, map, Chest, event)
@key_sprites.push(sprite)
elsif event.event_boss
sprite = Sprite_Keys.new(@viewport1, map, Boss, event)
@key_sprites.push(sprite)
elsif event.event_teleport
sprite = Sprite_Keys.new(@viewport1, map, Teleport, event)
@key_sprites.push(sprite)
elsif event.event_npc
sprite = Sprite_Keys.new(@viewport1, map, Npc, event)
@key_sprites.push(sprite)
end
end
end
def clear_icons
for sprite in @key_sprites
@key_sprites.delete(sprite)
sprite.dispose
end
end
def update_teletrans
return if @selection_ini.index > 0
return if $game_map.falmap_data.empty?
if Input.trigger?(Input::C) and !@command_question.active
$game_system.se_play($data_system.decision_se)
if @indice_map.map[2] == $game_map.map_id
salir
return
end
@command_question.index = 0
@question.draw_texto(@indice_map.map[1])
@indice_map.active = false
@selection_ini.active = false
@command_question.active = true
@command_question.visible = true
@question.visible = true
$game_map.delaytime(50)
end
if Input.trigger?(Input::C) and @command_question.active
case @command_question.index
when 0
Audio.se_play("Audio/SE/010-System10")
$game_temp.player_transferring = true
$game_temp.player_new_map_id = @indice_map.map[2]
$game_temp.player_new_x = @indice_map.map[3]
$game_temp.player_new_y = @indice_map.map[4]
$game_temp.player_new_direction = 2
$game_temp.transition_processing = true
$game_map.mess_var[0] = true
$scene = Scene_Map.new
$game_map.autoplay
when 1
$game_system.se_play($data_system.cancel_se)
@indice_map.active = true
@selection_ini.active = true
@command_question.active = false
@command_question.visible = false
@question.visible = false
end
end
end
def salir
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
end
#-----------------------------------------------------------------------
# * Scene_Map, update aliased
#-----------------------------------------------------------------------
class Scene_Map
alias falcao_teletrans_call update
def update
if $game_map.mess_var[1] > 0
$game_map.mess_var[1] -= 1
if $game_map.mess_var[1] == 1
$game_map.mess_var[0] = false
$game_map.mess_var[1] = 0
end
end
falcao_teletrans_call
managercall
end
def managercall
return if Faltrans::Disable_Trans_call or
$game_temp.message_window_showing or $game_system.map_interpreter.running?
if Input.trigger?(Faltrans::Call_Script)
$scene = Teletrans.new if !$game_map.mess_var[0]
return
end
end
end
#-----------------------------------------------------------------------
# * Fuente
#-----------------------------------------------------------------------
class Font
alias falcaoBest4_font initialize
def initialize
falcaoBest4_font
if $scene.is_a?(Teletrans)
self.name = Faltrans::FalFont
self.size = 20
end
end
end
#-----------------------------------------------------------------------
# * Sprite que muestra la posision del jugador
#-----------------------------------------------------------------------
class Sprite_Pos < RPG::Sprite
def initialize(viewport, realmap, character = nil)
super(viewport)
@character = character
@sx = 0; @counter = 0
create_bitmap
update_direction(realmap)
update
end
def update
super
return if $game_map.read_index != $game_map.map_id and !self.visible
update_src_rect
end
def create_bitmap
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
self.zoom_x = 0.6
self.zoom_y = 0.6
if $game_map.read_index != $game_map.map_id or $game_map.falhide
self.visible = false
else; self.visible = true; end
end
def update_src_rect
if $game_map.read_index != $game_map.map_id or $game_map.falhide
self.visible = false
else; self.visible = true; end
@counter += 1
case @counter
when 10; @sx = 0 * @cw
when 20; @sx = 1 * @cw
when 30; @sx = 2 * @cw
when 40; @sx = 3 * @cw
@counter = 0
end
self.src_rect.set(@sx, 0, @cw, @ch)
end
def update_direction(realmap)
real_x = $game_player.x * 448 / realmap.width
real_y = $game_player.y * 328 / realmap.height
self.x = real_x + 10
self.y = real_y + 16
self.z = 200
end
end
#-----------------------------------------------------------------------
# * Key sprites
#-----------------------------------------------------------------------
class Sprite_Keys < RPG::Sprite
def initialize(viewport, realmap, icon, character = nil)
super(viewport)
@character = character
self.zoom_x = 0.8
self.zoom_y = 0.8
@counter = 0
self.bitmap = RPG::Cache.icon(icon)
update_direction(realmap)
update
end
def update
super
@counter += 1
case @counter
when 1; self.visible = true
when 20; self.visible = false
when 40; @counter = 0
end
end
def update_direction(realmap)
real_x = @character.x * 448 / realmap.width
real_y = @character.y * 328 / realmap.height
self.x = real_x
self.y = real_y
self.z = 200
end
end
#-----------------------------------------------------------------------
# * Game_Event. refresh aliased
#-----------------------------------------------------------------------
class Game_Event < Game_Character
attr_reader :event_point
attr_reader :event_chest
attr_reader :event_boss
attr_reader :event_teleport
attr_reader :event_npc
attr_accessor :page
alias falpoint_refresh refresh
def refresh
@event_point = false
@event_chest = false
@event_boss = false
@event_teleport = false
@event_npc = false
falpoint_refresh
create_falcomments
end
def create_falcomments
return if @page.nil?
for i in @page.list
if i.code == 108 or i.code == 408
if i.parameters[0].upcase[/EVENT_POINT/] != nil
@event_point = true
end
if i.parameters[0].upcase[/EVENT_CHEST/] != nil
@event_chest = true
end
if i.parameters[0].upcase[/EVENT_BOSS/] != nil
@event_boss = true
end
if i.parameters[0].upcase[/EVENT_TELEPORT/] != nil
@event_teleport = true
end
if i.parameters[0].upcase[/EVENT_NPC/] != nil
@event_npc = true
end
end
end
end
end
#-----------------------------------------------------------------------
# * Game_Character modificacion, alias
#-----------------------------------------------------------------------
class Game_Character
alias fal_moveto moveto
def moveto(x, y)
if $scene.is_a?(Teletrans)
falmoveto(x, y, $game_map.mess_var[3])
return
end
fal_moveto(x, y)
end
def falmoveto(x, y, map)
@x = x % map.width
@y = y % map.height
@real_x = @x * 128
@real_y = @y * 128
end
end