Spherical forums

Sphere Development => Sphere Support => Map/Tileset Support => Topic started by: Defiant on March 22, 2015, 11:53:02 pm

Title: SetTile() bug?
Post by: Defiant on March 22, 2015, 11:53:02 pm
OR maybe I'm just using it incorrectly?

It's setting it to the correct position on the map with the correct tile I specify, but the tile isn't placed on the correct layer.

Basically I'm adding in stuff to go above the player (so the player is hidden underneath what I'm putting there).

The picture below explains it better, the grate on the floor should appear above the player like that caution block that is already.

(I have three layers on my map, base, level & above. Player is set on level. )
Code: (javascript) [Select]
SetTile(23,22,"Above",51);
Title: Re: SetTile() bug?
Post by: Radnen on March 23, 2015, 12:10:42 am
Try using the layer number for the layer: SetTile(23,22,2,51);

I do this because I'm used to setting tiles relative to a players layer:
Code: (javascript) [Select]

SetTile(23,22,GetPersonLayer("player")+1,51);
Title: Re: SetTile() bug?
Post by: Defiant on March 23, 2015, 12:35:44 am
Thanks, that worked!
Title: Re: SetTile() bug?
Post by: Fat Cerberus on March 23, 2015, 02:15:48 am

Code: (javascript) [Select]
SetTile(23,22,"Above",51);



This is why I have to recommend using minisphere from here on out.  The much stricter type checking on API arguments would have caught this immediately.
Title: Re: SetTile() bug?
Post by: Radnen on March 23, 2015, 02:30:32 am


Code: (javascript) [Select]
SetTile(23,22,"Above",51);



This is why I have to recommend using minisphere from here on out.  The much stricter type checking on API arguments would have caught this immediately.


AFAIK his code ought to work in Sphere. When I saw N E O use the layer name in his game I thought that was neat and never seen it before. Maybe the Sphere API is spotty on when it allows the name? Further, maybe there are certain engines that have that behavior and other engines that do not?
Title: Re: SetTile() bug?
Post by: Fat Cerberus on March 23, 2015, 02:36:52 am

AFAIK his code ought to work in Sphere. When I saw N E O use the layer name in his game I thought that was neat and never seen it before. Maybe the Sphere API is spotty on when it allows the name? Further, maybe there are certain engines that have that behavior and other engines that do not?


Nope, referencing layers by name doesn't work in Sphere, at least not Sphere 1.5.  That's one of the changes I had to make the get Artyxx to work at all, even in vanilla.

That said, it would certainly be easy enough to support it in minisphere. :D
Title: Re: SetTile() bug?
Post by: N E O on March 24, 2015, 01:58:02 am
I believe referencing layers by name (especially in functions like SetTile) was going to be a 1.6 addition. I was using the 1.6b4 engine to test out Artyxx on Windows and to put it through its paces so I could have given a more thorough bug report re 1.6 improvements.
Title: Re: SetTile() bug?
Post by: Radnen on March 24, 2015, 02:29:18 am

I believe referencing layers by name (especially in functions like SetTile) was going to be a 1.6 addition. I was using the 1.6b4 engine to test out Artyxx on Windows and to put it through its paces so I could have given a more thorough bug report re 1.6 improvements.


That explains it! :P
Title: Re: SetTile() bug?
Post by: Fat Cerberus on March 24, 2015, 01:35:57 pm

That said, it would certainly be easy enough to support it in minisphere. :D


Aaaannnd it's done. Map layers can now be referenced by name in minisphere. ;D