Zeno Posted June 10, 2013 Author Share Posted June 10, 2013 Hello. This is all **server-side**.This is a short tutorial on how to make a set of maps on a grid such that they are already linked to walk between them. This does not change anything else. This is purely for convenience … and I know I'm way less likely to screw up a grid if it's done in the beginning for me!This code is intended to be injected into a fresh project, run, and then the code removed. You could leave the code in; however, it makes saving maps slightly less efficient and would overwrite any changes to the internal grid links.You can use this in a started project. The risk is that it may place inappropriate maps, such as indoor or test maps, onto your grid. You can correct this by renaming the innappropriate map in your maps folder to map#.dat where the # is any unused map number past (grid side length)^2\. Then, make a new map and either boot up and and shut down the server (with the code injected), or go into your map editor and adjust the values manually (after the code has been removed). Note that you will also have to update any warp tiles, events, map links, etc. involving the old map to its new map index.To begin with, add this line in your modConstants:```Public Const MAX_WORLDSIDELENGTH As Long = 5```Change the number 5 to be whatever you'd like the maximum width and height of your grid to be. I used five because it was a small number for testing. A way to find this out is to think how many maps you'd like to have on your main field (e.g., 100, 200, 400) and taking a nearby square root (e.g, 10, 14, 20).Search your source for the following in SaveMap:``` Put #F, , Map(mapnum).Up Put #F, , Map(mapnum).Down Put #F, , Map(mapnum).Left Put #F, , Map(mapnum).Right```And replace it with: >! ``` If mapnum <= (MAX_WORLDSIDELENGTH * MAX_WORLDSIDELENGTH) Then Select Case (mapnum Mod MAX_WORLDSIDELENGTH) Case 0 'right side If mapnum < MAX_WORLDSIDELENGTH + 1 Then Put #F, , Map(mapnum).Up Put #F, , mapnum + MAX_WORLDSIDELENGTH ' Map(mapnum).Down Put #F, , mapnum - 1 'Map(mapnum).Left Put #F, , Map(mapnum).Right ElseIf mapnum > ((MAX_WORLDSIDELENGTH * MAX_WORLDSIDELENGTH) - MAX_WORLDSIDELENGTH) Then Put #F, , mapnum - MAX_WORLDSIDELENGTH 'Map(mapnum).Up Put #F, , Map(mapnum).Down Put #F, , mapnum - 1 'Map(mapnum).Left Put #F, , Map(mapnum).Right Else: Put #F, , mapnum - MAX_WORLDSIDELENGTH 'Map(mapnum).Up Put #F, , mapnum + MAX_WORLDSIDELENGTH ' Map(mapnum).Down Put #F, , mapnum - 1 'Map(mapnum).Left Put #F, , Map(mapnum).Right End If Case 1 ' left side If mapnum < MAX_WORLDSIDELENGTH + 1 Then Put #F, , Map(mapnum).Up Put #F, , mapnum + MAX_WORLDSIDELENGTH ' Map(mapnum).Down Put #F, , Map(mapnum).Left Put #F, , mapnum + 1 'Map(mapnum).Right ElseIf mapnum > ((MAX_WORLDSIDELENGTH * MAX_WORLDSIDELENGTH) - MAX_WORLDSIDELENGTH) Then Put #F, , mapnum - MAX_WORLDSIDELENGTH 'Map(mapnum).Up Put #F, , Map(mapnum).Down Put #F, , Map(mapnum).Left Put #F, , mapnum + 1 'Map(mapnum).Right Else: Put #F, , mapnum - MAX_WORLDSIDELENGTH 'Map(mapnum).Up Put #F, , mapnum + MAX_WORLDSIDELENGTH ' Map(mapnum).Down Put #F, , Map(mapnum).Left Put #F, , mapnum + 1 'Map(mapnum).Right End If Case Else 'middle If mapnum < MAX_WORLDSIDELENGTH + 1 Then Put #F, , Map(mapnum).Up Put #F, , mapnum + MAX_WORLDSIDELENGTH ' Map(mapnum).Down Put #F, , mapnum - 1 'Map(mapnum).Left Put #F, , mapnum + 1 'Map(mapnum).Right ElseIf mapnum > ((MAX_WORLDSIDELENGTH * MAX_WORLDSIDELENGTH) - MAX_WORLDSIDELENGTH) Then Put #F, , mapnum - MAX_WORLDSIDELENGTH 'Map(mapnum).Up Put #F, , Map(mapnum).Down Put #F, , mapnum - 1 'Map(mapnum).Left Put #F, , mapnum + 1 'Map(mapnum).Right Else: Put #F, , mapnum - MAX_WORLDSIDELENGTH 'Map(mapnum).Up Put #F, , mapnum + MAX_WORLDSIDELENGTH ' Map(mapnum).Down Put #F, , mapnum - 1 'Map(mapnum).Left Put #F, , mapnum + 1 'Map(mapnum).Right End If End Select Else Put #F, , Map(mapnum).Up Put #F, , Map(mapnum).Down Put #F, , Map(mapnum).Left Put #F, , Map(mapnum).Right End If>! ``` Boot up and then shut down your server to save your maps. MAX_WORLDSIDELENGTH^2 maps will have their Map.Up, Map.Left, Map.Right, And Map.Down changed to place them on a square grid of side length MAX_WORLDSIDELENGTH, with no change to their direction links on any edge of the grid.You can adapt this to a rectangular grid by making a MAX_WORLDHEIGHTLENGTH constant and replacing the appropriate MAX_WORLDSIDELENGTHS with it.Once you've injected, ran, and removed this code, I strongly recommend only placing grid maps on the first MAX_WORLDHEIGHTLENGTH^2 maps. Any indoor, world, dungeon, etc. maps should be placed after that number.Have fun! C: Link to comment Share on other sites More sharing options...
abhi2011 Posted June 11, 2013 Share Posted June 11, 2013 A picture please. I didn't understand what this is. Link to comment Share on other sites More sharing options...
xx0m3gaxx Posted June 11, 2013 Share Posted June 11, 2013 I think what this does is make a grid of your maps and links them like this?1<>2<>3<>4^ ^ ^ ^v v v v5<>6<>7<>8^ ^ ^ ^v v v v9<>10<>11<>12ect Link to comment Share on other sites More sharing options...
Ryo Posted June 11, 2013 Share Posted June 11, 2013 It makes X numbers of map linked, if MAX_WORLDSIDELENGTH * MAX_WORLDSIDELENGTH = 200the first 200 maps will be automatically linked to each otherit can be useful for an automated world map among others things Link to comment Share on other sites More sharing options...
Zeno Posted June 11, 2013 Author Share Posted June 11, 2013 Yes, spot on. Thanks! Both are great explanations of what I meant by a linked grid. Link to comment Share on other sites More sharing options...
abhi2011 Posted June 11, 2013 Share Posted June 11, 2013 By linking maps you mean warps? (Direct warps not the attributes.) Link to comment Share on other sites More sharing options...
Zeno Posted June 11, 2013 Author Share Posted June 11, 2013 > By linking maps you mean warps? (Direct warps not the attributes.)Yes, exactly. Link to comment Share on other sites More sharing options...
abhi2011 Posted June 11, 2013 Share Posted June 11, 2013 Might I ask then why add the code into the engine? Why not just load the map files form a different application and edit the map files? Link to comment Share on other sites More sharing options...
Zeno Posted June 11, 2013 Author Share Posted June 11, 2013 Yeah, you could absolutely do that. It's a chosen personal preference. I just find it much easier to add a line, replace four, and then press undo a few times than to make a new project and have to copy types, generals, saving, loading, etc., plus add in those lines. Lately I've been changing my map type a lot too, so in my case especially it makes sense to do it this way.~~It would be better compiled and separate though. I think I'll compile this later for the resources section with an option of which engine's blank map files (or a custom list from an .INI) and a setting for a numbered start mapnum.~~Started and abandoned a compiled version. It might be a good idea for a specific engine, but there seem too many issues for doing a general one, most of these having to do with RTE errors for reading certain elements with null values. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now