sproyd 2 Posted April 10, 2013 So I have 3 Playable slots in a SP/Co-Op Mission. I want to execute a script that will only execute on the units in a group that are controlled by AI and not human players. There seems to be a bug where when the script executes on a non-AI infantry that it deletes items or something. Anyway is there a command like this if soldier1 = AI then AssignItem "NVGoggles" or {if _x = AI then AssignItem "NVGoggles"} foreach unit group player (the syntax is probably wrong but you get the idea of what I'm trying to do) Thanks! Share this post Link to post Share on other sites
killzone_kid 1333 Posted April 10, 2013 if (!isPlayer _unit) then { //not human player }; Share this post Link to post Share on other sites
KevsNoTrev 44 Posted April 10, 2013 (edited) have you tried using switchableunits (SP) vs playableunits in MP? you could make an array of all units in the game _playable= playableunits;_switchunits= switchableunits; and then remove the playable units from it. that will leave you with all the Players that are left. _currentplayers = _playable - ["_switchunits"]; that is the only way I have found to work when removing values in an array from an array. if you just want the AI that are in game at any time then switchableunits would give you that. Edited April 10, 2013 by KevsnoTrev Share this post Link to post Share on other sites
killzone_kid 1333 Posted April 11, 2013 actually you are not removing anything, your currentplayers equals playableunits, this is why it works. Share this post Link to post Share on other sites
mindstorm 8 Posted April 11, 2013 _units = (if (isMultiplayer) then {playableUnits} else {switchableUnits}); _units = all playable players or AI players in a single or multiplayer game. So this does NOT contain AI units which are non-playable. allUnits = All UNITS ingame (players and AI playable and non-playable) except from Agents. _aiUnits = []; { _unit = _x; if !(isPlayer _unit) then { _aiUnits set [count _aiUnits, _unit]; }; }foreach allUnits; Share this post Link to post Share on other sites
KevsNoTrev 44 Posted April 11, 2013 actually you are not removing anything, your currentplayers equals playableunits, this is why it works. Doh!:banghead: knew i got it the wrong way round somewhere. Share this post Link to post Share on other sites