Spherical forums

Sphere Development => Sphere Support => Topic started by: williammah on June 25, 2013, 01:11:52 am

Title: [ EDITOR ] map layer issue
Post by: williammah on June 25, 2013, 01:11:52 am
So I'm trying to use SetLayerVisible(layer, visible) to you know, set the map layers to be visible or not ( first floor, second floor etc ).

erm I know that 'visible' is supposed to be replaced with either true or false. But what should 'layer' be replaced with? This is what I did:

Code: [Select]
SetLayerVisible( sfloor, false);


where sfloor is the name of the layer. But it told me that swall is not defined meaning it's treating it as a variable...I think. So what should I type then?
Title: Re: [ EDITOR ] map layer issue
Post by: Radnen on June 25, 2013, 01:41:57 am
How about the layer index? I know it's not too obvious. In fact SetLayerRenderer can use the layers name? So it can change depending on what call you use. Always assume the layer index by default, in fact always use the index since layers can be named the same, but will never have the same index.
Title: Re: [ EDITOR ] map layer issue
Post by: ninjasword on June 25, 2013, 12:10:41 pm
when ever passing a label of an object as an argument, u always want to enclose the label in quotes (single or double doesnt matter), without the quotes, sphere will think u mean the variable

Code: [Select]

SetLayerVisible( "sfloor", true )


however in this case, with this function, the argument LAYER should be the number that is the index of the layer:

Code: [Select]

SetLayerVisible( 0, true )


but if u want u can save the layer (or use a function to find the layer u want) in a variable and then use that variable.

Code: [Select]

var SECOND_FLOOR_LAYER = 3

SetLayerVisible( SECOND_FLOOR_LAYER, true )