Jump to content

Schatten

Member
  • Content count

    544
  • Joined

  • Last visited

  • Medals

Community Reputation

95 Excellent

2 Followers

About Schatten

  • Rank
    Gunnery Sergeant

Profile Information

  • Gender
    Male
  • Location
    Minsk, Belarus

Recent Profile Visitors

436 profile views
  1. @pierremgi, sorry, I was wrong -- have noticed that if arrays have same length then order of elements of returned by arrayIntersect command array match with one of second array: _array1 = ["beer", "steak", "girls1", "gaming", "chocolate"]; _array2 = ["chocolate", "gaming", "girls", "steak", "beer"]; _result = _array1 arrayIntersect _array2; // ["chocolate", "gaming", "steak", "beer"] Otherwise, if arrays have not same length, then order of elements match with one of first array: _array1 = ["beer", "steak", "girls1", "gaming", "chocolate"]; _array2 = ["chocolate", "gaming", "steak", "beer"]; _result = _array1 arrayIntersect _array2; // ["beer", "steak", "gaming", "chocolate"] Looks like your solution is the best!
  2. Well... Unfortunately, my solution will fail with these arrays: _array1 = ["beer", "beer", "steak", "girls", "gaming", "chocolate"]; _array2 = ["chocolate", "gaming1", "gaming", "girls", "steak", "beer"]; _result = (count (_array1 arrayIntersect _array2)) == (count _array1); // true, because "_array1 arrayIntersect _array2" returns array with 6 elements: ["beer", "steak", "girls", "gaming", "chocolate", "gaming1"] Seems, this is the best solution for sortable arrays. If arrays contain non sortable elements (e. g., objects), you can try this solution: ((_array1 apply {str _x}) sort true) isEqualTo ((_array2 apply {str _x}) sort true) Unfortunately, this solution can fail in case if order of elements of returned by "_aa arrayIntersect _bb" array differs with one of _bb.
  3. _array1 = ["beer", "beer", "steak", "girls", "gaming", "chocolate"]; _array2 = ["chocolate", "gaming", "gaming", "girls", "steak", "beer"]; _result1 = (count (_array1 arrayIntersect _array2)) == (count _array1); // false _result2 = (count (_array1 arrayIntersect _array2)) == (count (_array1 arrayIntersect _array1)); // true But, as we can see, arrays are not equal!
  4. @Tankbuster, another solution: (_array1 sort true) isEqualTo (_array2 sort true)
  5. @Tankbuster, (count (_array1 arrayIntersect _array2)) == (count _array1)
  6. @Lineman, { call (compile (format (["%1 = '%2' createUnit [_CorpSpawnPosition, newGroup];"] + _x))); } forEach [ ["SpawnSoldier_02", "B_SOLDIER_A_F"], ["SpawnSoldier_03", "fow_s_ger_heer_rifleman"] ]; sleep 1; removeUniform SpawnSoldier_02;
  7. @Tostm8, _displayName = getText (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName");
  8. https://community.bistudio.com/wiki/Variables#Scopes
  9. @Thorimus, sure, _vic1 is defined only in if-statement scope. For _vic1 to be defined outside, just place _vic1 = objNull; after _marker = ""; But don't forget check if _vic1 is null!
  10. @Thorimus, _marker = ""; {if ((markerText _x) == "Vehicle Here") exitWith {_marker = _x;};} forEach allMapMarkers; if (_marker != "") then { _vic1 = createVehicle ["C_Offroad_01_F", getMarkerPos _marker, [], 0, "NONE"]; };
  11. @Thorimus, _marker = ""; {if ((markerText _x) == "Vehicle Here") exitWith {_marker = _x;};} forEach allMapMarkers;
  12. @elthefrank, moreover, place setDir before setPos (see notes).
  13. read scripts from an addons

    @elthefrank, do not use @ symbol.
  14. @Lineman, use spawn instead of call.
×