Spriterfight 10 Posted July 31, 2020 _gunner = mortar_gunner; _assistantgunner = mortar_assistant_gunner; _gunnerGrp = group mortar_gunner; while {alive _gunnerGrp} do { _totEnemy = {alive _x && side _x == EAST} count allUnits; if ( _totEnemy > 0) then { _list = nearestObjects [_gunner,["Man"],500]; _listfiltered = _list select {side _x == west}; _target1 = sleectRandom _listfiltered; }; 23:02:08 Error in expression <nemy > 0) then { _listoftargets = _list = nearestObjects [_myUnit,["Man"],500]; > 23:02:08 Error position: <= nearestObjects [_myUnit,["Man"],500]; > 23:02:08 Error Missing ; 23:02:08 File C:\Users\tibcs_000\Documents\Arma 3\missions\weapondeployment%20script.tem_ihantalaww\weapondeployment.sqf..., line 12 Share this post Link to post Share on other sites
pierremgi 4905 Posted August 1, 2020 1. if global variable exists, why don't you use them? (what interest to write _gunner = mortar_gunner if your unit is already mortar_gunner in editor or former script?) 2. alive applies on objects, not group; Anyway you can check for gunner in mortar because he is the only one who can fire (except further script switching the mortar crew); 3. allUnits is already a filter for men. on the other hand nearestObjects with "man" will return rabbits and snakes as well (welcome to arma world!). Spoiler But I never saw a blue rabbit 4. sleectRandom doesn't exist as command (nor variable) so the script throws an error for missing ";" 5. I hope you spawn / execVM your script! You could be stuck in that loop if unscheduled scope. The reason why i'll spawn mine as is: 0 = []spawn { sleep 2; private "_target"; private _mag = (vehicle mortar_gunner currentMagazineTurret [0]); while {alive mortar_gunner && WEST countSide allUnits > 0 } do { _target = selectRandom (allUnits select {side _x == west}); mortar_gunner doArtilleryFire [getPos _target, _mag, 1]; vehicle mortar_gunner addMagazineTurret [_mag,[0],1]; sleep 2; }; }; here mortar_gunner is the mortar gunner; for vanilla mortar, or any modded mortar, acting as an artillery, with [0] as gunner turret. 2 1 Share this post Link to post Share on other sites
Spriterfight 10 Posted August 1, 2020 4 hours ago, pierremgi said: 1. if global variable exists, why don't you use them? (what interest to write _gunner = mortar_gunner if your unit is already mortar_gunner in editor or former script?) 2. alive applies on objects, not group; Anyway you can check for gunner in mortar because he is the only one who can fire (except further script switching the mortar crew); 3. allUnits is already a filter for men. on the other hand nearestObjects with "man" will return rabbits and snakes as well (welcome to arma world!). Hide contents But I never saw a blue rabbit 4. sleectRandom doesn't exist as command (nor variable) so the script throws an error for missing ";" 5. I hope you spawn / execVM your script! You could be stuck in that loop if unscheduled scope. The reason why i'll spawn mine as is: 0 = []spawn { sleep 2; private "_target"; private _mag = (vehicle mortar_gunner currentMagazineTurret [0]); while {alive mortar_gunner && WEST countSide allUnits > 0 } do { _target = selectRandom (allUnits select {side _x == west}); mortar_gunner doArtilleryFire [getPos _target, _mag, 1]; vehicle mortar_gunner addMagazineTurret [_mag,[0],1]; sleep 2; }; }; here mortar_gunner is the mortar gunner; for vanilla mortar, or any modded mortar, acting as an artillery, with [0] as gunner turret. Thank you very much! Share this post Link to post Share on other sites