Jump to content
npmproductions13

Need Help Understanding Layers and Their Functionality

Recommended Posts

Hi there can anyone assist me with using layers to hide a selection of entities using boolean logic or variables for example.

Right now I want to make a ship appear depending on the faction selected in the parameter screen. The wiki describes its many uses for the 3DEN layers like remove,add and set, it also describes the syntax but I'm finding it hard to get working correctly.

Another thing I don't understand is, are the entities "linked" to the value -1 or is it "linked" to the "Enemy Base" String?

vD4mpTI.png

 

Share this post


Link to post
Share on other sites
On 8/19/2018 at 6:48 AM, npmproductions13 said:

Right now I want to make a ship appear depending on the faction selected in the parameter screen. The wiki describes its many uses for the 3DEN layers like remove,add and set, it also describes the syntax but I'm finding it hard to get working correctly.

There is only one option available to you from inside a runnning mission, being getMissionLayerEntities. The command excepts either a layer ID(NUMBER) or the layers name. The layers available are only those created in the editor, the default side layers are not actually layers.

 

On 8/19/2018 at 6:48 AM, npmproductions13 said:

Another thing I don't understand is, are the entities "linked" to the value -1 or is it "linked" to the "Enemy Base" String?

Both, inside the .sqm all entities belonging to a layer exist in a child class of the layer. The layer class has both a ID(NUMBER) and name(STRING) properties to identify it.

Spoiler

Example of a .sqm with just a single soldier inside a custom layer.


	class Entities
	{
		items=1;
		class Item0	//First item saved
		{
			dataType="Layer";	//Of type layer
			name="Layer 1";		//STRING representing layers name
			class Entities		//class holding entities that exist in this layer
			{
				items=1;
				class Item0	//Child class
				{
					dataType="Group";	//A group
					side="West";
					class Entities		//Groups objects
					{
						items=1;
						class Item0		//First group member
						{
							dataType="Object";
							class PositionInfo
							{
								position[]={4097.647,5.0014391,4145.6558};
							};
							side="West";
							flags=7;
							class Attributes
							{
							};
							id=3;
							type="B_Soldier_F";		//Of type
						};
					};
					class Attributes
					{
					};
					id=0;
				};
			};
			id=4;	//Layer ID
		};
	};

 

 

Untested but something like...

//description.ext
class Params
{
	class ChoosenSide
	{
		title = "Choose Side";
		values[] = {0,1,2};
		texts[] = {"East","West","Independant"};
		default = 1;
	};
};

//initServer.sqf

_sideParam = [ "ChoosenSide", 1 ] call BIS_fnc_getParamValue;

if !( _sideParam isEqualTo 1 ) then {
	{
		_index = _forEachIndex;
		{
			if ( _index isEqualTo 0 ) then {
				deleteVehicle _x;
			}else{
				deleteMarker _x;
			};
		}forEach _x;
	}forEach getMissionLayerEntities "MyLayer";
};

 

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

I'm still getting the issue of both sides ships appearing inside each other. I can't get one to delete itself while the other stays etc.. In EDEN iv'e made the layer invisible and want to make 1 and only one appear by script and it seems both layers unhide themselves regardless of the scripts controlling them.

 

I'm even just trying to debug this in the debug console but nothing works like before.

Share this post


Link to post
Share on other sites

Ok I got the desired results by using the simple code below with some snippets of your code thanks Larrow.

{ 
 deleteVehicle _x; 
} forEach ((getMissionLayerEntities "Munificent") select 0);

 

Share this post


Link to post
Share on other sites

Fixed my code, had assignment in _index check, missed a =.

  • Like 1

Share this post


Link to post
Share on other sites

@Larrow

First time I have ever saw you make a typo in your code on these forums. You must be tired, get some sleep! :rofl::rofl:

On a serious note. Good work! As always.

  • Haha 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×