gc8 981 Posted January 15, 2020 Hi can you somehow detect if map has sea? thx Share this post Link to post Share on other sites
Tankbuster 1747 Posted January 15, 2020 //fn_istowncoastal //send me a logic (from alllogics) or a position and a distance (400 is about right) and I'll tell you if it's a coastal town // if sent a logic and a 0 distance, I will use the targetradius distance from the town logic #include "..\includes.sqf" params ["_town", "_dist"]; private _ret = objNull; if (((typeName _town) isEqualTo "ARRAY" ) and {_dist < 1} ) then { _dist = _town getVariable "targetradius"; }; _nrobjs = (nearestTerrainObjects [_town, ["hide"], _dist, false, true]) select {((getModelInfo _x) #0) in ["bw_setsmall_tubey_f.p3d","bw_setbig_tubey_f.p3d","bw_setsmall_tubeg_f.p3d","bw_setbig_tubeg_f.p3d","bw_setsmall_brains_f.p3d","bw_setbig_brains_f.p3d","bw_setbig_corals_f.p3d","lavastonecluster_small_water_f.p3d","lavaboulder_04_water_f.p3d"]}; if (_nrobjs isEqualTo []) then { _ret = false; } else { _ret = true; }; _ret Here's a function I use that is reliable on Altis, Tanoa and Malden. Obviously it's ripped out of an existing mission, but I expect you can pick the relevant bones out of it. 1 Share this post Link to post Share on other sites
gc8 981 Posted January 16, 2020 @Tankbuster that's interesting function, thanks! I was thinking of using surfaceIsWater command on the map edges. Or maybe some map config value. Will look more to this later Share this post Link to post Share on other sites
Dedmen 2721 Posted January 16, 2020 13 hours ago, Tankbuster said: if (_nrobjs isEqualTo []) then { _ret = false; } else { _ret = true; }; _ret -> !(_nrobjs isEqualTo []) 13 hours ago, Tankbuster said: if (((typeName _town) isEqualTo "ARRAY" ) and {_dist < 1} ) -> if (_town isEqualType [] && _dist < 1) That code seems a bit old 😄 Share this post Link to post Share on other sites
Tankbuster 1747 Posted January 16, 2020 7 hours ago, Dedmen said: -> !(_nrobjs isEqualTo []) -> if (_town isEqualType [] && _dist < 1) That code seems a bit old 😄 That code predates the introduction of isEqualType, so yes, it is old. Sometimes I look back, or stumble over code from the mission that was written in 2015 and think "Which idiot wrote this?.. ah..." 1 Share this post Link to post Share on other sites
Rydygier 1317 Posted January 16, 2020 Also perhaps this would work: _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "mapSize"); _isSeaOutThere = (count (selectBestPlaces [[(_mapSize/2),(_mapSize/2)], _mapSize * (sqrt 2), "sea", 100, 1])) > 0; As for checking certain positions, surfaceIsWater sounds like a plan, but just in case, possible alternative could be ([0,0,0] stands as an example for any ATL position on the terrain surface) : _isSeaThere = ((ATLtoASL [0,0,0]) select 2) < 0; 3 Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted January 17, 2020 20 hours ago, Rydygier said: Also perhaps this would work: _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "mapSize"); _isSeaOutThere = (count (selectBestPlaces [[(_mapSize/2),(_mapSize/2)], _mapSize * (sqrt 2), "sea", 100, 1])) > 0; As for checking certain positions, surfaceIsWater sounds like a plan, but just in case, possible alternative could be ([0,0,0] stands as an example for any ATL position on the terrain surface) : _isSeaThere = ((ATLtoASL [0,0,0]) select 2) < 0; There's already worldSize. I'd try like this: _positions = [[0,0],[worldSize,0],[worldSize,worldSize],[0,worldSize]]; _positions findIf {surfaceIsWater _x} >= 0; Checks all 4 map corners for water. Maps with Ocean on it usually tend to have at least 1 map corner in the water. Can't think of anything that'll invalidate this check for now, heh. Maybe some edge case map with islands on all 4 corners and ocean on the rest? Hm. Cheers 3 Share this post Link to post Share on other sites
gc8 981 Posted January 17, 2020 @Grumpy Old Man I was thinking the same. It works, unless there is a map where there is water in the center. A lake or something. But such map probably don't exist in Arma... I have seen those kind of maps in some strategy games though Share this post Link to post Share on other sites
pierremgi 4909 Posted January 17, 2020 2 hours ago, gc8 said: @Grumpy Old Man I was thinking the same. It works, unless there is a map where there is water in the center. A lake or something. But such map probably don't exist in Arma... I have seen those kind of maps in some strategy games though surfaceIsWater doesn't work for inner lake anyway. Just for sea (salt water ? ) Share this post Link to post Share on other sites