This script allows you to change discs where each disc can contain 999 maps.
The transitions between each disc works seamlessly just like a normal transfer.
#==============================================================================
# ** Disc Changer script (Designed for Legend of Harpine)
#------------------------------------------------------------------------------
# Zeriab
# 1.05
# 2008-09-20
#------------------------------------------------------------------------------
# Allows you to change the disc, where each disc can contain 999 maps
#==============================================================================
=begin
INSTRUCTIONS
------------
If you do not have the SDK then you have to change Game_Map
In the Game_Map setup method change the load_data line to this: (Line 50)
# Load map from file and set @map
@map = load_data(sprintf("Data/%sMap%03d.rxdata", $game_system.disc, @map_id))
After you have done this the below will work.
This script enables the change_disc command. Use script calls to change the disc.
For disc 1 create a subfolder in your data folder called 'disc1' and place the
map files for disc 1 in there.
For disc 2 you should create a subfolder called 'disc2' and place the map files
for disc 2 in there. And so on for each of your discs.
The syntax is:
change_disc(number, id = nil, x = nil, y = nil, direction = nil)
The nil numbers mean that those arguments are optional. When you don't use them
then they are set to whatever the current map_id, x, y and direction are at the
moment.
If you want to change to disc 2 then you can put this in a script call:
change_disc(2)
You will then be transfered to disc 2 with the same map id and coordinates as
what the player currently has.
If you want to be more precise and say you want to change to disc 2 on the map
with id 10 and the player must be placed at the tile with x = 6 and y = 13 then
you should put this in a call script:
change_disc(2, 10, 6, 13)
Note that when you start the game the maps directly in the data folder is used.
You can back to them by changing to disc number 0.
Basically, disc number 0 is the maps directly in the data folder and not in any
of the sub folders.
The final argument is the direction. By default the player retains the current
direction. You can put 6 different values as direction:
0, 10 : No change
2 : Turn Down
4 : Turn Left
6 : Turn Right
8 : Turn Up
If you for example want to transfer the player to disc 1, map 43 at x = 30 and
y = 4 with the player looking down you should put this in a call script:
change_disc(1, 43, 30, 4, 2)
*hugs*
- Zeriab
=end
class Game_System
attr_writer :disc
def disc
@disc ||= ''
@disc
end
end
class Game_Temp
attr_accessor :disc_changing
end
class Game_Map
attr_writer :map_id
if Module.constants.include?('SDK')
def setup_load
# Load map from file and set @map
@map = load_data(sprintf("Data/%sMap%03d.rxdata", $game_system.disc, @map_id))
end
end
end
def change_disc(number, id = nil, x = nil, y = nil, direction = nil)
# Change disc
if number.is_a?(Integer)
$game_system.disc = "disc#{number}/"
else
disc = number.to_s
disc += '/' unless disc[-1] = 47
$game_system.disc = disc
end
# Process arguments
map_id = id.is_a?(Integer) ? id : $game_map.map_id
x = $game_player.x unless x.is_a?(Integer)
y = $game_player.y unless y.is_a?(Integer)
direction = $game_player.direction unless direction.is_a?(Integer)
# Set transferring player flag
$game_temp.player_transferring = true
# Set transferring player flag
$game_temp.disc_changing = true
# Set player move destination
$game_temp.player_new_map_id = map_id
$game_temp.player_new_x = x
$game_temp.player_new_y = y
$game_temp.player_new_direction = direction
# Change the current map id in case the new and old are identical.
$game_map.map_id = 0
end
Installation
Paste the script just above main.
IF you have the SDK then you are done.
If you do NOT have the SDK:
Find Game_Map in the script editor.
Go to the setup method to around line 50 (assuming the default script)
It should look like this:
Code:
# Load map from file and set @map
@map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
Change the second line so the end result is this:
Code:
# Load map from file and set @map
@map = load_data(sprintf("Data/%sMap%03d.rxdata", $game_system.disc, @map_id))
You have now installed the script.
Instructions
To create a disc you must create a subfolder in the Data folder called Disc1 for disc 1, Disc2 for disc 2 and so on. In general Disc#. (You should be perfectly able to do Disc14 and so on.)
Then put the maps you want in that subfolder.
When you have done this you can use the instructions in the script header for changing the disc. (The script call is the event command on the third page, bottom-right)
Note that disc 0 is special in that it uses the maps directly in the data folder and not Disc0. These are the maps you can see in the editor.
You could have a project for each disc. That way it's easier to change the maps on each disc any time you want. Just copy paste the changes into the main project when you have made the changes.
You can also just copy the other .rxdata files from the main project into the disc project for making sure the rest of the database and scripts are the same in each project.
Version 1.05:
You can now call the change_disc method with a string instead of a number of the disc. In this case the folder with the given name will be used.
Q&A's
None so far
Compatibility
This is probably not compatible with scripts that reads MapInfos.rxdata and displays the names of each map.
You must alter those scripts so it reads the MapInfos.rxdata for the corresponding disc.
You can try to find the place with load_data("Data/MapInfos.rxdata") and change it to this:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version with an additional restriction for commercial projects:
Credits must be given to Zeriab.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser Public License for more details.
I would be delighted if you report any bug, errors or issues you find.
In fact I would be delighted if you took the time and replied even if you have nothing to report.
Suggestions are more than welcome