Maplinks V1.2.1

[QUOTE=Regimos;287880]It's great, but can you provide instructions or something on how to make different map planes? And can you add a function, so you can program maps that you can only enter from one side (say you can enter from the right side, if you go to the top, bottom or left side you can't go to the map to the left of it)?[/QUOTE]

[QUOTE=Regimos;292122]Cool. I have another request, though. Could you make some maps loopable? I don't mean one map, but a whole array of them.. here's a diagram to make it clear.

Maps = X and O
Arrows = Loop here



So if you go left of map O, you would appear at the very right side of the array! This would be a great function to have in my game.[/QUOTE]

Regimos, I'll be sure to implement both features when I have the time.
As for an explanation of multiple map planes, they're indexed by the z-axis of the tables.

First, increase the third value in the size table to equal the number of planes...
    size = [4, 4, n]
Expand to see the code.

where n is the number of planes.

Next add the additional plane to the @maps and @sizes tables...
    ...
    @maps[0,0,p], @maps[1,0,p], @maps[2,0,p], @maps[3,0,p] =  1,  2,  3,  4
    @maps[0,1,p], @maps[1,1,p], @maps[2,1,p], @maps[3,1,p] =  5,  6,  6,  7
    @maps[0,2,p], @maps[1,2,p], @maps[2,2,p], @maps[3,2,p] =  8,  6,  6,  9
    @maps[0,3,p], @maps[1,3,p], @maps[2,3,p], @maps[3,3,p] = 10, 10, 10, 10
    ...
    @sizes[0,0,p], @sizes[1,0,p], @sizes[2,0,p], @sizes[3,0,p] = sm, sm, sm, sm
    @sizes[0,1,p], @sizes[1,1,p],                @sizes[3,1,p] = sm, large,  sm
    @sizes[0,2,p],                               @sizes[3,2,p] = sm,         sm
    @sizes[0,3,p]                                              = long
Expand to see the code.

where p is the z index of the regional plane.

