Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Detecting A Level's Tile Def (https://forums.graalonline.com/forums/showthread.php?t=134268390)

baseman101 06-27-2013 10:08 PM

Detecting A Level's Tile Def
 
Hello, I was wondering if there was a function to detect a tileset in a level. This would be much easier with a script I have made. Is there a way to do this? I don't think so, because setting the tileset is done clientside and I would like to somehow detect the level's tileset serverside. It would be useful to have a function like this.

For example

PHP Code:

this.def findTileDef("level.nw"); 


Chompy 06-27-2013 10:11 PM

You're better off having one system which handles all setting of tiledefs on the server, and simply track which tiledef you set in a variable when the system changes tiledefs.

EDIT: There is no such function afaik. at this moment.

Emera 06-27-2013 10:12 PM

If you're looking for what I think you're looking for (the tileset type) I believe this will help you:
HTML Code:

TServerLevel.tiletype(float, float) - returns integer
Either way, you should tale Chompy's advice on managing tile definitions.

Chompy 06-27-2013 10:13 PM

Quote:

Originally Posted by Emera (Post 1719925)
If you're looking for what I think you're looking for (the tileset type) I believe this will help you:
HTML Code:

TServerLevel.tiletype(float, float) - returns integer

I believe that function simply returns the type of the tile at the given x and y in a level, for example if the tile is blocking, non-blocking etc

baseman101 06-27-2013 10:13 PM

Quote:

Originally Posted by Emera (Post 1719925)
If you're looking for what I think you're looking for (the tileset type) I believe this will help you:
HTML Code:

TServerLevel.tiletype(float, float) - returns integer
Either way, you should tale Chompy's advice on managing tile definitions.

I meant the tileset, but I can easily figure it out from there.

Edit: nevermind

baseman101 06-27-2013 10:15 PM

It would be useful to have a function that detects which tileset is used in each level, but I can't really do anything about it now.

Chompy 06-27-2013 10:16 PM

Quote:

Originally Posted by baseman101 (Post 1719929)
It would be useful to have a function that detects which tileset is used in each level, but I can't really do anything about it now.

The problem is the use of addtiledef2() which means you can basically use several different tilesets in one level.

Emera 06-27-2013 10:17 PM

Quote:

Originally Posted by Chompy (Post 1719926)
I believe that function simply returns the type of the tile at the given x and y in a level, for example if the tile is blocking, non-blocking etc

Oh, so it does. My bad.

baseman101 06-27-2013 10:18 PM

Quote:

Originally Posted by Chompy (Post 1719930)
The problem is the use of addtiledef2() which means you can basically use several different tilesets in one level.

Perhaps a function like this that would display an array instead? I have a spy script that uses tiles to detect where a player's level is and would like to change the tile definitions of the spy level to match the player's level.

BlueMelon 06-27-2013 10:51 PM

You can do this by storing the tile defs in a client variable, not sure how its managed on izone.

DustyPorViva 06-27-2013 11:35 PM

gettileset() will return the tileset image currently loaded for the player. I thought there were also ways to get addtiledef2 but I can't find anything.

You may be able to load the tiledefs from the tiledefs/tiledefs<servername>.txt file.

i8bit 07-15-2013 01:33 PM

Not sure if this is the right thread to ask this, but I have this:

PHP Code:

level.tilelayers[0].alpha 0.4

for a motion blur, but it doesn't seem to work on my gmap.

I have it running in a looping timeout, is that possibly why?

Draenin 07-15-2013 01:37 PM

Quote:

Originally Posted by i8bit (Post 1720640)
Not sure if this is the right thread to ask this, but I have this:

PHP Code:

level.tilelayers[0].alpha 0.4

for a motion blur, but it doesn't seem to work on my gmap.

I have it running in a looping timeout, is that possibly why?

Nope. It's because it needs to be gmap.tilelayers[0].alpha instead.

Also, you don't need it on a timeout unless you have some other script on that map that would try to change it. Changing it once is enough. The effect will stay active until you restore the alpha back to 1 or change maps.

devilsknite1 07-15-2013 06:39 PM

Quote:

Originally Posted by Draenin (Post 1720641)
Changing it once is enough. The effect will stay active until you restore the alpha back to 1 or change maps.

Definitely. If you need it to be updating, you can always put it under onPlayerEnters() and detect whether or not the tile layers are the wanted alpha, and if not change them that way.

i8bit 07-15-2013 11:35 PM

I have:

PHP Code:

gmap.tilelayers[0].alpha 0.4

But it still doesn't work :/


All times are GMT +2. The time now is 09:11 AM.

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