Jump to content
Sign in to follow this  
HazJ

Return Selected Town Name Location

Recommended Posts

Hi, how do I return a selected town name location using an if statement? I have tried "name location", "text" and "typeName" but can't get it to work... Probably because I am doing it wrong... :D

if (??? == "Town Name") then {...};

Any help is much appreciated!

Dirty Haz

Share this post


Link to post
Share on other sites

This is a script I used for looking at locations. My advice is don't use location names in a condition - there are errors, double spaces etc and you run the risk of case errors and breakage after game updates. Use positions instead, they will not change much.

Island location names and location types are stored in:

configfile >> "CfgWorlds" >> "Stratis" >> "Names";
configfile >> "CfgWorlds" >> "Altis" >> "Names"

Check the map after you run this - each location returned is marked with a dot.

private ["_locTypeArr", "_islandNamesArr"];

_locTypeArr =
[
"CityCenter",
"NameCity",
"NameCityCapital",
"NameLocal",
"NameMarine",
"NameVillage"
];

_islandNamesArr = [];
_locPosArr = [];
_locNamePosArr = [];

[_locTypeArr,[],true] call bis_fnc_locations;
_nearbyLocations = nearestLocations [getPos player, _locTypeArr, 100000];

for "_i" from 0 to (count _nearbyLocations)-1 do {
_location = _nearbyLocations select _i;
_locationName = text _location;
_locationPos = locationPosition _location;

_locPosArr set [count _locPosArr, _locationPos];
_islandNamesArr set [count _islandNamesArr, _locationName];

_locNamePosArr set [count _locNamePosArr, _locationName];
_locNamePosArr set [count _locNamePosArr, _locationPos];

};

copyToClipboard (str (_locNamePosArr));
//copyToClipboard (str (_locPosArr));
//copyToClipboard (str (_IslandNamesArr));

returns:

StratisNames&Positions = ["Marina Bay",[2647.88,5989.95,0.0272767],"Stratis Air Base",[1987.31,5625.9,-5.96042],"Agia Marina",[2915.2,6164.52,-21.9009],"airfield",[1697.19,5554.18,-5.5],"military range",[3338.44,5744.44,-4.88803],"Nisi Bay",[1784.43,4134.31,-0.108548],"LZ Baldy",[4604.3,5284.43,-129.97],"Camp Tempest",[1941.68,3556.72,-2.7864],"Old Outpost",[4318.72,4398.14,-179.132],"Kyfi Bay",[1790.43,3511.78,-0.0459259],"Kill Farm",[4449.56,6845.08,-91.6142],"Camp Rogain",[4886.45,5948.26,-183.532],"Air Station Mike-26",[4278.85,3855.6,-217.831],"Xiros",[3712.09,7940.36,8.98282e-005],"Camp Maxwell",[3252.96,2984.3,-222.619],"Girna",[1935.28,2722.61,0],"Girna Bay",[1844.64,2656.39,-0.0684495],"Kamino Coast",[5690.81,6123.91,-20.3592],"Tsoukalia",[4205.64,2714.88,-42.5791],"Agios Ioannis",[3027.38,2183.84,-151.004],"Limeri Bay",[5439.83,3687.15,-0.0388827],"Tsoukala Bay",[4240.81,2497.99,-0.0881449],"LZ Connor",[2979.45,1860.23,-171.409],"Strogos Bay",[2024.23,1789.56,0.18036],"Keiros Bay",[6157.09,4348.65,0.0786062],"Kamino Firing Range",[6401.97,5427.13,-7.4887],"Agios Cephas",[2718.53,1712.08,-130.502],"Kamino Bay",[6544.24,4863.44,-0.0398011],"Jay Cove",[2250.92,1121.03,0.149186],"Pythos",[7055.11,5953.82,-12.5299],"The Spartan",[2615.44,597.12,-63.3172]]

