Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-15-2008, 09:48 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Gmap Generator

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", {44});

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", {43}); // 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
__________________
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:03 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.