That should do it. Thanks again for your continuing support.
how do i tell which map leads to what T_T :(???
An amazing script, with a very boring demo... Sigh...
Still something many people will find useful (myself included)
Sigh... your saving glitch fix doesn't exactly work.

If you save, go back to the title screen, then continue the game, it works fine.

But if you save, close the window (shut down), reopen the window, continue the game, then try to go to a new screen, it tells you that 0xaa3164 is not id value.

If you could correct this glitch, I'd be very thankful.
[QUOTE=zeroz;294196]how do i tell which map leads to what T_T :(???[/QUOTE]
Check pages 1 and 2 of the thread Zeroz...

[QUOTE=Ninjitsu500;294231]An amazing script, with a very boring demo... Sigh...
Still something many people will find useful (myself included)[/QUOTE]
I agree, it's a very dull demo! ':| Eventually, I'll spruce it up. I have no time to add eye candy at the moment. I'm glad you like the script.

[QUOTE=Regimos;294326]Sigh... your saving glitch fix doesn't exactly work.

If you save, go back to the title screen, then continue the game, it works fine.

But if you save, close the window (shut down), reopen the window, continue the game, then try to go to a new screen, it tells you that 0xaa3164 is not id value.

If you could correct this glitch, I'd be very thankful.[/QUOTE]

Sorry about that, Regimos. At least you're keeping me honest. ^_^ It seems a complete redesign of the underlying classes is in order! This could take a while. In addition, I'm spending the rest of the week on a canoe trip. Needless to say, I won't have a computer...
Yeah, I have a tendency to find annoying glitches :p Anyway, no hurry, just take your time and fix it when you get back.
Ok this script is awesome, its good to fasten up games full of events but still its very complex and hard to understand

if i understand right the first customizable line of the script is to put the number of maps as well but what if u want to create multiple maps with different sizes?

# You can create multiple maplinks planes using the tables’ z-axis
size = [2, 1, 2]

i want to have this lil map but what if i need lots of maps with different sizes? not only 2x1 maps
[QUOTE=busbuzz;296728]

# You can create multiple maplinks planes using the tables? z-axis
size = [2, 1, 2]

i want to have this lil map but what if i need lots of maps with different sizes? not only 2x1 maps[/QUOTE]

[QUOTE=Icarus Featherfight;265072]

# Create map size arrays
sm, long, large = [20, 15], [80, 15], [40, 30]
# Define the size of each map
@sizes = Object_Table.new(*size)
@sizes[0,0,0], @sizes[1,0,0], @sizes[2,0,0], @sizes[3,0,0] = sm, sm, sm, sm
@sizes[0,1,0], @sizes[1,1,0], @sizes[3,1,0] = sm, large, sm
@sizes[0,2,0], @sizes[3,2,0] = sm, sm
@sizes[0,3,0] = long
# Disable access to curtain maps (@disabled[map_id] = true)
@disabled = []
# Fade between maps
@fade = true
# Walk off map before transferring
@leave_map = true
end
[/QUOTE]

For sizes, you define the different shapes/sizes for each map at the beginning... for example:

sm, long = [2, 1], [5, 1]
@sizes = Object_Table.new(*size)
    @sizes[0,0,0], @sizes[1,0,0], @sizes[2,0,0], @sizes[3,0,0] = sm, sm, sm, long
Expand to see the code.


You specify the map sizes before you do the real coding, and in the coding you just put whether you want it to be sm, or long, or whatever you put. You can change/add sizes by just putting them in.
This script is asesome but it needs to have availability for more than only 1 set of map links. eg:

# The Usual
icarus_maplinks_initialize
# Create size array for tables
# You can create multiple maplinks planes using the tables’ z-axis
size = [2, 1, 1]
# Create map layout table for maplinks
@maps = Table.new(*size)
@maps[0,0,0], @maps[1,0,0] = 94, 95
@maps.negitive_read = false
# Create map size arrays
sm, long, large = [20, 15], [80, 15], [40, 30]
# Define the size of each map
@sizes = Object_Table.new(*size)
@sizes[0,0,0], @sizes[1,0,0], @sizes[2,0,0], @sizes[3,0,0] = sm, sm, sm, sm
@sizes[0,1,0], @sizes[1,1,0], @sizes[3,1,0] = sm, large, sm
@sizes[0,2,0], @sizes[3,2,0] = sm, sm
@sizes[0,3,0] = long
# Disable access to curtain maps (@disabled[map_id] = true)
@disabled = []
# Fade between maps
@fade = true
# Walk off map before transfering
@leave_map = true


and then add an option to create another set of map links
# The Usual
icarus_maplinks_initialize
# Create size array for tables
# You can create multiple maplinks planes using the tables’ z-axis
size = [5, 8, 1]
# Create map layout table for maplinks
@maps = Table.new(*size)
@maps[0,0,0], @maps[1,0,0] = 94, 95
@maps.negitive_read = false
# Create map size arrays
sm, long, large = [20, 15], [80, 15], [40, 30]
# Define the size of each map
@sizes = Object_Table.new(*size)
@sizes[0,0,0], @sizes[1,0,0], @sizes[2,0,0], @sizes[3,0,0] = sm, sm, sm, sm
@sizes[0,1,0], @sizes[1,1,0], @sizes[3,1,0] = sm, large, sm
@sizes[0,2,0], @sizes[3,2,0] = sm, sm
@sizes[0,3,0] = long
# Disable access to curtain maps (@disabled[map_id] = true)
@disabled = []
# Fade between maps
@fade = true
# Walk off map before transfering
@leave_map = true

I wish i was an scripter
What do you mean, one set of map links? You can specify z values to create different links...

And use code tags please.
can u give me an example of how to do 2 plz?
[QUOTE=Regimos;294560]Yeah, I have a tendency to find annoying glitches :p Anyway, no hurry, just take your time and fix it when you get back.[/QUOTE]
Well, I'm back! Thanks for holding down the fort Regimos. I'll fix that bug ASAP.

[QUOTE=busbuzz;296728]
...
what if u want to create multiple maps with different sizes?
    size = [2, 1, 2]
Expand to see the code.

i want to have this lil map but what if i need lots of maps with different sizes? not only 2x1 maps[/QUOTE]
The size table should be set up as fallows...
    size = [x, y, z]
Expand to see the code.

where:
x is the largest horizontal (x) gridded size of linked maps in all Maplinks planes
y is the largest vertical (y) gridded size of linked maps in all Maplinks planes
z is the total number of planes

In your example...
[QUOTE=busbuzz;296769]
    size = [2, 1, 1]
    size = [5, 8, 1]
Expand to see the code.

[/QUOTE]
the correct combined setup for the sizes table would be
    size = [5, 8, 2]
Expand to see the code.


[QUOTE=Regimos;297095]What do you mean, one set of map links? You can specify z values to create different links...[/QUOTE]

Exactly. :thumb:

[QUOTE=Icarus Featherfight;292772]As for an explanation of multiple map planes, they're indexed by the z-axis of the tables.

First, increase the third value in the size table to equal the number of planes...
    size = [4, 4, n]
Expand to see the code.

where n is the number of planes.

Next add the additional plane to the @maps and @sizes tables...
    ...
    @maps[0,0,p], @maps[1,0,p], @maps[2,0,p], @maps[3,0,p] =  1,  2,  3,  4
    @maps[0,1,p], @maps[1,1,p], @maps[2,1,p], @maps[3,1,p] =  5,  6,  6,  7
    @maps[0,2,p], @maps[1,2,p], @maps[2,2,p], @maps[3,2,p] =  8,  6,  6,  9
    @maps[0,3,p], @maps[1,3,p], @maps[2,3,p], @maps[3,3,p] = 10, 10, 10, 10
    ...
    @sizes[0,0,p], @sizes[1,0,p], @sizes[2,0,p], @sizes[3,0,p] = sm, sm, sm, sm
    @sizes[0,1,p], @sizes[1,1,p],                @sizes[3,1,p] = sm, large,  sm
    @sizes[0,2,p],                               @sizes[3,2,p] = sm,         sm
    @sizes[0,3,p]                                              = long
Expand to see the code.

where p is the z index of the regional plane.

That should do it.[/QUOTE]
Just define the @maps and @sizes data for each plane one after the other, Busbuzz.
ok can u give me plz an example with my example plz to make it clear is just that i dont get it, can u post the whole example if i want one map 2,1 and another of 8,6

what i dont understan is that ok if the formula is 8,5,2 it means that the code will understand that there are two maps of the size 8,5 so my map of the size 2,1 will have links to maps that doesnt exist, can u please give me a full example?

im sorry for not understanding but its very complicated for me lol, ill get it with an example
[QUOTE=busbuzz;298072]what i dont understan is that ok if the formula is 8,5,2 it means that the code will understand that there are two maps of the size 8,5 so my map of the size 2,1 will have links to maps that doesnt exist, can u please give me a full example?[/QUOTE]
Busbuzz, the table is initialized with nil. Therefore, the script will not link to maps you don't define in the @maps and @sizes tables. This allows you to have maplinked planes that are smaller than the maximum size. Still need a full example?
No, i think ill start trying right away and if i need further help ill write again

Thanx :D

edit: ive been trying and i got an error, it seems the script is looking for the maps that doesnt exist

    size = [8, 8, 2]
    # Create map layout table for maplinks
    @maps = Table.new(*size)
    @maps[0,0,0], @maps[1,0,0], @maps[2,0,0] =  97,  92,  96
    @maps[0,1,0], @maps[1,1,0], @maps[2,1,0] =  97,  98,  99
    @maps.negitive_read = false
    # Create map size arrays
    sm, long, large = [20, 15], [40, 15], [20, 30]
    # Define the size of each map
    @sizes = Object_Table.new(*size)
    @sizes[0,0,0], @sizes[1,0,0], @sizes[2,0,0] = large, sm, sm
    @sizes[1,1,0], @sizes[2,1,0] = sm, sm
Expand to see the code.


the error comes in map 96 and 99 when i try to go east on both and south on 99, map 98 and 87 have a fence so i cant go south but i believe there would be the same error

error says: Script "maplinks" line 165: NoMethodError occurred

undefined method "[]' for nil:NilClass

line 165 is

break if new_x < @sizes[*@maps.coordinates(@maps[*new_grid])][0]
I'm having the same problem
[QUOTE=busbuzz;298144]ive been trying and i got an error, it seems the script is looking for the maps that doesnt exist[/QUOTE]
Shoot, the Table class is initialized with 0 not nil. It's a simple fix. Find line 126 in the demo and replace
    return if new_id.nil?
Expand to see the code.

with
    return if new_id.nil? or new_id == 0
Expand to see the code.

I'll update the demo when I've squashed the other bug as well.
Thanx problem solved ill keep looking for bugs thank u so much
I'm getting some errors after warping
im getting an error after loading a game, it reads:

Script "object_Table" line 38: RangeError Ocurred.

0xb457f8 is recycled object.


line 38 is:

return _id2ref(super + (32_768 * @depth[*args]))
[QUOTE=busbuzz;299440]im getting an error after loading a game...[/QUOTE]
It's a known bug, Busbuzz and I've already fixed it on my end. I'll release version 1.2.0 as soon as I've filled some of Regimos' requests. It won't take long now.
I would like to be tester too, if possible, i find this script amazing
have you the power to not make the Player feel the teleport?
(ala freeland). so the player thing he is of one great map.

is more then one Area Possible?
[QUOTE=hanmac;300505]have you the power to not make the Player feel the teleport?
(ala freeland). so the player thing he is of one great map.

is more then one Area Possible?[/QUOTE]

Freeland? You mean a looping map, where if you exit to the left you appear on the right? There are already scripts on it, but it'd be cool if you could add it to this script.

And what do you mean by more than one area possible...
[QUOTE=hanmac;300505]have you the power to not make the Player feel the teleport?
(ala freeland). so the player thing he is of one great map.

is more then one Area Possible?[/QUOTE]

Sorry Hanmac, I can't create a seamless transition that the player won't perceive. That would require a completely rescipted Game_Map class. You can however, create more than one maplinked area, region, plane etc. Just use a different z value for each plane when defining the @maps and @sizes tables.

[QUOTE=Regimos;300623]Freeland? You mean a looping map, where if you exit to the left you appear on the right? There are already scripts on it, but it'd be cool if you could add it to this script.[/QUOTE]

I'm working on it Regimos. It won't take long now. I've already implemented your other request; disabling maps by direction is now possible.
Ah that's what hanmac meant by freeland, you don't notice the changes. That would require a really complex script so you'd be able to actually see the next map in line and still have scrolling and whatnot.

Anyway, thanks for your additions, hope you get done with the glitch-fixing soon!
Me too ^^ i ant the script so much :D!
To release my demo i just need this script working :| is it gonna take time?
[QUOTE=Regimos;301204]Anyway, thanks for your additions, hope you get done with the glitch-fixing soon![/QUOTE]
[QUOTE=busbuzz;301919]To release my demo i just need this script working :| is it gonna take time?[/QUOTE]

Well, it shouldn't take that long. I'm practically done now. The two new features Regimos requested are both working and I've rebuilt the Object_Table class. All that's left is polishing.
Yay!

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=27205