Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Default map loadout (https://forums.graalonline.com/forums/showthread.php?t=134267488)

greggiles 12-03-2012 02:45 AM

Default map loadout
 
Default map is set up so when on a gmap, it shows where you have been. the rest is black.

How do I make it load out the whole map even with parts un-explored?

Is this a server-ops problem?

cbk1994 12-03-2012 03:10 AM

afaik it's not possible without pre-rendering the entire map yourself (using something like NW2PNG) and a custom map script.

greggiles 12-03-2012 04:46 AM

Quote:

afaik it's not possible without pre-rendering the entire map yourself (using something like NW2PNG) and a custom map script.
Hmmm. okay. Well I'm going to make a weapon that draws a .png map, but I'm not sure how I'm and going to tell the client where the player is on the map.
Any suggestions?

Perhaps do a check on the players level so it will highlight the area the player is in.
example: Do a check if the player is in map_a1|_a2|_b1|_b2 and then the map will highlight that area.
Not sure how I would make it pin-point on player's location. :(

cbk1994 12-03-2012 05:15 AM

player.x and player.y on clientside refer to the player's position relative to the top-left of the map (not just the top-left of the current level). You can get the map width and height (in tiles) with player.gmap.width and player.gmap.height (again, clientside).

Divide the player's current x by the gmap width and you'll get a decimal representing their location on the map. If they're in the middle of the map, it'll be 0.5 for both.

When you display the player's head on a map, you can use basic math to figure out where to show it:

PHP Code:

// calculate head position on the map image
playerHeadX = ((player.player.gmap.width) * WIDTH_OF_MAP_IMAGE) - (WIDTH_OF_HEAD_IMAGE 2);
playerHeadY = ((player.player.gmap.height) * HEIGHT_OF_MAP_IMAGE) - (HEIGHT_OF_HEAD_IMAGE 2); 

Does that make sense?

There are some examples of maps in the Code Gallery you can look at as well. This one by Dusty is a few years old but replicates the default map with extra features (like being able to show a pre-rendered image). I can tell just by looking at it that some parts of it aren't done in the best way (sorry Dusty, I love you), but you can at least get an idea of the general method.

greggiles 12-03-2012 05:32 AM

Quote:

Does that make sense?
Yes, this does make sense.

Simple math can take you a long way :)

scriptless 12-03-2012 11:51 PM

You can render the whole map if you press "M" in the offline Level Editor.. while you are editing if you have already entered the level that sets the map up.. (so you see other levels and see whole map while editing).. quality is less then a NW2PNG tho

DustyPorViva 12-04-2012 02:24 AM

Quote:

Originally Posted by cbk1994 (Post 1708498)
(sorry Dusty, I love you)

No problem, 4 year ago is a long time and even I can tell my scripting has improved since then.

Stowen 10-20-2014 10:35 PM

Not sure if many of you know this, but in offline editor if you load a gmap with loadmap mapname; you can render a detailed map image by pressing Ctrl + M.

Jakov_the_Jakovasaur 10-21-2014 04:54 AM

Quote:

Originally Posted by Stowen (Post 1732172)
Not sure if many of you know this, but in offline editor if you load a gmap with loadmap mapname; you can render a detailed map image by pressing Ctrl + M.

you can do it without pressing ctrl

Stowen 10-22-2014 12:22 AM

Quote:

Originally Posted by Jakov_the_Jakovasaur (Post 1732178)
you can do it without pressing ctrl

Actually, you can't. When you are in editor mode (not "Play" mode), press Ctrl + M, and it will begin creating a full-sized map image (in .PNG format too, SCORE) for you. It reads each level of the currently loaded gmap, (setmap mapName;) and fully renders it into a detailed image that can be used with custom map systems.

fowlplay4 10-22-2014 01:07 AM

Quote:

Originally Posted by Stowen (Post 1732212)
Actually, you can't. When you are in editor mode (not "Play" mode), press Ctrl + M, and it will begin creating a full-sized map image (in .PNG format too, SCORE) for you. It reads each level of the currently loaded gmap, (setmap mapName;) and fully renders it into a detailed image that can be used with custom map systems.

u might want to check again champ

Jakov_the_Jakovasaur 10-22-2014 05:03 AM

Quote:

Originally Posted by Stowen (Post 1732212)
Actually, you can't. When you are in editor mode (not "Play" mode), press Ctrl + M, and it will begin creating a full-sized map image (in .PNG format too, SCORE) for you. It reads each level of the currently loaded gmap, (setmap mapName;) and fully renders it into a detailed image that can be used with custom map systems.

Quote:

Originally Posted by fowlplay4 (Post 1732214)
u might want to check again champ

yeah champ you might want to check again!


All times are GMT +2. The time now is 11:24 PM.

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