jcae2798 132 Posted June 21, 2016 Hi all. So I'm been trying to figure out a way to find a random position that is tied to forests. This will be used to spawn either patrols and/or ammoboxes. The problem i am having is being able to find a POS that 100% of time does not end up colliding or inside an object (tree, etc..). The findsafepos had a really hard time finding POS in dense forests, so not really working for me (i submitted a ticket on it). I then played with the below, but testing it i ended up in a tree once or twice after multiple attempts which i would like to avoid. Any tips/ideas? _PosList = selectBestPlaces [(getMarkerPos "TEST"), 500, "FOREST", 80, 1]; _PosSelect = _PosList select (floor random (count _PosList)); _Pos = _PosSelect select 0; player setpos _POS; As i'm writing this....would even be cool to find positions along the walking paths, but not all the time. :) Share this post Link to post Share on other sites
kylania 568 Posted June 22, 2016 This post from last week has some good ideas in it. 2 Share this post Link to post Share on other sites
HallyG 239 Posted June 22, 2016 (edited) Hi all. So I'm been trying to figure out a way to find a random position that is tied to forests. This will be used to spawn either patrols and/or ammoboxes. The problem i am having is being able to find a POS that 100% of time does not end up colliding or inside an object (tree, etc..). The findsafepos had a really hard time finding POS in dense forests, so not really working for me (i submitted a ticket on it). I then played with the below, but testing it i ended up in a tree once or twice after multiple attempts which i would like to avoid. Any tips/ideas? _PosList = selectBestPlaces [(getMarkerPos "TEST"), 500, "FOREST", 80, 1]; _PosSelect = _PosList select (floor random (count _PosList)); _Pos = _PosSelect select 0; player setpos _POS; As i'm writing this....would even be cool to find positions along the walking paths, but not all the time. :) Maybe something like this: _Forests = selectBestPlaces [position player, 500, "(1 + forest + trees) * (1 - sea) * (1 - houses)", 30, 20]; _Forests = _Forests apply {_x select 0}; _Position = (selectRandom _Forests) findEmptyPosition [0, 10, "B_UAV_01_F"]; You would need to add a check to make sure an actual position is returned, though. Edited June 22, 2016 by hallyg 1 Share this post Link to post Share on other sites
kylania 568 Posted June 22, 2016 Maybe remove trees near the position just to make a clearing? This seems to clear much of it. Remove the sleep and move the setPos to the end once you're happy with how it works. _PosList = selectBestPlaces [(getMarkerPos "TEST"), 500, "FOREST", 80, 1]; _PosSelect = _PosList select (floor random (count _PosList)); _Pos = _PosSelect select 0; player setpos _POS; sleep 2; { hideObjectGlobal _x; _x enableSimulation false; } forEach nearestTerrainObjects [_pos, ["TREE", "BUSH", "FOREST", "SMALL TREE", "HIDE"], 10]; 4 Share this post Link to post Share on other sites
jcae2798 132 Posted June 27, 2016 Maybe remove trees near the position just to make a clearing? This seems to clear much of it. Remove the sleep and move the setPos to the end once you're happy with how it works. _PosList = selectBestPlaces [(getMarkerPos "TEST"), 500, "FOREST", 80, 1]; _PosSelect = _PosList select (floor random (count _PosList)); _Pos = _PosSelect select 0; player setpos _POS; sleep 2; { hideObjectGlobal _x; _x enableSimulation false; } forEach nearestTerrainObjects [_pos, ["TREE", "BUSH", "FOREST", "SMALL TREE", "HIDE"], 10]; This is freaking great for my composition script. Thanks! Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted June 28, 2016 hideobject(global) does it disable the vehicle physx as well? IIRC hidden objects will not collide with the player, but will collide with other vehicles, creating invisible obstructions Share this post Link to post Share on other sites
kylania 568 Posted June 28, 2016 Nope. Even without the enableSimulation false AI don't see the object at all. I used two gamelogics with this code to remove a curb and hanger and the AI drive right through where they used to be. house1 = (nearestterrainObjects[position this, ["HOUSE"], 30]) select 0; house1 hideObjectGlobal true; http://imgur.com/a/zMqVY Share this post Link to post Share on other sites
jcae2798 132 Posted July 7, 2016 hideobject(global) does it disable the vehicle physx as well? IIRC hidden objects will not collide with the player, but will collide with other vehicles, creating invisible obstructions Yea I noticed with 'Hideobject', this seems to be true...but not the global command....which is weird but i like it better this way Share this post Link to post Share on other sites
Targ35 2 Posted July 24, 2016 Hi, this looks like something that I could use, again on map Tanoa, Vanilla ARMA 3 (APEX).... _PosList = selectBestPlaces [(getMarkerPos "TEST"), 500, "FOREST", 80, 1]; _PosSelect = _PosList select (floor random (count _PosList)); _Pos = _PosSelect select 0; player setpos _POS; sleep 2; { hideObjectGlobal _x; _x enableSimulation false; } forEach nearestTerrainObjects [_pos, ["TREE", "BUSH", "FOREST", "SMALL TREE", "HIDE"], 10]; What I'm trying to do is to find a location to place an item.. that is clear of objects and on a flat surface, I have been using isflatempty while on altis map. however on Tanoa as it has more slopes and hills and steeper then Altis.. this does not work all the time... while {true} do { scopeName "SpawnPosGen"; _randir = floor(random 360); _randis = _mindis + floor(random _radius); _spawnpos = [(_markpos select 0) + ((sin _randir) * _randis), (_markpos select 1) + ((cos _randir) * _randis), 1]; _houses = nearestObjects [_spawnpos, ["house","wall"], 20]; _vehicles = nearestObjects [_spawnpos, ["LandVehicle", "Land_BagBunker_01_large_green_F", "Land_TTowerBig_2_F"], 20]; // have disabled the flat part of the line below as a work around, however still too many places it will not spawn _isFlat = _spawnpos isFlatEmpty [ 10, -1, -1, 5, 0, false, HaloFlag ];//[minDistance, mode, maxGradient, maxGradientRadius, overLandOrWater, shoreLine, ignoreObject] _danger = false; { if (floor(_spawnpos distance getPos _x) < 30) then { _danger=true; }; } forEach _houses; { if (floor(_spawnpos distance getPos _x) < 20) then { _danger=true; }; } forEach _vehicles; if (surfaceIsWater _spawnpos) then { _danger=true; }; if (count _isFlat < 1 ) then { _danger=true; }; if (!_danger) then { breakOut "SpawnPosGen" }; }; if (vMissionTargetType == "Command Post") then{ _unit = "Land_Cargo_House_V4_F" createVehicle _spawnpos; _unit setPosATL _spawnpos; _dir = floor(random 360); _unit setDir _dir; _unit lock true; _unit setVehicleVarName _unitname; _unit call compile format ["%1=_This; PublicVariable '%1'",_unitname]; }; if (vMissionTargetType == "Transmitter Box") then{ _unit = "Land_TBox_F" createVehicle _spawnpos; _unit setPosATL _spawnpos; _dir = floor(random 360); _unit setDir _dir; _unit lock true; _unit setVehicleVarName _unitname; _unit call compile format ["%1=_This; PublicVariable '%1'",_unitname]; }]; }; how could I make use of this code and remove this offending objects which are unknown before spawn of the "Transmitter box" this is only one object that gets spawn through this code.. but have reduced to make it clearer. (I think). Cheers any help would be much appreciated. I"m only a newbie at this so needs a walk through LOL 1 Share this post Link to post Share on other sites