Quote:
Originally Posted by baseman101
Hey, final problem. When I try to copy the tiles from a level on the Gmap, it doesn't work. However, when I do a normal level, it does work.
PHP Code:
tiles[temp.x,temp.y] = findlevel("test_d04.nw").tiles[temp.x,temp.y];
Doesn't work, connected to the gmap
PHP Code:
tiles[temp.x,temp.y] = findlevel("test.nw").tiles[temp.x,temp.y];
Works, not connected to the gmap
|
I don't think you'll be able to get this to work. findLevel is returning the level object, and on serverside a GMAP is treated like one big level.
The best solution would be to simply calculate the offset of the player's current level on the GMAP, and figure out the tiles relative to that offset. Something like
PHP Code:
temp.pl = findPlayer2(this.plAcc);
// offset of the current level on the GMAP in tiles
temp.offsetx = int(temp.pl.x / 64) * 64;
temp.offsety = int(temp.pl.y / 64) * 64;
// get the level's tiles using the offset
for (temp.x = 0; temp.x < 64; temp.x ++) {
for (temp.y = 0; temp.y < 64; temp.y ++) {
temp.tile = temp.pl.level.tiles[temp.x + temp.offsetx, temp.y + temp.offsety];
}
}
Quote:
Originally Posted by callimuc
regarding level name: using player.level.name should also return the level name instead of the gmaps name
|
On serverside, if the GMAP is setup correctly, it will return the GMAP name, since the NPC-server sees the GMAP as one big TServerLevel.