RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Disc Changer - If 999 maps are not enough

0 Members and 1 Guest are viewing this topic.

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Disc Changer
Version: 1.0

Introduction

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.

Demo

http://zeriab.plesk3.freepgs.com/root/scripts/ChangeDisc.rar

Script
Code: [Select]
#==============================================================================
# ** Disc Changer script (Designed for Legend of Harpine)
#------------------------------------------------------------------------------
# Zeriab
# 1.0
# 2008-08-19
#------------------------------------------------------------------------------
# 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 == 0
    $game_system.disc = ''
  else
    $game_system.disc = "disc#{number}/"
  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: [Select]
    # 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: [Select]
  # 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.

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:
Code: [Select]
load_data(sprintf("Data/%sMapInfos.rxdata", $game_system.disc))

Credits and Thanks

Thanks goes to Legend of Harpine for which this was originally designed.
Credits goes to Zeriab for writing the script.

I would like to thank everyone using their time to try and use my system.
I would like to thank everyone reading this topic.
Thanks.

Terms and Conditions
Spoiler for License:
Copyright (C) 2008  Zeriab

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.

For the full license see <http://www.gnu.org/licenses/>
The GNU General Public License: http://www.gnu.org/licenses/gpl.txt
The GNU Lesser General Public License: http://www.gnu.org/licenses/lgpl.txt

Author's Notes

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

And finally: ENJOY!

 - Zeriab

**
Rep:
Level 85
The Final Chapter
Awesome script! I just hope my game is long enough so I need it!  ;D