This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
Code:
#==============================================================================
# â–� World Map
#------------------------------------------------------------------------------
#  Near Fantastica
# 19/12/04
# Note: well not work unless you remove the @spriteset.dispose from the transfer_player of the Scene_Map
# Script use the graphic Characters/cursor which can be found in the demo
#==============================================================================
#==============================================================================
# â–� Game_Map
#------------------------------------------------------------------------------
#  Add defenision of the names to Game Map Class
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# â—? Refer setup to Game Map
#--------------------------------------------------------------------------
attr_accessor :number_events
alias game_map_setup setup
#--------------------------------------------------------------------------
# â—? Loads Event names
#--------------------------------------------------------------------------
def setup(map_id)
@name = {}
@number_events = 0
game_map_setup(map_id)
for i in @map.events.keys
@number_events = @number_events + 1
@name[i] = @map.events[i].name
end
end
#--------------------------------------------------------------------------
# â—? Displays Event names
#--------------------------------------------------------------------------
def event_name(event)
@event_id = event
@name[@event_id]
end
#--------------------------------------------------------------------------
# â—? Loads Map Names
#--------------------------------------------------------------------------
#Dubealex Addition (from XRXS) to show Map Name on screen
def map_name
$map_infos[@map_id]
end
end
#==============================================================================
# â–� Scene_Title
#------------------------------------------------------------------------------
#  Add load map names and event names
#==============================================================================
class Scene_Title
# active world map to false
$world_map_active = false
#Dubealex Addition (from XRXS) to show Map Name on screen
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end
#==============================================================================
# â–� Game_Character
#------------------------------------------------------------------------------
#  Redefine the character_name to attr_accessor
#==============================================================================
class Game_Character
attr_accessor :character_name
end
#==============================================================================
# â–� World_Map
#------------------------------------------------------------------------------
#  Find players curent location on maps and displays it to world map
#==============================================================================
class World_Map
#--------------------------------------------------------------------------
# â—? Object initialization
#--------------------------------------------------------------------------
def initialize
$last_map_name = $game_map.map_name
$restore_map_id = $game_map.map_id
$restore_player_x = $game_player.x
$restore_player_y = $game_player.y
$restore_player_direction = $game_player.direction
$game_player.transparent = true
$game_map.setup(1)
for i in 1...($game_map.number_events+1)
if $game_map.event_name(i) == $last_map_name
$game_map.events[i].character_name = "cursor"
x = $game_map.events[i].x
y = $game_map.events[i].y
$game_temp.player_new_x = x
$game_temp.player_new_y = y
$game_temp.player_new_map_id = 1
$game_temp.player_transferring = true
$scene = Scene_World_Map.new
$scene.transfer_player
end
end
end
end
#==============================================================================
# â–� Window_Location
#------------------------------------------------------------------------------
#  display curcent loaction
#==============================================================================
class Window_Location < Window_Base
#--------------------------------------------------------------------------
# â—? Object initialization
#--------------------------------------------------------------------------
def initialize
super(10, 10, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Number of Steps" window font
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# â—? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Location")
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $last_map_name.to_s, 2)
end
end
#==============================================================================
# â–� Scene_World_Map
#------------------------------------------------------------------------------
#  It is the class which processes the World Map picture
#==============================================================================
class Scene_World_Map
#--------------------------------------------------------------------------
# â—? Main processing
#--------------------------------------------------------------------------
def main
# Drawing up sprite set
@spriteset = Spriteset_Map.new
# Drawing up loaction window
@location_window = Window_Location.new
@location_window.opacity = 125
# Transition execution
Graphics.transition
# Main loop
loop do
# Renewing the game picture
Graphics.update
# Updating the information of input
Input.update
# Frame renewal
update
# When the picture changes, discontinuing the loop
if $scene != self
break
end
end
# Transition preparation
Graphics.freeze
# スプライトセットを解放
@spriteset.dispose
# Releasing the location window
@location_window.dispose
# When it changes to the title picture and it is in
if $scene.is_a?(Scene_Title)
# Fading out picture
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# â—? Frame renewal
#--------------------------------------------------------------------------
def update
# Loop
loop do
#The map, in order of the interpreter and the prayer renewal (as for this renewal order,
#when the condition for executing the event is satisfied, in the reason such that the opportunity
#which instant is moved in the prayer is not given the importance)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# The system (the timer), renewing the picture
$game_system.update
$game_screen.update
# If it is not the place on the move of the prayer, discontinuing the loop
unless $game_temp.player_transferring
break
end
# Executing place movement
transfer_player
# When it is in the midst of transition processing, discontinuing the loop
if $game_temp.transition_processing
break
end
end
# Renewing sprite set
@spriteset.update
# When it is in the midst of transition processing,
if $game_temp.transition_processing
#During transition processing clearing the flag
$game_temp.transition_processing = false
#Transition execution
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# The B when button is pushed
if Input.trigger?(Input::B)
$world_map_active = false
$game_temp.player_new_map_id = $restore_map_id
$game_temp.player_new_x = $restore_player_x
$game_temp.player_new_y = $restore_player_y
$game_temp.player_new_direction = $restore_player_direction
$game_temp.player_transferring = true
$scene = Scene_Map.new
$scene.transfer_player
$game_player.transparent = false
end
end
#--------------------------------------------------------------------------
# â—? Place movement of player
#--------------------------------------------------------------------------
def transfer_player
# Clearing the prayer place portable flag
$game_temp.player_transferring = false
# When the tip of moving differs from the present map,
if $game_map.map_id != $game_temp.player_new_map_id
# Setting up the new map
$game_map.setup($game_temp.player_new_map_id)
end
# Setting the position of the prayer
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
# Setting the direction of the prayer
case $game_temp.player_new_direction
when 2 # 2
$game_player.turn_down
when 4 # 4
$game_player.turn_left
when 6 # 6
$game_player.turn_right
when 8 # 8
$game_player.turn_up
end
# Reforming the attitude of the prayer
$game_player.straighten
# Map renewal (parallel event execution)
$game_map.update
# Rewriting sprite set
@spriteset = Spriteset_Map.new
# When it is in the midst of transition processing,
if $game_temp.transition_processing
# During transition processing clearing the flag
$game_temp.transition_processing = false
# Transition execution
Graphics.transition(20)
end
# Executing the automatic operation change of BGM and BGS which are set to the map
$game_map.autoplay
# Frame reset
Graphics.frame_reset
# Updating the information of input
Input.update
end
end