Nillers 439 Posted December 10, 2022 Hello everyone! I've been stumped on a project I've been working on and need some help. My goal is to create multiple layers of objects/entities and then have a script that can take those entities, randomly pick two out of three of them, then hide the third layer (or remaining layers). I know it will involve the idea of creating an array based on the name of the layer plus using getMissionLayerEntites to globally hide or reveal them, but I can't seem to fit them together. An example of this would be I have three locations for rebel camps, each separated in their own layers (camp1, camp2, etc), but I want to use an array to then pick 1 or 2 randomly a mission start to reveal the markers and other compositions. Then the rest get removed or remain hidden. Wondering if anyone has an easy solution out there. Any help would be appreciated, and thank you in advance. Share this post Link to post Share on other sites
Harzach 2518 Posted December 10, 2022 Just spitballing here, I think I understand what you are asking: private _layers = ["camp1","camp2","camp3"]; _count = floor random 2; for "_i" from 0 to _count do { private _layer = _layers deleteAt floor random (count _layers); private _objects = (getMissionLayerEntities _layer) select 0; { deleteVehicle _x; } forEach _objects; }; So - define array of relevant layers define number of layers to delete (zero-indexed) [loop] choose random layer and remove from array [loop] delete layer objects 1 Share this post Link to post Share on other sites
Harzach 2518 Posted December 10, 2022 Typical of random systems, the more choices there are, the more random the outcome will seem. For example, using my example of three layers, across multiple plays it may not feel so random: [[1,2],[1],[1,3],[3,1],[1,3],[2,3],[1,3],[1],[2],[2,1],[1],[3],[3,2],[1],[2,1],[1,2],[1],[3],[3],[2],[2],[1],[1,3],[2],[2,3],[1],[3,1],[3],[3,2],[1],[3],[2],[2],[3,1],[2,3],[3],[3,2],[2,3],[1,2],[2,3],[1,2],[2],[2],[1],[1,2],[1,2],[1],[2],[2,1],[2],[3,1],[2],[1,3],[3,1],[3],[1],[2],[3,2],[1],[1,3],[3],[2],[1],[1,3],[1],[1],[3,1],[3],[2],[3],[1],[2,3],[1],[3,1],[3,1],[2,3],[3],[1],[2],[3,1],[2],[1],[3,2],[1,2],[1],[2,3],[2,3],[1,2],[1,2],[2,3],[3,1],[1],[2],[3,2],[3],[3,1],[3,1],[3],[2],[3,1],[3,1],[1,3],[2,3],[1,2],[2],[3,1],[3,1],[3],[1,3],[2],[2,1],[1,2],[2],[1,3],[1,3],[3,2],[1],[1],[2],[2],[3]] But even having five camps with 1-3 active will increase the "randomness" quite a lot. 1 Share this post Link to post Share on other sites
pierremgi 4944 Posted December 10, 2022 I assume you're creating your layers in 3den, so the camps (not spawning compositions or objects). First of all, you can pick layers from getMissionLayers randomly as you need. Almost same code, including markers: private _layers = getMissionLayers; // or your array of layers like Harzach wrote { _layer = _layers deleteAt floor random count _layers; {deleteVehicle _x} count getMissionLayerEntities _layer#0; {deleteMarker _x} count getMissionLayerEntities _layer#1; } forEach [0,1]; // removing 2 arrays Note: getMissionLayers returns all created layers (not BLUFOR OPFOR... standard layers in 3den) , sub-layers included. Sub-layers may be not wanted. That's the case if you place a vanilla composition like "camp fortitude", adding units... then select this camp with the whole units/vehicles/markers... You'll get a "camp fortitude" layer and a sub-layer "layer4" (example) with all the selection inside! It's possible to move to root "layer4" (button in 3den) and delete the emptied "camp fortitude" layer. 2 1 Share this post Link to post Share on other sites
Nillers 439 Posted December 14, 2022 You folks are quick! So for clarification, yes, I should have specified that this is using layers created in the Eden Editor. I've been trying to create a new layer (i.e. Camp1), make a small camp composition (i.e. tents, cache, some units, marker, etc), repeat that a few more times, then randomize which camps are revealed every time the mission loads. Something that might look like this (this is simplified for concept): The end goal is to start with this to get the idea and then add more and more to it in the future. For example, having 5-15 areas of potential operations, but only 1 or 2 will be selected at the mission start. I think, based on your examples, I have an idea of where I need to go, so I'll give it a shot and report back. Thanks again! Share this post Link to post Share on other sites