Questioning 0 Posted June 1, 2023 Howdy! I've made a function for an Ai commander that I'm working on that checks all of the Blufor groups + vehicles and categorizes them into four categories: "Car", "Car Armed", "Infantry" and "Infantry AT." The problem occurs in the debug section (> Line 45) where I'm trying place a marker on all of the groups to represent their category. It works when I'm marking less than ~5 groups, but when I try to mark more I get the error: "0 elements provided, 3 expected." The issue is with line 47 (commented "Our problem child"). Thank you! Here is the code: // This is the script/function that determines the types of units a commander has. fnc_unitTypeCheck = { params ["_side", "_position"]; _comPos = getMarkerPos _position; _availableGroups = groups _side; //All units/vehicles near _comPos. _availableVehicles = _comPos nearEntities ["Car", 150]; _cars = []; _armedCars = []; { if(typeOf _x in carSet) then {_cars pushBack _x; _availableVehicles = _availableVehicles - [_x]}; } forEach _availableVehicles; //Finds all cars { if(typeOf _x in armedCarSet) then {_armedCars pushBack _x; _availableVehicles = _availableVehicles - [_x]}; } forEach _availableVehicles; //Finds all armed cars _infantryATGroups = []; //[west, "HQ"] sideChat "All groups: " + str(_availableGroups); //Checks unit in blufor to see if they have an AT launcher. If they do the group is marked as AT capable and added to the Infantry AT group. (Checks for AT infantry) { _groupATCount = 0; _currentGroup = _x; { { if((_x in ATLauncherSet) && (_groupATCount == 0)) exitWith {_infantryATGroups pushBack _currentGroup; _groupATCount = _groupATCount + 1; _availableGroups = (_availableGroups - [_currentGroup]);}; } forEach weapons _x; } forEach units _x; } forEach _availableGroups; _infantryGroups = _availableGroups; // Initilized after infantry AT groups - sets the infantry groups to the _available groups. (Only groups that are available still are infantry groups) //Debug -- Issue is here { _mkr = createMarker ["InfantrySquad " + str(_forEachIndex + 1), _x]; //Our problem child _mkr setMarkerShape "ICON"; _mkr setMarkerType "mil_dot"; _mkr setMarkerColor "ColorBlack"; _mkr setMarkerText "InfSquad " + str(_forEachIndex); } forEach _infantryGroups; //Creates a marker identifying every infantry group { _mkr = createMarker ["ATSquad " + str(_forEachIndex), _x]; _mkr setMarkerShape "ICON"; _mkr setMarkerType "mil_dot"; _mkr setMarkerColor "ColorOrange"; _mkr setMarkerText "ATSquad " + str(_forEachIndex + 1); } forEach _infantryATGroups; //Creates a marker identifying every infantry AT group { _mkr = createMarker ["car " + str(_forEachIndex), _x]; _mkr setMarkerShape "ICON"; _mkr setMarkerType "mil_dot"; _mkr setMarkerColor "ColorGrey"; _mkr setMarkerText "Car " + str(_forEachIndex + 1); } forEach _cars; // etc. { _mkr = createMarker ["armedCar " + str(_forEachIndex), _x]; _mkr setMarkerShape "ICON"; _mkr setMarkerType "mil_dot"; _mkr setMarkerColor "colorRed"; _mkr setMarkerText "Armed Car " + str(_forEachIndex + 1); } forEach _armedCars; }; Share this post Link to post Share on other sites
Larrow 2800 Posted June 1, 2023 _x is a group, createmarker expects a position or an object. 2 Share this post Link to post Share on other sites
Harzach 2507 Posted June 1, 2023 leader _x should work, as createMarker will take an object as position. 1 Share this post Link to post Share on other sites
Questioning 0 Posted June 1, 2023 Thank you! I can't believe I made such a silly mistake. It works like a charm now! Share this post Link to post Share on other sites