HonzaVinCZ 18 Posted February 23, 2022 I wonder how can I find a unit (player in my case) in array of vehicles. I spent hell of a time on this one and couldn't find a solution. Example array of my vehicles: _vehicleList = [MGI802,MGI804,MGI809] I need to make it return boolean true/false if player is present in any of vehicles above. Vehicles in array can change so I can't hardtype "crew MGI802" and so on. My further use for that is to set player's marker alpha depending if he is in a vehicle or not; (I know this one is propably extremely unoptimised but I wanted to try make vehicle and player markers on my own) while {true} do { // Vehicle Markers _vehicleList = [MGI802,MGI804,MGI809,MGI810,MGI814,MGI815,MGI1843,MGI818,MGI823,MGI1504,MGI1507,MGI271,MGI253,MGI1847,MGI386,MGI1612,MGI836,MGI829,MGI1437,MGI835,MGI348,MGI824,MGI365,MGI369]; { _name = getText (configFile >> "CfgVehicles" >> typeOf _x >> "displayName"); _vehmark = vehicleVarName _x; if (getMarkerType _vehmark == "") then { _vehmark = createMarker [_vehmark, getPos _x]; _vehmark setMarkerType "mil_arrow2"; _vehmark setMarkerSize [0.4, 0.5]; _vehmark setMarkerAlpha 1; }; if (alive _x) then { if ((count crew _x) > 0) then { _crewlist = ""; { _crewlist = format ["%1%2 | ",_crewlist, (name _x)]; } forEach crew _x; _vehmark setMarkerText ([_name, _crewlist] joinString " | "); } else { _vehmark setMarkerText _name; }; _vehmark setMarkerColor "colorWEST"; _vehmark setMarkerDir (getDir _x); _vehmark setMarkerPos (getPos _x); } else { _vehmark setMarkerColor "colorGrey"; _vehmark setMarkerText ([_name, "(Destroyed)"] joinString " "); }; } forEach _vehicleList; // Player Markers _playermark = name player; if (getMarkerType _playermark == "") then { _playermark = createMarker [_playermark, getPos player]; _playermark setMarkerType "mil_triangle"; _playermark setMarkerSize [0.5, 0.8]; _playermark setMarkerAlpha 1; }; if (alive player) then { // HOW TO RETURN PLAYER PRESENCE BOOLEAN FROM _vehiclelist ? if (true) then { _playermark setMarkerText (name player); _playermark setMarkerColor "colorWEST"; _playermark setMarkerDir (getDir player); _playermark setMarkerPos (getPos player); _playermark setMarkerAlpha 1; } else { _playermark setMarkerAlpha 0; }; } else { _playermark setMarkerColor "colorGrey"; _playermark setMarkerText ([name player, "(KIA)"] joinString " "); }; sleep 1; }; 1 Share this post Link to post Share on other sites
_foley 192 Posted February 23, 2022 How about this if ((vehicle player) in _vehicleList) then {...}; 1 Share this post Link to post Share on other sites
HonzaVinCZ 18 Posted February 23, 2022 2 hours ago, _foley said: How about this if ((vehicle player) in _vehicleList) then {...}; That simple 😐 However it works as I wanted, thank you! 1 Share this post Link to post Share on other sites