Casio91Fin 31 Posted February 15, 2021 Hey Question? how to make these three work so that there is no need to swap places with each other. _TownName = text nearestLocation [_Mission_Pos, "NameVillage"]; <<-------/NameCity / NameCityCapital / NameVillage [west, [localize "STR_CAS_Mission_Name_4", "Suomi Painaa Tehtävät"], [format [localize "STR_CAS_Mission_Text_4", _TownName], localize "STR_CAS_Mission_Name_4", ""], _Mission_Pos, true, 1, true, "danger", true] call BIS_fnc_taskCreate; [localize "STR_CAS_Mission_Name_4", "ASSIGNED", true] spawn BIS_fnc_taskSetState; SP_Mission_Pos_Residential = Spoiler { private ["_Found", "_Pos", "_Residential_Position"]; SP_pos_initialized = false; _Found = false; while {!_Found} do { _Pos = [] call BIS_fnc_randomPos; if ( (({((_Pos distance _x) <= SP_Safe_Zone_Dist)} count SP_AllPlayers) isEqualTo 0) && ((_Pos distance SP_Safe_Zone_1) > SP_Safe_Zone_Dist) && ((_Pos distance SP_Safe_Zone_2) > SP_Safe_Zone_Dist) && ((_Pos distance SP_Safe_Zone_3) > SP_Safe_Zone_Dist) && ((_Pos distance SP_Safe_Zone_4) > SP_Safe_Zone_Dist) && ((_Pos distance SP_Safe_Zone_5) > SP_Safe_Zone_Dist) ) then { _Residential_Found = false; while {!_Residential_Found} do { _Residential_Area = nearestLocations [_Pos, ["NameCity","NameCityCapital","NameVillage"], worldSize]; _Residential_Position = position (_Residential_Area select (floor (random (count _Residential_Area)))); if !(_Residential_Position isEqualTo []) then { _Residential_Found = true; } else { _Residential_Found = false; _Residential_Position = _Pos; }; }; _Found = true; } else { _Found = false; }; }; waitUntil {_Found}; _Pos = [[[_Residential_Position, random 30]],["water"]] call BIS_fnc_randomPos; SP_pos_initialized = true; _Pos }; Share this post Link to post Share on other sites
pierremgi 4740 Posted February 16, 2021 use nearestLocations and pick the first one. Share this post Link to post Share on other sites
Casio91Fin 31 Posted February 16, 2021 (edited) Thanks for this, but it only gives me the coordinates. No village or city names. _TownName = nearestLocations [_Mission_Pos, ["NameCity", "NameCityCapital", "NameVillage"], 200]; //had to delete "text" when an error message was received why? mission text ......... ..... ..... ...... ([location namecity at 9188, 15948] = Agios Dionysios ) .................. Edited February 16, 2021 by Casio91Fin Share this post Link to post Share on other sites
gc8 970 Posted February 16, 2021 use text to get the location name from location Share this post Link to post Share on other sites
Casio91Fin 31 Posted February 16, 2021 I do not get to work, even though I am very close to its success Share this post Link to post Share on other sites
pierremgi 4740 Posted February 16, 2021 text (nearestLocations [_Mission_Pos, ["NameCity", "NameCityCapital", "NameVillage"], 200] #0) Share this post Link to post Share on other sites
Casio91Fin 31 Posted February 16, 2021 (edited) _TownName = text (nearestLocations [_MissionPos, ["NameCity", "NameCityCapital", "NameVillage"], 200] #0); = "Any"? mission text ------------- (00007FF7B08441D0) ------------------- - -- - - - -- - Edited February 16, 2021 by Casio91Fin Share this post Link to post Share on other sites
gc8 970 Posted February 16, 2021 with small distance (200) there maybe no location near enough _locs = nearestLocations [_MissionPos, ["NameCity", "NameCityCapital", "NameVillage"], 3000]; if(count _locs > 0) then { hint format["Location found '%1'", text (_locs # 0)]; }; Share this post Link to post Share on other sites
Casio91Fin 31 Posted February 16, 2021 now did not give an error, but also no name Share this post Link to post Share on other sites
pierremgi 4740 Posted February 16, 2021 1 hour ago, Casio91Fin said: _TownName = text (nearestLocations [_MissionPos, ["NameCity", "NameCityCapital", "NameVillage"], 200] #0); = "Any"? mission text ------------- (00007FF7B08441D0) ------------------- - -- - - - -- - Perhaps too small radius. and there is a typo _Mission_Pos not _missionPos sorry for that. 1 Share this post Link to post Share on other sites
Casio91Fin 31 Posted February 16, 2021 😎 Works like a dream 1 Share this post Link to post Share on other sites