Script:
gmap_generator.txt ( Stupid percent symbols D: )
Basically lets you create a gmap with any dimension wanted (Not sure though, because of the maxlooplimit).
Anyways, to the point, or.., to the examples! Let's say we named the wnpc GmapGenerator or something.
PHP Code:
function onCreated() {
GmapGenerator.createGmap("testgmap", {4, 4});
}
This would create one testgmap.gmap file and 16 testgmap_*.nw files in the directory told in the 'this.savepath' variable in the onCreated() event.
Now, how can I get these gmaps to work online? :O!?!?!?!?!?!
Some steps:
1) Move all the files that were generated (.gmap and .nw files) into
levels/ or somwhere levels are downloadable.
2) Go into server options and look for "gmaps=". There you simply put the filename of the (.gmap) file (without the .gmap ending).
(For example,
gmaps=testgmap,)
3) Add this line to a script that the player(s) have clientside:
loadmap(gmapname);, and again, the name of the (.gmap) file without the .gmap ending (Example:
loadmap("testgmap");) (Only do this if necessary)
4) Say this in rc chat:
/updatelevel gmapname.gmap (Example:
/updatelevel testgmap.gmap)
5) Now you can warp to your gmap.
6) If it is not working, get someone to restart the gserver.
7) Still not working? Start over.
-----
More examples:
PHP Code:
function onCreated() {
GmapGenerator.createGmap("testgmap", "sqrt16"); // 4x4 gmap
GmapGenerator.createGmap("testgmap", 5); // 5x5 gmap
GmapGenerator.createGmap("testgmap", {4, 3}); // 4x3 gmap
}
----
If you want a script to be added to all the generated levels, add it to the template level =)
----
Suggestions on how to improve are welcome, and please post bugs if found =)
Also, here's the template level I used:
template_default.nw
For some reason plain boards (Boards with only AA (upper left grass tile) tiles) aren't saved to the .nw file.
Edit: I just noticed I did all the link detection in a rather.. repetive and odd way.. next update will be a rewrite of the links :o