AltisNames&Positions = ["AAC airfield",[11461.2,11661.7,-22.9852],"Drimea",[10781.9,10881.6,-4.18781],"Therisa",[10618.9,12237.3,-16.0326],"Melanera Bay",[11226.2,10574.7,0.0990249],"Poliakko",[10966.5,13435.3,-28.4601],"Katalaki",[11701.1,13672.1,-12.7303],"Vikos",[11556.9,9417.06,-19.3987],"Makrynisi",[13471.9,12018.5,-12.1029],"Zaros",[9091.81,11961.9,-19.9013],"Katalaki Bay",[12269.8,13659.3,0.0993053],"Zaros Bay",[9210.66,10250.5,0.130289],"Neochori",[12502,14337,-11.5868],"Alikampos",[11112.6,14573.7,-42.5353],"Xirolimni Dam",[9115.22,13959.8,-30.247],"Sagonisi",[14281.2,13469.3,-5.32024],"Faronaki",[14934.4,11079.5,-8.38552],"Stavros",[12950.1,15041.6,-28.1891],"Kavirida",[7324.24,12125.4,-31.3799],"Sfaka",[9213.95,8079.03,-43.0843],"Edessa",[7194.23,11044,0],"Lakka",[12282,15732.3,-23.0026],"Eginio",[11549.2,7088.39,-83.8615],"Edessa Bay",[6862.33,10614.1,-0.0100589],"Pyrgos Gulf",[15139.2,14229.9,-0.233896],"",[9287.66,15858.1,-120.663],"Agios Dionysios",[9187.95,15947.8,-124.829],"factory",[12577.4,16352.8,-34.1307],"Agios Kosmas",[8555.32,7335.51,-12.281],"Agios Panagiotis",[6272.75,12173.9,-169.473],"Naftia Bay",[12157.6,6376.24,-0.00999258],"Monisi",[7813.36,7641.19,-1.39881],"airbase",[14037.6,16143.3,-20.5917],"military",[12771.6,16694.3,-85.9974],"Edoris",[6002.75,10511.4,-39.4888],"dump",[5900.47,12454.4,-110.621],"Topolia",[7375.81,15429.5,-54.782],"Pyrgos",[16780.6,12604.5,-18.9913],"Chelonisi",[16636.5,13582.2,-12.1916],"quarry",[17060.5,11339.1,-24.4416],"Orino",[10410.4,17243.1,-82.7311],"Ekali",[17059.7,9992.32,-21.8159],"Cap Makrinos",[14225.9,6237.99,0.0118773],"Terminal",[14522.4,16833.9,-17.5812],"power plant",[15420.8,16223.6,-9.61744],"Panochori",[5033.31,11245.2,-48.317],"Iremi Bay",[5117.63,9761.5,-0.139221],"Kore",[7062.42,16472.1,-116.425],"Pyrgi",[14489.9,5871.7,-12.2289],"Amfissa",[8088.81,17257.7,-150.162],"factory",[5307.12,14500.1,-20.4377],"Stadium",[5429.69,14996.7,-24.4264],"Gravia",[14479.8,17614.3,-21.6749],"Koroni",[11786.7,18372.4,-51.9314],"military",[15137.2,17297.8,-17.8604],"Anthrakia",[16584.3,16104,-15.1762],"factory",[6109.49,16246.2,-43],"quarry",[4379.15,12594.4,-39.3548],"",[4183.13,11744,-54.0805],"military",[16030.4,17004.8,-13.5195],"Neri",[4116.11,11736.1,-50.8535],"Syrta",[8625.13,18301.6,-179.297],"Panochori Bay",[4005.29,9908.59,-0.2215],"Telos",[16207,17296.7,-24.3308],"Galati",[10270.3,19036,-120.191],"mine",[18435.1,14301.8,-25.5322],"Athira",[13993,18709.4,-25.735],"Charkia",[18049.1,15264.1,-28.4237],"",[3620.39,13092.8,-10.243],"Athanos",[3571.22,10243.7,-18.4611],"Livadi",[18410.5,8098.3,-1.81681],"Negades",[4885.98,16171.3,-77.5036],"factory",[14294.6,18928.5,-36.7832],"Aggelochori",[3687.78,13776.1,-10.7639],"power plant",[4163.6,15047.2,-17.0033],"Kavala",[3458.95,12966.4,-6.1822],"storage",[18260.6,15551.2,-47.3991],"Neri Bay",[3166,11234.2,-0.116616],"Dorida",[19336.9,13252.3,-37.8615],"Ifestiona",[12787,19679.3,-46.1323],"Kavala Pier",[3014.83,12587.3,-2.57609],"Gori",[5455.72,17553.7,-70.9608],"Kastro",[3041.4,13162.8,-49.9934],"Kavala Bay",[3004.58,13675.9,-0.241818],"Cap Drakontas",[2657.32,11461.5,-21.2495],"Chalkeia",[20194.6,11660.7,-45.8388],"",[9459.62,20281.9,-127.433],"Abdera",[9425.42,20284,-122.26],"Savri",[2370.95,11507,-19.6032],"Rodopoli",[18753.4,16597.1,-32.1656],"Nifi",[19473.3,15453.7,-22.9098],"quarry",[19566.4,15617.3,-43.9734],"Kalithea",[17826.5,18129.4,-1.99341],"Fournos",[2313.67,9289.31,-11.5702],"Agios Konstantinos",[3948.77,17277.8,-11.6385],"Negades Bay",[3458.04,16859.6,0.0548031],"Panagia",[20490.2,8907.12,-34.5332],"Frini",[14612.5,20786.7,-47.0032],"Zeloran",[17043.5,19592.2,-5.22081],"Kalithea Bay",[18161,18676.6,0.0527949],"Agios Petros",[19339.4,17641.6,-37.4067],"Surf Club",[21339.4,10434,-4.49371],"Limni",[20920.8,14775.4,-2.11256],"Aktinarki",[21449.9,10873.8,-13.4104],"Cap Zefyris",[18049.3,19186.6,-16.9618],"dump",[5887.13,20236.5,-214.292],"Aristi",[7914.05,21305.2,-83.2944],"Agia Triada",[16668.5,20487,-4.767],"Chalkeia Bay",[21859.6,12594.9,0.16228],"Selakano",[20769.8,6736.46,-37.9427],"Fotia",[2993.48,18517.4,-31.7708],"Krya Nera",[9681.58,22294.5,-2.82557],"Paros",[20885.4,16958.8,-49.8089],"Feres",[21640.7,7583.93,-14.1929],"Kalochori",[21351.6,16361.9,-20.5678],"Ammolofi Bay",[9525.44,22649,-0.00713642],"Trachia",[22128.1,8453.98,-5.96645],"Agios Georgios",[20296.3,18635.1,-49.9897],"Tonos Bay",[11988.3,22985.7,0.0140989],"Cap Kategidis",[22792,13638.4,-16.6444],"Nychi",[16837.4,21890,-9.70004],"Mazi",[21772.4,6014.53,-7.89761],"Oreokastro",[4560.45,21460.6,-302.575],"Faros",[6565.3,22639.1,-94.2945],"Mazi Bay",[22181.4,6154.23,-0.0281507],"Thelos Bay",[22979.7,14939,-0.0635247],"castle",[4802.99,21855.5,-320.955],"Agia Pelagia",[22707.6,6930.57,-14.5643],"Cap Agrios",[14688.2,23496.2,-22.4582],"Ochrolimni",[23650.1,16227.3,-5.27635],"Pefkas Bay",[21204.7,20464.6,0.0519068],"Cap Thelos",[24067.6,15560.3,-11.5846],"Atsalis",[8304.83,25081.2,-77.0965],"Bomos",[2307.31,22165.2,-94.7805],"Almyra",[23495.6,18392.6,-3.19],"Iraklia",[21628.3,21274.9,-21.5588],"Ioannina",[23199.7,19986.6,-14.2541],"Delfinaki",[23908.6,20144.7,-14.0692],"military",[23533.2,21108,-92.5423],"Nidasos",[23662.9,21796.1,-52.2432],"power plant",[25462.6,20357.7,-9.55156],"military",[25350.6,21790.9,-79.3826],"Sofia",[25680.5,21365.1,-20.7333],"Sideras",[23274.5,24198.3,0.0333603],"Gatolia",[26723,21230.3,-15.8345],"Galana Nera Bay",[24924.1,24206.6,-0.0445134],"Limnichori",[25703.7,23561.6,-4.22667],"Molos",[26943.9,23170.7,-18.0848],"Molos Airfield",[26939.8,24743.8,-20.3838],"Polemistia",[27998.6,23775.8,0.000439519],"Molos Bay",[27826.8,24244.4,0.0831464],"Cap Strigla",[28059.2,25626.4,-33.4305]]

If you really need to use the name then:

_nearbyLocations = nearestLocations [getPos player, _locTypeArr, 100000];
_location = _nearbyLocations select 0;
_locationName = text _location;

if (_locationName == "Marina Bay") then {hint "you are at Marina Bay";};

Edited by Mattar_Tharkari

Share this post


Link to post
Share on other sites

Thank you. How would I make it so that it won't pick a location that has already been done?

Dirty Haz

Share this post


Link to post
Share on other sites

Generally I store that info in an array with a global reference. There is a sticky in A2 editing for beginners about how to work with arrays.

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
Sign in to follow this  

×