Posts: 66
Threads: 5
Joined: May 2009
MGC Wrote:I wonder if that is a problem with animated autotiles...
Did you add "[A]" in the mode 7 map's name ?
If that's the case, what happens if you remove this parameter ?
Yes I had [NM7][H][A][F][L] attached to the map. When I removed [A] I got this error:
Script 'Neo Mode 7 Part 4' line 57: Runtime Error occurred
LoadLibrary: MGCmode7.dll
Sorry for the mess. Anything to do?
Posts: 151
Threads: 13
Joined: Jun 2009
Quote:Yes I had [NM7][H][A][F][L] attached to the map. When I removed [A] I got this error:
Script 'Neo Mode 7 Part 4' line 57: Runtime Error occurred
LoadLibrary: MGCmode7.dll
So there IS a problem with animated autotiles. I'll check this when I find a little time. For the moment don't add [A] in the maps names.
I got the new error when the .dll is missing. Did you copy the file "MGCmode7.dll" into the root of your project ?
Posts: 66
Threads: 5
Joined: May 2009
Ahh yes. I did that and it did work. However, it is incredibly slow, my character's sprite is all messed up, and I cannot board the vehicles using DerVVulfman's script. I think my map might be too big. Ahh well. Thanks for the look into it. In reality I am just trying to use the map loop feature. Is there anyway to water the script down to get just that. Probably a dumb question, but I can't seem to find a looping script that works well with DerVVulfman's vehicle script. Thanks again.
Posts: 151
Threads: 13
Joined: Jun 2009
Try this script to add looping maps (add [L] in maps names) :
Code: #============================================================================
# Map Looping
# Extracted from Neo Mode 7 script
# MGC
#
# Add [L] in the maps names to define looping maps
#============================================================================
# To access maps names
$data_maps = load_data("Data/MapInfos.rxdata")
#============================================================================
# ** RPG::MapInfo
#============================================================================
class RPG::MapInfo
# defines the map's name as the name without anything within brackets,
# including brackets
def name
return @name.gsub(/\[.*\]/) {""}
end
#--------------------------------------------------------------------------
# the original name with the codes
def fullname
return @name
end
end
#============================================================================
# ** Game_System
#----------------------------------------------------------------------------
# Add attributes to this class
#============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased
alias initialize_mapLooping_game_system initialize
@already_aliased = true
end
#--------------------------------------------------------------------------
# * Attributes
#--------------------------------------------------------------------------
attr_accessor :mapLooping # true : map looping mode
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
initialize_mapLooping_game_system
self.mapLooping = false
end
end
#============================================================================
# ** Game_Map
#----------------------------------------------------------------------------
# Methods modifications to handle map looping
#============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased
alias scroll_down_mapLooping_game_map scroll_down
alias scroll_left_mapLooping_game_map scroll_left
alias scroll_right_mapLooping_game_map scroll_right
alias scroll_up_mapLooping_game_map scroll_up
alias valid_mapLooping_game_map? valid?
alias passable_mapLooping_game_map? passable?
alias old_setup_mapLooping setup
@already_aliased = true
end
#--------------------------------------------------------------------------
# * Scroll Down
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_down(distance)
unless $game_system.mapLooping
scroll_down_mapLooping_game_map(distance)
return
end
@display_y = @display_y + distance
end
#--------------------------------------------------------------------------
# * Scroll Left
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_left(distance)
unless $game_system.mapLooping
scroll_left_mapLooping_game_map(distance)
return
end
@display_x = @display_x - distance
end
#--------------------------------------------------------------------------
# * Scroll Right
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_right(distance)
unless $game_system.mapLooping
scroll_right_mapLooping_game_map(distance)
return
end
@display_x = @display_x + distance
end
#--------------------------------------------------------------------------
# * Scroll Up
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_up(distance)
unless $game_system.mapLooping
scroll_up_mapLooping_game_map(distance)
return
end
@display_y = @display_y - distance
end
#--------------------------------------------------------------------------
# * Determine Valid Coordinates
# x : x-coordinate
# y : y-coordinate
# Allow the hero to go out of the map when map looping
#--------------------------------------------------------------------------
def valid?(x, y)
unless $game_system.mapLooping
return valid_mapLooping_game_map?(x, y)
end
if $game_system.mapLooping then return true end
return (x >= 0 && x < width && y >= 0&& y < height)
end
#--------------------------------------------------------------------------
# * Determine if Passable
# x : x-coordinate
# y : y-coordinate
# d : direction (0,2,4,6,8,10)
# * 0,10 = determine if all directions are impassable
# self_event : Self (If event is determined passable)
#--------------------------------------------------------------------------
def passable?(x, y, d, self_event = nil)
unless $game_system.mapLooping
return passable_mapLooping_game_map?(x, y, d, self_event)
end
unless valid?(x, y)
return false
end
bit = (1 << (d / 2 - 1)) & 0x0f
for event in events.values
if event.tile_id >= 0 and event != self_event and
event.x == x and event.y == y and not event.through
if @passages[event.tile_id] & bit != 0
return false
elsif @passages[event.tile_id] & 0x0f == 0x0f
return false
elsif @priorities[event.tile_id] == 0
return true
end
end
end
for i in [2, 1, 0]
tile_id = data[x % width, y % height, i] # handle map looping
if tile_id == nil
return false
elsif @passages[tile_id] & bit != 0
return false
elsif @passages[tile_id] & 0x0f == 0x0f
return false
elsif @priorities[tile_id] == 0
return true
end
end
return true
end
#--------------------------------------------------------------------------
# * Setup
# map_id : map ID
#--------------------------------------------------------------------------
def setup(map_id)
old_setup_mapLooping(map_id)
map_data = $data_maps[$game_map.map_id]
$game_system.mapLooping = map_data.fullname.include?("[L]")
end
end
#============================================================================
# ** Game_Character
#----------------------------------------------------------------------------
# "update" method modifications to handle map looping
#============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased
alias initialize_mapLooping_game_character initialize
alias update_mapLooping_game_character update
@already_aliased = true
end
#--------------------------------------------------------------------------
# * Attributes
#--------------------------------------------------------------------------
attr_accessor :x
attr_accessor :y
attr_accessor :real_x
attr_accessor :real_y
attr_accessor :map_number_x # map's number with X-looping
attr_accessor :map_number_y # map's number with Y-looping
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
initialize_mapLooping_game_character
self.map_number_x = 0
self.map_number_y = 0
end
#--------------------------------------------------------------------------
# * Update : handle map looping
#--------------------------------------------------------------------------
def update
unless $game_system.mapLooping
update_mapLooping_game_character
return
end
# if x-coordinate is out of the map
unless (x.between?(0, $game_map.width - 1))
difference = 128 * x - real_x
if self.is_a?(Game_Player)
# increase or decrease map's number
self.map_number_x += difference / (difference.abs)
end
# x-coordinate is equal to its equivalent in the map
self.x %= $game_map.width
self.real_x = 128 * x - difference
end
# if y-coordinate is out of the map
unless (y.between?(0, $game_map.height - 1))
difference = 128 * y - real_y
if self.is_a?(Game_Player)
# increase or decrease map's number
self.map_number_y += difference / (difference.abs)
end
# y-coordinate is equal to its equivalent in the map
self.y %= $game_map.height
self.real_y = 128 * y - difference
end
update_mapLooping_game_character
end
end
#============================================================================
# ** Game_Player
#============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased
alias center_mapLooping_game_player center
@already_aliased = true
end
#--------------------------------------------------------------------------
# * Always center around the hero if map looping
#--------------------------------------------------------------------------
def center(x, y)
unless $game_system.mapLooping
center_mapLooping_game_player(x, y)
return
end
$game_map.display_x = x * 128 - CENTER_X
$game_map.display_y = y * 128 - CENTER_Y
end
end
#============================================================================
# ** Sprite_Character
#============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased
alias update_mapLooping_sprite_character update
@already_aliased = true
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
update_mapLooping_sprite_character
if $game_system.mapLooping
unless x + computed_right_width >= 0 && x - computed_left_width < 640
self.x %= $game_map.width << 5
end
while y + computed_lower_height < 0
self.y += $game_map.height << 5
self.z += $game_map.height << 5
end
while y - computed_upper_height >= 480
self.y -= $game_map.height << 5
self.z -= $game_map.height << 5
end
end
end
#--------------------------------------------------------------------------
# * Sprite's upper height (doesn't handle rotation)
#--------------------------------------------------------------------------
def computed_upper_height
return (oy * zoom_y).to_i
end
#--------------------------------------------------------------------------
# * Sprite's lower height
#--------------------------------------------------------------------------
def computed_lower_height
return ((src_rect.height - oy) * zoom_y).to_i
end
#--------------------------------------------------------------------------
# * Sprite's left width
#--------------------------------------------------------------------------
def computed_left_width
return (ox * zoom_x).to_i
end
#--------------------------------------------------------------------------
# * Sprite's right width
#--------------------------------------------------------------------------
def computed_right_width
return ((src_rect.width - ox) * zoom_x).to_i
end
end
Posts: 66
Threads: 5
Joined: May 2009
MGC sorry to bother you again but I have one last question about this script. I am using your loop map feature that is working wonderfully with DerVVulfman's vehicle script. However I am also using a CMS that displays the map name in the menu. So I have a [L] attached to my world map, and on the menu screen it comes up as World Map[L]. Is there any way to get rid of this? I see that the script has the function:
class RPG::MapInfo
# defines the map's name as the name without anything within brackets,
# including brackets
def name
return @name.gsub(/\[.*\]/) {""}
end
#--------------------------------------------------------------------------
# the original name with the codes
def fullname
return @name
end
end
which in turn should get the display to get rid of the [L] at the end of the map(I am wrong?), but it doesn't. I have posted the script below everything including my CMS. Any ideas? Thanks.
Habs11
Posts: 151
Threads: 13
Joined: Jun 2009
Could you post your CMS here ?
That's the only way I can solve your compatibility issue.
Posts: 66
Threads: 5
Joined: May 2009
(12-06-2010, 11:57 AM)MGC Wrote: Could you post your CMS here ?
That's the only way I can solve your compatibility issue.
Hey no problem. Sorry I should have done that already. Here it is:
Code: #*********************************************************
#Final Fantasy VII menu setup
#*********************************************************
#To use:
#If you do not want Faces, go to line 94
#and change delete the # of draw_actor_graphic
#and put a # infront of draw_actor_face
#
#Create a new folder in the Characters folder, and call it Faces
#Adding faces: add a 80x80 picture with the same name as the characterset it
#corrosponds with in the Faces folder
#========================================
#�ˇ Window_Base
#--------------------------------------------------------------------------------
# Setting functions for the "Base"
#========================================
class Window_Base < Window
def draw_actor_face_menu(actor, x, y)
face = RPG::Cache.character("Faces/" + actor.character_name, actor.character_hue)
fw = face.width
fh = face.height
src_rect = Rect.new(0, 0, fw, fh)
self.contents.blt(x - fw / 23, y - fh, face, src_rect)
end
end
def draw_actor_battler_graphic(actor, x, y)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#========================================
#�ˇ Game_Map
#--------------------------------------------------------------------------------
# Setting functions for the Map
#========================================
class Game_Map
def name
$map_infos[@map_id]
end
end
#========================================
#�ˇ Window_Title
#--------------------------------------------------------------------------------
# Setting functions for the Title
#========================================
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
#==============================================================================
# �ˇ Window_MenuStatus
#------------------------------------------------------------------------------
# Sets up the Choosing.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 560, 454)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial"
self.contents.font.size = 18
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# Drawing Info on Screen
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 94
y = i * 110
actor = $game_party.actors[i]
draw_actor_face_menu(actor, 12, y + 82) #To get rid of the Face, put a "#" before the draw_ of this line
#draw_actor_graphic(actor, 48, y + 65) #and delete the "#" infront of draw of this line
draw_actor_name(actor, x, y)
draw_actor_level(actor, x + 144, y)
draw_actor_state(actor, x + 280, y )
draw_actor_exp(actor, x+ 144, y + 38)
draw_actor_hp(actor, x, y + 38)
draw_actor_sp(actor, x, y + 58)
end
end
#--------------------------------------------------------------------------
# Update of Cursor
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 110, self.width - 32, 96)
end
end
end
#=======================================#
# �ˇWindow_GameStats #
# written by AcedentProne #
#------------------------------------------------------------------------------#
class Window_GameStats < Window_Base
def initialize
super(0, 0, 160, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial"
self.contents.font.size = 18
refresh
end
def refresh
self.contents.clear
#Drawing gold into separate commas by Dubealex
case $game_party.gold
when 0..9999
gold = $game_party.gold
when 10000..99999
gold = $game_party.gold.to_s
array = gold.split(//)
gold = array[0].to_s+array[1].to_s+","+array[2].to_s+array[3].to_s+array[4].to_s
when 100000..999999
gold = $game_party.gold.to_s
array = gold.split(//)
gold = array[0].to_s+array[1].to_s+array[2].to_s+","+array[3].to_s+array[4].to_s+array[5].to_s
when 1000000..9999999
gold = $game_party.gold.to_s
array = gold.split(//)
gold = array[0].to_s+","+array[1].to_s+array[2].to_s+array[3].to_s+","+array[4].to_s+array[5].to_s+array[6].to_s
end
#Draw Gold
self.contents.font.color = system_color
gold_word = $data_system.words.gold.to_s
cx = contents.text_size(gold_word).width
cx2=contents.text_size(gold.to_s).width
self.contents.draw_text(4, 4, 120-cx-2, 32, gold_word)
self.contents.font.color = normal_color
self.contents.draw_text(124-cx2+1, 4, cx2, 32, gold.to_s, 2)
self.contents.font.color = system_color
# Draw "Time"
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, -10, 120, 32, text, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, -10, 120, 32, "Time")
end
#--------------------------------------------------------------------------
# Update of The count
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# �ˇ Window_Mapname
#------------------------------------------------------------------------------
# �@Draws the Map name
#==============================================================================
class Window_Mapname < Window_Base
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 360, 45)
self.contents = Bitmap.new(width - 60, height - 30)
self.contents.font.name = "Arial"
self.contents.font.size = 18
refresh
end
#--------------------------------------------------------------------------
# Draws info on screen
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# Map Name
#map = $game_map.name
self.contents.font.color = system_color
self.contents.draw_text(+1, -10, 220, 32, "")
self.contents.font.color = normal_color
self.contents.draw_text(60, -10, 220, 32, $game_map.name)
end
end
#==============================================================================
# �ˇ Scene_Menu
#------------------------------------------------------------------------------
# FF7 menu layout as requested by AcedentProne.
#==============================================================================
class Scene_Menu
#--------------------------- edit-------------------------------
attr_reader :status_window
#/--------------------------- edit-------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Save"
s6 = "Quit"
#--------------------------- edit-------------------------------
# Command menu
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6,])
@command_window.x = 640 - @command_window.width
@command_window.y = 480
@command_window.z = 110
@command_window.index = @menu_index
#If certain options are avaliable
if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
if $game_system.save_disabled
@command_window.disable_item(4)
end
#Showing location window
@map = Window_Mapname.new
@map.x = 640 - @map.width
@map.y = 0 - @map.height - 1
@map.z = 110
#Showing the game stats
@game_stats_window = Window_GameStats.new
@game_stats_window.x = 0 - @game_stats_window.width
@game_stats_window.y = 480 - @map.height - @game_stats_window.height
@game_stats_window.z =110
#Showing the Menu Status window
@status_window = Window_MenuStatus.new
@status_window.x = 640
@status_window.y = 8
@status_window.z = 100
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@game_stats_window.dispose
@status_window.dispose
@map.dispose
end
#--------------------------------------------------------------------------
#Defining the delay
#--------------------------------------------------------------------------
def delay(seconds)
for i in 0...(seconds * 1)
sleep 0.01
Graphics.update
end
end
#--------------------------------------------------------------------------
# Updating
#--------------------------------------------------------------------------
def update
@command_window.update
@game_stats_window.update
@status_window.update
@map.update
#Moving Windows inplace
gamepos = 640 - @game_stats_window.width
mappos = 480 - @map.height - 1
if @command_window.y > 0
@command_window.y -= 60
end
if @game_stats_window.x < gamepos
@game_stats_window.x += 80
end
if @map.y < mappos
@map.y += 80
end
if @status_window.x > 0
@status_window.x -= 80
end
#Saying if options are active
if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# Updating the Command Selection
#--------------------------------------------------------------------------
def update_command
# If B button is pushed
if Input.trigger?(Input::B)
# Plays assigned SE
$game_system.se_play($data_system.cancel_se)
#Looping for moving windows out
loop do
if @command_window.y < 480
@command_window.y += 40
end
if @game_stats_window.x > 0 - @game_stats_window.width
@game_stats_window.x -= 40
end
if @map.y > 0 - @map.height
@map.y -= 40
end
if @status_window.x < 640
@status_window.x += 40
end
delay(0.5)
if @status_window.x >= 640
break
end
end
# Go to Map
$scene = Scene_Map.new
return
end
# If C button is pused
if Input.trigger?(Input::C)
# Checks actor size
if $game_party.actors.size == 0 and @command_window.index < 4
# plays SE
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
loop do
if @command_window.y < 480
@command_window.y += 40
end
if @game_stats_window.x > 0 - @game_stats_window.width
@game_stats_window.x -= 40
end
if @map.y > 0 - @map.height
@map.y -= 40
end
if @status_window.x < 640
@status_window.x += 40
end
delay(0.5)
if @status_window.x >= 640
break
end
end
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
loop do
if @command_window.y < 480
@command_window.y += 40
end
if @game_stats_window.x > 0 - @game_stats_window.width
@game_stats_window.x -= 40
end
if @map.y > 0 - @map.height
@map.y -= 40
end
if @status_window.x < 640
@status_window.x += 40
end
delay(0.5)
if @status_window.x >= 640
break
end
end
$scene = Scene_Save.new
when 5
$game_system.se_play($data_system.decision_se)
loop do
if @command_window.y < 480
@command_window.y += 40
end
if @game_stats_window.x > 0 - @game_stats_window.width
@game_stats_window.x -= 40
end
if @map.y > 0 - @map.height
@map.y -= 40
end
if @status_window.x < 640
@status_window.x += 40
end
delay(0.5)
if @status_window.x >= 640
break
end
end
$scene = Scene_End.new
return
end
end
#--------------------------------------------------------------------------
# Updating Status Screen
#--------------------------------------------------------------------------
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1 # �X�L��
# ���Ě�A�N�^�[�ĚŤs����ŚŔ�Ş 2 �ČŹă�ĚŹęŤ�
if $game_party.actors[@status_window.index].restriction >= 2
# �u�U�[ SE ��t
$game_system.se_play($data_system.buzzer_se)
return
end
# Ś��č SE �đ���t
$game_system.se_play($data_system.decision_se)
# �X�L���ć�Ę�ɐŘ�č�ւ�
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
loop do
if @command_window.y < 480
@command_window.y += 40
end
if @game_stats_window.x > 0 - @game_stats_window.width
@game_stats_window.x -= 40
end
if @map.y > 0 - @map.height
@map.y -= 40
end
if @status_window.x < 640
@status_window.x += 40
end
delay(0.5)
if @status_window.x >= 640
break
end
end
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
loop do
if @command_window.y < 480
@command_window.y += 40
end
if @game_stats_window.x > 0 - @game_stats_window.width
@game_stats_window.x -= 40
end
if @map.y > 0 - @map.height
@map.y -= 40
end
if @status_window.x < 640
@status_window.x += 40
end
delay(0.5)
if @status_window.x >= 640
break
end
end
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
end
Habs11
Posts: 151
Threads: 13
Joined: Jun 2009
You have to paste your CMS below the map looping feature.
In your CMS, the following code :
Code: 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
creates a Hash object named "$map_infos" that stores the maps names (from the database) for their ids. As it is directly written in a class and not in a method, this code is executed when the game is launched (the scripts are read from the top to the bottom).
--> it becomes easy to retrieve a map's name by its id to display it in the menu.
"$map_infos[key]" is an instance of the class "RPG::MapInfo", and "$map_infos[key].name" calls the "def name [...]" method in that class.
If this script is above the map looping script, the names in that Hash are full names, including brackets.
But in the map looping script, the "def name [...]" method in the "RPG::MapInfo" class is rewritten, so that all brackets and their contents are removed :
Code: class RPG::MapInfo
# defines the map's name as the name without anything within brackets,
# including brackets
def name
return @name.gsub(/\[.*\]/) {""}
end
[...]
That's why you need to have this code before the creation of the Hash object, and so paste the CMS below the map looping script.
Posts: 66
Threads: 5
Joined: May 2009
I'm pretty sure I understand why. It would make sense that once the map name is stored from the id it will not be changed unless the class is rewritten first. Thank you, I appreciate all your help!
Habs11
Posts: 5
Threads: 0
Joined: Sep 2011
I will present this as a semi-formal letter, for reasons...?
To MGCaladtogel,
I hope this isn't too horrendous of a necro-post, but I'm currently working out a new way to present maps using this fantastic script and I'd like to ask about the possibility of returning the fixed map function from your original Mode 7 script. I'm not entirely sure how to do so myself, as my knowledge of RGSS is rather limited. I've tried removing the 'center on hero' section in Part 2 of the script, but that has no effect.
The maps will not usually be bigger than the default size with this method, though they may be wider, to allow for walking to the edge of the screen. Would it be possible to create a system where the map is centred, or could be set to centre on a certain tile, and the player moves around it separately (able to walk into the distance and close to the screen) while retaining the zooming capabilities?
I hope it is possible, and not too much trouble, because it would enable me to work on and implement this idea of mine in my project, and future projects. If you or anyone could aid me in these game design endeavors I will be incredibly grateful, and will of course provide full credits and whatnot.
Here's hoping,
Neko.
|