[XP] Disc Changer - If you need more than 999 maps

Started by Zeriab, August 21, 2008, 10:15:34 am

Previous topic - Next topic

Memor-X

*starts singing Wrath of the Twin out loud* i requested this, i never forgot about this, and i've been straining my head trying to figure out how the hell i'm going to complete Black Core or HoM without it, Zeriab, if your a girl, i'd kiss you, if your a guy, i'll get my neice to kiss you (she's two years older then me and most of my friends who've seen her thinks she's hot)

just a few questions, you said that if we had the SDK we're fine, (otherwise replace some of the code in the defult scripts) anyway, since any and all of my games will have a version of the SDK in some way (thanks alot Seph for making an Airship and Map-Title script using 2 differnt SDKs) will this script work find with SDK V 1.x and 2.x

also, you said that there may be a compatibility problem with scripts that reads MapInfos.rxdata and displays the names of each map, does that mean CMS's aswell (mainly Blizzard's CMS)

with this script, i am now much more comfortable in using as many maps as i like in any game i am to make, yay

shdwlink1993

cough... I already had made one in the SFS... and I even... marked you in special thanks... for requesting it... :'(

Oh well, Zeriab's is a lot more practical than mine, and it's probably much better than mine. Power-ups for Zeriab.
Stuff I've made:




"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

Zeriab

Wow... I am energized.  8)
I am glad you like it ^_^
I do remember a discussion back in the day about a disc changer. (I admit I had forgotten until you reminded me)

I believe that the area I use in the SDK is the same in both SDK V 1.x and 2.x
If this is true then you should have no problems using it.

As for Blizzard's CMS. If it reads MapInfos.rxdata then yes. It will only show correctly on disc 0.
I suggest you ask Blizzard where the location is used in his CMS and ask him to use this instead:
load_data(sprintf("Data/%sMapInfos.rxdata", $game_system.disc))


Also note that since the filename alters you can't simply cache it. If that's what Blizzard has done then it'll be slightly more difficult.

You can also try to send your script file to me although asking Blizz will probably be the fastest way.

*hugs*
- Zeriab

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Zeriab

Updated to version 1.05.
You can now use arbitrarily named folders. Just give a string instead of a number when using the change_disc command.
If you are using a number it works just like before.

*hugs*
- Zeriab

Machoo

I don't know if you will be able to receive this as it has been such a long time, I was trying to use this script with a modded version of Blizz ABS, and I'm pretty sure there's a problem within the loading of Map_Data.abs

When I change disc to disc 1, very frequently tiles randomly become unpassable. It must be something to do with the intelligent passibility or the eight dimensional movement script.

I don't know much about ruby, and I am just throwing key words around. Is there any way to work around this?

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ethereal

November 16, 2017, 06:51:58 am #27 Last Edit: November 16, 2017, 06:53:53 am by Ethereal
sorry to reply this old topic, but a i have a problem
when i use the command change_disc(0) this error appear:



am i doing something wrong? because the command change_disc(0) it is not used to return to the original Data?



Can someone please help me...?  :shy: :(

Jaiden

November 16, 2017, 07:52:18 am #28 Last Edit: November 16, 2017, 07:54:30 am by BoisterousHero
It looks like you are not using the arguments correctly. The "id =", etc. are only in the directions to show you what each argument means.

Your script call should look like this:
change_disc(0, 3, 10, 14)


Ethereal

November 16, 2017, 08:04:09 am #29 Last Edit: November 16, 2017, 08:11:26 am by Ethereal
still the same...



i getting this error only when i try to return to the main Data folder

i could make this disc0 folder, but some of my scripts just won't work correctly how they should inside the discs folder

Jaiden

November 16, 2017, 09:58:14 am #30 Last Edit: November 16, 2017, 10:08:24 am by BoisterousHero
As I suspected, it looks like there isn't any code that actually handles what happens when you change to Disk 0, I just tested it in a demo.

I'm not entirely sure if the SDK changes anything, since I didn't use the SDK, just made the Game_Map edit. Adding a condition that handles what happens when the map is set to "0" seemed to work.

Try replacing your script with this and see how it goes:
Quote
#==============================================================================
# ** 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 == 0
    $game_system.disc = "/"
  elsif 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


It looks like using a folder with a regular name is bugged, so I'll take a look at that, too, when I get a moment.

Ethereal

Man, you're genius...Nothing else to say.
Thank you so muuuch, is working perfectly now!!  :O.o: :O.o:

Jaiden

I definitely wouldn't use the word genius...

This fixes the issue with the custom folder name not working properly, in case you decide to use folder names instead of disc folders:
Spoiler: ShowHide
#==============================================================================
# ** 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 == 0
    $game_system.disc = "/"
  elsif number.is_a?(Integer)
    $game_system.disc = "disc#{number}/"
  else
    disc = '/'
    disc += number.to_s 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


Ethereal

Quote from: BoisterousHero on November 16, 2017, 10:32:43 am
This fixes the issue with the custom folder name not working properly, in case you decide to use folder names instead of disc folders:
Spoiler: ShowHide
#==============================================================================
# ** 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 == 0
    $game_system.disc = "/"
  elsif number.is_a?(Integer)
    $game_system.disc = "disc#{number}/"
  else
    disc = '/'
    disc += number.to_s 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


i will definitely take a look, thanks.

Quote from: BoisterousHero on November 16, 2017, 10:32:43 am
I definitely wouldn't use the word genius...


Alright, then you are my hero.  lol