I'm having a problem with Azrith's mouse map system (here: viewtopic.php?f=11&t=76642). I want to add a new location to the map after the location has been visited. Simply visiting the location isn't making any changes to the world map.
Here's the script for reference:
I figured there would be some type of script call or switch I could use once I visit the map, but can't seem to find any D:
Here's the script for reference:
Code:
module LMAP
#Map Graphic Name
Map_Name = "Map/map"
#Cursor Info
Cursor_Name = "Map/selection"
#Max Number of frames in an animation
Frame_Count = 4
#Glowing Selection?(will fade in and out)
Glowing_Selection = true
Locations = []
# Location.push([map_id, tele_x, tele_y, visited?, map_x, Map_y, Map_icon])
Locations.push([38, 19, 79, true, 150, 180, "move_01"])
Locations.push([30, 42, 6, false, 145, 280, "move_05"])
Locations.push([33, 00, 35, false, 290, 360, "move_01"])
Map_Info = {}
#Map_Info[map_id] = "Description"
# adding a \n will cause the text to break to the next line
# This includes The Location Description
Map_Info[38] = ""
Map_Info[30] = ""
Map_Info[33] = ""
end
#==============================================================================
# ** Scene_ViewMap
#------------------------------------------------------------------------------
# This class performs game end screen processing.
#==============================================================================
class Scene_ViewMap
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
@speed = 4
@back = Sprite.new
@back.bitmap = RPG::Cache.picture(LMAP::Map_Name)
# Make command window
@command_window = Window_Help.new
@command_window.x = 0
@command_window.y = 480-@command_window.height
@command_window.opacity = 0
@map_help = Sprite.new
@map_help.bitmap = RPG::Cache.picture("Map/map_help")
@map_help.y = 98
@map_description = Sprite.new
@map_description.bitmap = RPG::Cache.picture("Map/map_info")
@map_description.opacity = 0
@map_desc = Window_Map_Description.new
@map_desc.opacity = 0
@map_desc.visible = false
@map_desc.z = 150
@map_description.z = @map_desc.z - 1
@viewport1 = Viewport.new(0, 0, 640, 480)
@cursor = Map_Cursor.new(@viewport1)
@ico = []
for i in 0...$game_system.locations.size
if $game_system.unlocked?(i) == true
@ico[i] = Sprite.new
@ico[i].bitmap = RPG::Cache.icon("#{$game_system.loc_icon(i)}")
@ico[i].x = $game_system.cord(i, 0)
@ico[i].y = $game_system.cord(i, 1)
if $game_map.get_map == $game_system.map_id(i)
@cursor.x = @ico[i].x-8
@cursor.y = @ico[i].y+4
@cl = Sprite.new
@cl.bitmap = RPG::Cache.picture("Map/current_location")
@cl.x = @ico[i].x
@cl.y = @ico[i].y-24
end
end
end
@index = 0
@snap = false
@float = false
@wait = 0
@ani_index = 0
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame Update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of window
@command_window.dispose
@cursor.dispose
@map_help.dispose
@back.dispose
@map_desc.dispose
@cl.dispose if @cl != nil
@map_description.dispose
for ico in @ico
ico.dispose
end
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
@map_desc.update
@cursor.update
@cl.update if @cl != nil
@map_help.update
@map_description.update
for i in [email=0...@ico.size]0...@ico.size[/email]
if @cursor.x.between?(@ico[i].x-(@cursor.width/2), @ico[i].x+(@cursor.width/2)) and @cursor.y.between?(@ico[i].y-(@cursor.height/2), @ico[i].y+(@cursor.height/2))
@command_window.set_text("#{$game_map.list_name($game_system.map_id(i))}", 1)
if @snap == true
@index = i
@cursor.x = @ico[i].x-8
@cursor.y = @ico[i].y+4
@map_help.opacity += 20
@map_desc.visible = true
@map_description.opacity += 20
@map_desc.x = @cursor.x - @map_desc.width
@map_desc.set_text("#{LMAP::Map_Info[$game_system.map_id(i)]}")
if @cursor.y >= 240
if @map_desc.y <= 480-@map_desc.height
@map_desc.y = @cursor.y - @map_desc.height/2
elsif @map_desc.y > 480-@map_desc.height
@map_desc.y = 480-@map_desc.height
end
else
if @map_desc.y >= 0
@map_desc.y = @cursor.y - @map_desc.height/2
elsif @map_desc.y > 480-@map_desc.height
@map_desc.y = 0
end
end
@map_description.x = @map_desc.x+4
@map_description.y = @map_desc.y-32
end
end
end
if @wait < 5
@wait += 1
else
@float = !@float
@wait = 0
end
if @float == true
@cl.y += 1 if @cl != nil
else
@cl.y -= 1 if @cl != nil
end
if @cursor.y >= 240
@command_window.y = 0
@map_help.y = 98-415
elsif @cursor.y < 240
@command_window.y = 480-@command_window.height
@map_help.y = 98
end
if @snap == false
@command_window.set_text("", 1)
@map_desc.visible = false
end
if @map_desc.visible == false
@map_help.opacity -= 20
@map_description.opacity -= 20
end
if Input.press?(Input::UP) or Input.press?(Input::DOWN) or Input.press?(Input::LEFT) or Input.press?(Input::RIGHT)
@snap = false
else
@snap = true
end
if Input.press?(Input::UP)
if @cursor.y >= 0
@cursor.y -= @speed
else
@cursor.y += 1
end
end
if Input.press?(Input::DOWN)
if @cursor.y <= [email=480-@cursor.height]480-@cursor.height[/email]
@cursor.y += @speed
else
@cursor.y -= 1
end
end
if Input.press?(Input::LEFT)
if @cursor.x >= 0
@cursor.x -= @speed
else
@cursor.x += 1
end
end
if Input.press?(Input::RIGHT)
if @cursor.x <= [email=640-@cursor.width]640-@cursor.width[/email]
@cursor.x += @speed
else
@cursor.x -= 1
end
end
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(5)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
if $game_system.unlocked?(@index) == true
$game_system.se_play($data_system.escape_se)
$game_temp.player_new_map_id = $game_system.map_id(@index)
$game_temp.player_new_x = $game_system.tele_cords(@index)[0]
$game_temp.player_new_y = $game_system.tele_cords(@index)[1]
$game_temp.player_new_direction = 2
$game_temp.player_transferring = true
$game_map.setup($game_temp.player_new_map_id)
# Set up player position
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
# Set player direction
case $game_temp.player_new_direction
when 2 # down
$game_player.turn_down
when 4 # left
$game_player.turn_left
when 6 # right
$game_player.turn_right
when 8 # up
$game_player.turn_up
end
# Straighten player position
$game_player.straighten
$scene = Scene_Map.new
end
return
end
end
end
#==============================================================================
# ** Game_System_EDIT
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :locations
alias map_ini_sys initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
map_ini_sys
@locations = []
for i in 0...LMAP::Locations.size
@locations.push(LMAP::Locations[i])
end
end
def map_id(n)
return @locations[n][0]
end
def add_location(n)
return @locations[n][3] = true
end
def remove_location(n)
return @locations[n][3] = false
end
def cord(n, v)
return @locations[n][4+v]
end
def tele_cords(n)
return [@locations[n][1], @locations[n][2]]
end
def loc_icon(n)
return @locations[n][6]
end
def unlocked?(n)
if @locations[n][3] == true
return true
elsif @locations[n][3] == false
return false
end
end
end
#===================================================
# Game Map Edit
#===================================================
class Game_Map
def name
$map_infos[@map_id]
end
def get_map
return @map_id
end
def list_name(n)
$map_infos[n]
end
end
class Scene_Title
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end
#==============================================================================
# ** Map_Cursor
#------------------------------------------------------------------------------
# This sprite is used to display the cursor for the world map.
#==============================================================================
class Map_Cursor < RPG::Sprite
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Object Initialization
# viewport : viewport
# character : character (Game_Character)
#--------------------------------------------------------------------------
def initialize(viewport)
super(viewport)
@frame = 0
@wait = 0
@frame_count = LMAP::Frame_Count
@glow = false
update
end
def height
return @ch
end
def width
return @cw
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if @wait < 2
@wait += 1
else
@wait = 0
@frame += 1 if @frame < @frame_count
@frame = 0 if @frame >= @frame_count
end
if LMAP::Glowing_Selection == true
if @glow == false
self.opacity -= 5 if self.opacity > 120
@glow = true if self.opacity <= 120
else
self.opacity += 5
@glow = false if self.opacity >= 255
end
end
# Remember tile ID, file name, and hue
self.bitmap = RPG::Cache.picture(LMAP::Cursor_Name)
@cw = bitmap.width / @frame_count
@ch = bitmap.height
self.ox = 0
self.oy = 0
self.src_rect.set(0+@cw*@frame, 0, @cw, @ch)
# Set visible situation
self.visible = true
# Set sprite coordinates
self.z = 120
# Set opacity level, blend method, and bush depth
self.blend_type = 0
self.bush_depth = 0
end
end
#==============================================================================
# ** Window_Map_Description
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Window_Map_Description < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 200, 200)
self.contents = Bitmap.new(width-32, height - 32)
end
#--------------------------------------------------------------------------
# * Set Text
# text : text string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_text(text, align = 0, color = normal_color)
# If at least one part of text and alignment differ from last time
if text != @text or align != @align
# Redraw text
self.contents.clear
self.contents.font.color = color
self.contents.font.size = 15
x = y = 0
@cursor_width = 0
# Indent if choice
if $game_temp.choice_start == 0
x = 8
end
# Control text processing
# Get 1 text character in c (loop until unable to get text)
while ((c = text.slice!(/./m)) != nil)
# If \\
if c == "\000"
# Return to original text
c = "\\"
end
# If new line text
if c == "\n"
# Update cursor width if choice
if y >= $game_temp.choice_start
@cursor_width = [@cursor_width, x].max
end
# Add 1 to y
y += 1
x = 0
# Indent if choice
if y >= $game_temp.choice_start
x = 8
end
# go to next text
next
end
# Draw text
self.contents.draw_text(4 + x, self.contents.font.size * y, 40, self.contents.font.size, c)
# Add x to drawn text width
x += self.contents.text_size(c).width
end
@text = text
@align = align
end
self.visible = true
end
end
I figured there would be some type of script call or switch I could use once I visit the map, but can't seem to find any D: