mattxr 9 Posted February 12, 2007 OK my aim is to make a Hunter Script which makes some enemy's start to track down the players group. and then when they get into range then fire. i have this atm but it doesnt fully work. Quote[/b] ]hunterk.sqf _run=true; while{_run} do { {_x domove getpos S1;} foreach (units hunter1); {_x domove getpos SS;} foreach (units hunter2); sleep 2; }; anyhelp would be great. Share this post Link to post Share on other sites
zwobot 22 Posted February 12, 2007 It would be helpful to know what exactly is not working the way you want it. Share this post Link to post Share on other sites
mattxr 9 Posted February 12, 2007 Oh, well sometimes they do and dont follow, also when they do reach the enemy they shoot like 1 bullet and then try to get right ontop of the player instead of shooting from a distance.. what i really need is for the hunters to get a certain distance then stop, then when the player is out of range the hunters move again. Share this post Link to post Share on other sites
deanosbeano 0 Posted February 12, 2007 couldnt you add a line that hunter distance hunted < 40 : _run = false at which point you can get your hunters to concentrate on the dowatch dofire side of the killing scripts you talk in sqf it isnt the language of my fathers so i have limited help available these scripts are always a bastard, cause the bone idle ai wont shift there ass after a certain distance to targets and now witht is fsm stuff god they are almost ,saying pissoff with your sqs i am busy carrying out a fsm here of course the ultimate starter for these things is the hunter reval hunted . it may not be magica but it gets the relationship sorted out as to what everything is and where Share this post Link to post Share on other sites
mattxr 9 Posted February 12, 2007 can be anything really sqs or sqf i just want a group of soliders to stalk a group of players in MP.. preferably a sniper and spotter follow the players. Share this post Link to post Share on other sites
zwobot 22 Posted February 12, 2007 Go for "knowsAbout": <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_run=true; while{_run} do { if((leader_enemy_group knowsAbout player) > 0.5) { {_x domove getpos S1;} foreach (units hunter1); {_x domove getpos SS;} foreach (units hunter2); } sleep 2; }; I am not sure about the syntax of the if statement, but can you see what I mean ? Maybe you could check the whole player's group to see what the hunter group knows about each member. I dont know what happens when the player group retreats and gets out of hunter group's sight. Share this post Link to post Share on other sites
deanosbeano 0 Posted February 12, 2007 try philcommandos script ,he used it for his tigers, you would call the players man1,man2,man3 and the hunters would attack them anywhere on map. sorry cant offer a script at the mo, alittle busy destroying things Share this post Link to post Share on other sites
mattxr 9 Posted February 12, 2007 oki testing these scripts Share this post Link to post Share on other sites
mattxr 9 Posted February 12, 2007 Oki i have this Quote[/b] ]_vehicle = _this select 0 _vehicle allowfleeing 0 _vehicle setbehaviour "AWARE" _vehicle setspeedmode "FULL" #0 _vehile doTarget hunted _vehicle doFire hunted _vehicle domove [((getpos hunted select 0) + 1), ((getpos hunted select 1) - 0),((getpos hunted select 2) + 0)] ?(alive hunted) && _vehicle distance hunted < 20 :_vehicle setvelocity [(velocity _vehicle select 0) * 1.3,(velocity _vehicle select 1) * 1.3,(velocity _vehicle select 2) * 1.3] ~1 ?!(alive hunted):goto exit ?(alive hunted):goto "0" exit But the Hunter Moves and Stops every seconds which will get him no where fast. ^^ Share this post Link to post Share on other sites
mattxr 9 Posted February 12, 2007 Ok i think i fixed that slow moving problem by making the ~1 to ~6 near the end. seems to be working fine now. Share this post Link to post Share on other sites
deanosbeano 0 Posted February 12, 2007 nice to know dont forget to add him to ya read me . yuou wont need the velocity bits tho unless there in a car . the original tiger was under a vehicle class i recall. there was two scripts the one your using is for a single hunted ,theres another i think for a group hunting a group. Share this post Link to post Share on other sites
mattxr 9 Posted February 12, 2007 thats right, i edited the group one so he hunts the full group ^^ Share this post Link to post Share on other sites
Big Dawg KS 6 Posted February 12, 2007 Oki i have this Quote[/b] ]_vehicle = _this select 0 _vehicle allowfleeing 0 _vehicle setbehaviour "AWARE" _vehicle setspeedmode "FULL" #0 _vehile doTarget hunted _vehicle doFire hunted _vehicle domove [((getpos hunted select 0) + 1), ((getpos hunted select 1) - 0),((getpos hunted select 2) + 0)] ?(alive hunted) && _vehicle distance hunted < 20 :_vehicle setvelocity [(velocity _vehicle select 0) * 1.3,(velocity _vehicle select 1) * 1.3,(velocity _vehicle select 2) * 1.3] ~1 ?!(alive hunted):goto exit ?(alive hunted):goto "0" exit But the Hunter Moves and Stops every seconds which will get him no where fast. ^^ Yuck, what an ugly script. First, setVelocity has no business in there, take it out. Second, you're pointlessly adding/subracting 1s and 0s to/from your position array, I can't imagine why those are there in the first place. Third, if it's a whole group of hunters, using domove and foreach is redundent. Let me show you how to do this (in .sqf too): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_hunters = _this select 0; _target = _this select 1; {_X allowfleeing 0} foreach (units _hunters); waitUntil{ if({_X distance _target < 20} count (units _hunters) >= 1)then{{_X dotarget _target; _X dofire _target} foreach (units _hunters); dostop (units _hunters)}else{_hunters move (getpos _target)}; sleep 5; !(alive _target) || ({alive _X} count (units _hunters) <= 0) }; Where _hunters is the group of hunting units. Share this post Link to post Share on other sites
deanosbeano 0 Posted February 12, 2007 Quote[/b] ]you're pointlessly adding/subracting 1s and 0s to/from your position array, I can't imagine why those are there in the first place. because he ripped it from a tiger script and that position was good for the tiger to attack . couldnt let you go worrying about that now could i. a very nice sqf , one day i shall write those . btw i think he edited the group version of that script and dind use the one he quoted . Share this post Link to post Share on other sites
Guest Posted February 13, 2007 Init.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> CSL_GetHorizontalDistance = compile preprocessFile "CSL_GetHorizontalDistance.sqf" CSL_GetMoveIncrementInfantry = compile preprocessFile "CSL_GetMoveIncrementInfantry.sqf" CSL_GetHorizontalDistance.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> // Why not just use obj1 distance obj2 from the comref? // The function built into the game engine gets true distance only. // This function should be used when you have a need to get the distance from // point A to point B as a pure horizontal distance (like on a map) // in some situations this can make a world of difference. // especially when you're dealing with flying objects. // // example (assumes above sea level for the altitudes, even though in game they arent): // suppose that you have 2 aircraft AircraftA and AircraftB // aircraftA's position is [1000.00,1000.00,50.00] // aircraftB's position is [1500.00,1000.00,550.00] // AircraftA's True Distance from Aircraft B is 707.106 meters // AircraftA's horizontal (map) Distance from Aircraft B is only 500 meters though // // this is actually the reason the ofp ai can't hit a waypoint if it's flying over a certain altitude // if it's flying high enough, it can't get within range to trigger it as the ofp engine does true distance // using this function, you can get certain things to work a LOT better // // // to get this function to work: // // copy and paste this code into a file called CSL_GetHorizontalDistance.sqf // // in init.sqs, preprocess this function as so: // CSL_GetHorizontalDistance = preprocessFile "CSL_GetHorizontalDistance.sqf" // // then use it in any script or tirgger like so: // myvariable = [positionA, postionB] call CSL_GetHorizontalDistance // // This function will always return a positive or zero decimal distance // // example to get the horizontal distance between 2 helicopters // _x = [getPos _myHeli1, getPos _myHeli2] call CSL_GetHorizontalDistance // // example to get the horizontal distance between an aircraft and a marker position // _x = [getPos _myAircraft, getMarkerPos "MyMarker"] call CSL_GetHorizontalDistance // // example to get the horizontal distance between a helicopter and a soldier // _x = [getPos _myHeli, getPos _mySoldier] call CSL_GetHorizontalDistance // // example to get the horizontal distance between 2 hardcoded positions // _x = [[1234.56, 1234.56, 1234.56], [6543.21, 6543.21, 6543.21]] call CSL_GetHorizontalDistance // // example to get the horizontal distance between 2 variables holding positions // _x = [_myPosA, _myPosB] call CSL_GetHorizontalDistance // // it's funny that the comments are longer than the actual script... private ["_positionACSL", "_positionBCSL", "_distanceACSL", "_distanceBCSL", "_distanceCCSL", "_output"]; _postionACSL = _this select 0; _postionBCSL = _this select 1; _distanceACSL = (_postionACSL select 0) - (_postionBCSL select 0); _distanceBCSL = (_postionACSL select 1) - (_postionBCSL select 1); _distanceCCSL = sqrt ((_distanceACSL * _distanceACSL) + (_distanceBCSL * _distanceBCSL)); _output = _distanceCCSL; _output CSL_GetMoveIncrementInfantry.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> // to use // pass 2 positions, returns a 3rd postion in between the 2 positions 150 meters away private [ "_positionACSL", "_positionBCSL", "_X1CSL", "_Y1CSL", "_X2CSL", "_Y2CSL", "_distanceACSL", "_distanceBCSL", "_distanceCCSL", "_reductionRatioCSL", "_returnPostionCSL", "_outputCSL" ]; _postionACSL = _this select 0; _postionBCSL = _this select 1; _X1CSL = _postionACSL select 0; _Y1CSL = _postionACSL select 1; _X2CSL = _postionBCSL select 0; _Y2CSL = _postionBCSL select 1; _distanceACSL = _X1CSL - _X2CSL; _distanceBCSL = _Y1CSL - _Y2CSL; _distanceCCSL = sqrt ((_distanceACSL * _distanceACSL) + (_distanceBCSL * _distanceBCSL)); _reductionRatioCSL = _distanceCCSL/100; _returnPostionCSL = [(_X1CSL +((_X2CSL - _X1CSL)/_reductionRatioCSL)), (_Y1CSL +((_Y2CSL - _Y1CSL)/_reductionRatioCSL)),30.00]; _outputCSL = _returnPostionCSL; _outputCSL Example usage from CSL's script (ive used it plenty and modified for long distance doMove's) <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ; this loop makes the squad go to the patrol point #moveToPatrolPoint ~5 ; hold the group leader _leader = (leader _spawnGroup) ; get Distance To WP _distanceToPatrolPoint = [getpos _leader, _patrolPoint] call CSL_GetHorizontalDistance ; Make the group move to the WP in increments, unless it's closer than the increment ? (_distanceToPatrolPoint > 100) : {_x doMove ([getpos _leader, _patrolPoint] call CSL_GetMoveIncrementInfantry)} forEach units _spawnGroup ; if it's closer than the increment, just make it go there ? (_distanceToPatrolPoint <= 100) : {_x doMove _patrolPoint} forEach units _spawnGroup ; alternate style of the above, less mobbish, but probably won't engage correctly when ; enemy presence detected ;; Make the group move to the WP in increments, unless it's closer than the increment ;? (_distanceToPatrolPoint > 100) : _leader doMove ([getpos _leader, _patrolPoint] call CSL_GetMoveIncrementInfantry) ; ;; if it's closer than the increment, just make it go there ;? (_distanceToPatrolPoint <= 100) : _leader doMove _patrolPoint ; ; {if (_x != _leader) then {_x doFollow _leader}} forEach units _spawnGroup ; sets the combat mode and behaviour of the leader. ; done this way, due to the possibillity of the old leader dying _leader setCombatMode _garrisonCombatMode _leader setBehaviour _garrisonBehaviour ; stop execution if the group is completely dead ? (count units _spawnGroup < 1) : goto "exitScript" ; if the garrison hasn't reached the patrol point yet, order it again ? (_distanceToPatrolPoint > _garrisonPatrolAccuracy) : goto "moveToPatrolPoint" ; if the garrison isn't on eternal patrol, cease execution ?_garrisonPatrol : goto "patrol" #exitScript Seems like alot, but its not. You should be able to get at least 20 secs per delay before re-executing his .sqf to get new position to your destination (player), youll have to test to see what works best tho. Ive used ColonelSandersLite app here in many places, and basically in the same syntax application, where long distance doMoves were needed. Unfortunately, in Arma, seems regardless of distance, if pathing is through areas of extreme terrain, some times the ai wont do anything, no matter what. Share this post Link to post Share on other sites
mattxr 9 Posted February 13, 2007 Im using snipers, and all that you just posted is very confusing to me ^^ .. btw this is what im using atm. maybe if you could get that into sqf? Quote[/b] ]_vehicle = _this select 0 _delay = 1 _x = random 10 _vehicle allowfleeing 0 _vehicle setbehaviour "STEALTH" _vehicle setspeedmode "FULL" #Begin _vehicle setUnitPos "AUTO" ?!(alive _vehicle):goto exit _x = random 10 ?_x <= 1 : goto "0" ?_x <= 2 : goto "1" ?_x <= 3 : goto "2" ?_x <= 4 : goto "3" ?_x <= 5 : goto "4" ?_x <= 6 : goto "5" ?_x <= 7 : goto "6" ?_x <= 8 : goto "7" ?_x <= 9 : goto "8" #0 _vehicle setUnitPos "AUTO" _vehile doTarget S1 _vehicle doFire S1 _vehicle domove [((getpos S1 select 0) + 1), ((getpos S1 select 1) - 0),((getpos S1 select 2) + 0)] ~10 ?!(alive S1):goto "Begin" ?(alive S1):goto "0" #1 _vehile doTarget S2 _vehicle doFire S2 _vehicle domove [((getpos S2 select 0) + 1), ((getpos S2 select 1) - 0),((getpos S2 select 2) + 0)] ~10 ?!(alive S2):goto "Begin" ?(alive S2):goto "1" #2 _vehile doTarget S3 _vehicle doFire S3 _vehicle domove [((getpos S3 select 0) + 1), ((getpos S3 select 1) - 0),((getpos S3 select 2) + 0)] ~10 ?!(alive S3):goto "Begin" ?(alive S3):goto "2" #3 _vehile doTarget S4 _vehicle doFire S4 _vehicle domove [((getpos S4 select 0) + 1), ((getpos S4 select 1) - 0),((getpos S4 select 2) + 0)] ~10 ?!(alive S4):goto "Begin" ?(alive S4):goto "3" #4 _vehile doTarget S5 _vehicle doFire S5 _vehicle domove [((getpos S5 select 0) + 1), ((getpos S5 select 1) - 0),((getpos S5 select 2) + 0)] ~10 ?!(alive S5):goto "Begin" ?(alive S5):goto "4" #5 _vehile doTarget S6 _vehicle doFire S6 _vehicle domove [((getpos S6 select 0) + 1), ((getpos S6 select 1) - 0),((getpos S6 select 2) + 0)] ~10 ?!(alive S6):goto "Begin" ?(alive S6):goto "5" #6 _vehile doTarget S7 _vehicle doFire S7 _vehicle domove [((getpos S7 select 0) + 1), ((getpos S7 select 1) - 0),((getpos S7 select 2) + 0)] ~10 ?!(alive S7):goto "Begin" ?(alive S7):goto "6" #7 _vehile doTarget S8 _vehicle doFire S8 _vehicle domove [((getpos S8 select 0) + 1), ((getpos S8 select 1) - 0),((getpos S8 select 2) + 0)] ~10 ?!(alive S8):goto "Begin" ?(alive S8):goto "7" #8 _vehile doTarget S9 _vehicle doFire S9 _vehicle domove [((getpos S9 select 0) + 1), ((getpos S9 select 1) - 0),((getpos S9 select 2) + 0)] ~10 ?!(alive S9):goto "Begin" ?(alive S9):goto "8" exit Share this post Link to post Share on other sites
Cloughy 0 Posted February 13, 2007 Might be a stupid question. But, why dont you just use a guard waypoint? When i use them with Full speed, Open Fire, Engage at will, the commies go to you last contact with the enemy. Eventually track you down, or if its a long contact, they may have time to catch you. Edit:- Just seen your last post. The guard works great with snipers, cause they will take pot shots at you from a distance. Cheers GC Share this post Link to post Share on other sites
Guest Posted February 13, 2007 Im using snipers, and all that you just posted is very confusing to me ^^ .. btw this is what im using atm.maybe if you could get that into sqf? Again, this is using ColonelSandersLite's .sqf files there, so the credit is really due him for this application, heres what should work for your script. I did re-edit the sqf file to use the original infantry type, so just copy those two current sqf files and their appropriate names from the other post, then of course initalize them thru init same way I did in that post. btw- u dont have to use the horizontal distance sqf to get the distance between _vehicle and S1 (or S2, etc), I just use it by default, you can just get distance directly if you want, the normal use for that sqf is for air vehicles distance to destination (eliminates altitude differences factored into distance results) <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _vehicle = _this select 0 _delay = 1 _x = random 10 _vehicle allowfleeing 0 _vehicle setbehaviour "STEALTH" _vehicle setspeedmode "FULL" #Begin _vehicle setUnitPos "AUTO" ?!(alive _vehicle):goto exit _x = random 10 ?_x <= 1 : goto "0" ?_x <= 2 : goto "1" ?_x <= 3 : goto "2" ?_x <= 4 : goto "3" ?_x <= 5 : goto "4" ?_x <= 6 : goto "5" ?_x <= 7 : goto "6" ?_x <= 8 : goto "7" ?_x <= 9 : goto "8" #0 _vehicle setUnitPos "AUTO" _vehile doTarget S1 _vehicle doFire S1 ; get Distance To Desired Unit _distanceToUnit = [getpos _vehicle, getpos S1] call CSL_GetHorizontalDistance ; Make the unit move to the destination in increments, unless it's closer than the increment ? (_distanceToUnit > 150) : _vehicle doMove ([getpos _vehicle,getpos S1] call CSL_GetMoveIncrementInfantry) ; if it's closer than the increment, just make it go there ? (_distanceToUnit <= 150) : _vehicle doMove getPos S1 ~15 ?!(alive S1):goto "Begin" ?(alive S1):goto "0" #1 _vehile doTarget S2 _vehicle doFire S2 ; get Distance To Desired Unit _distanceToUnit = [getpos _vehicle, getpos S2] call CSL_GetHorizontalDistance ; Make the unit move to the destination in increments, unless it's closer than the increment ? (_distanceToUnit > 150) : _vehicle doMove ([getpos _vehicle,getpos S2] call CSL_GetMoveIncrementInfantry) ; if it's closer than the increment, just make it go there ? (_distanceToUnit <= 150) : _vehicle doMove getPos S2 ~15 ?!(alive S2):goto "Begin" ?(alive S2):goto "1" #2 _vehile doTarget S3 _vehicle doFire S3 ; get Distance To Desired Unit _distanceToUnit = [getpos _vehicle, getpos S3] call CSL_GetHorizontalDistance ; Make the unit move to the destination in increments, unless it's closer than the increment ? (_distanceToUnit > 150) : _vehicle doMove ([getpos _vehicle,getpos S3] call CSL_GetMoveIncrementInfantry) ; if it's closer than the increment, just make it go there ? (_distanceToUnit <= 150) : _vehicle doMove getPos S3 ~15 ?!(alive S3):goto "Begin" ?(alive S3):goto "2" #3 _vehile doTarget S4 _vehicle doFire S4 ; get Distance To Desired Unit _distanceToUnit = [getpos _vehicle, getpos S4] call CSL_GetHorizontalDistance ; Make the unit move to the destination in increments, unless it's closer than the increment ? (_distanceToUnit > 150) : _vehicle doMove ([getpos _vehicle,getpos S4] call CSL_GetMoveIncrementInfantry) ; if it's closer than the increment, just make it go there ? (_distanceToUnit <= 150) : _vehicle doMove getPos S4 ~15 ?!(alive S4):goto "Begin" ?(alive S4):goto "3" #4 _vehile doTarget S5 _vehicle doFire S5 ; get Distance To Desired Unit _distanceToUnit = [getpos _vehicle, getpos S5] call CSL_GetHorizontalDistance ; Make the unit move to the destination in increments, unless it's closer than the increment ? (_distanceToUnit > 150) : _vehicle doMove ([getpos _vehicle,getpos S5] call CSL_GetMoveIncrementInfantry) ; if it's closer than the increment, just make it go there ? (_distanceToUnit <= 150) : _vehicle doMove getPos S5 ~15 ?!(alive S5):goto "Begin" ?(alive S5):goto "4" #5 _vehile doTarget S6 _vehicle doFire S6 ; get Distance To Desired Unit _distanceToUnit = [getpos _vehicle, getpos S6] call CSL_GetHorizontalDistance ; Make the unit move to the destination in increments, unless it's closer than the increment ? (_distanceToUnit > 150) : _vehicle doMove ([getpos _vehicle,getpos S6] call CSL_GetMoveIncrementInfantry) ; if it's closer than the increment, just make it go there ? (_distanceToUnit <= 150) : _vehicle doMove getPos S6 ~15 ?!(alive S6):goto "Begin" ?(alive S6):goto "5" #6 _vehile doTarget S7 _vehicle doFire S7 ; get Distance To Desired Unit _distanceToUnit = [getpos _vehicle, getpos S7] call CSL_GetHorizontalDistance ; Make the unit move to the destination in increments, unless it's closer than the increment ? (_distanceToUnit > 150) : _vehicle doMove ([getpos _vehicle,getpos S7] call CSL_GetMoveIncrementInfantry) ; if it's closer than the increment, just make it go there ? (_distanceToUnit <= 150) : _vehicle doMove getPos S7 ~15 ?!(alive S7):goto "Begin" ?(alive S7):goto "6" #7 _vehile doTarget S8 _vehicle doFire S8 ; get Distance To Desired Unit _distanceToUnit = [getpos _vehicle, getpos S8] call CSL_GetHorizontalDistance ; Make the unit move to the destination in increments, unless it's closer than the increment ? (_distanceToUnit > 150) : _vehicle doMove ([getpos _vehicle,getpos S8] call CSL_GetMoveIncrementInfantry) ; if it's closer than the increment, just make it go there ? (_distanceToUnit <= 150) : _vehicle doMove getPos S8 ~15 ?!(alive S8):goto "Begin" ?(alive S8):goto "7" #8 _vehile doTarget S9 _vehicle doFire S9 ; get Distance To Desired Unit _distanceToUnit = [getpos _vehicle, getpos S9] call CSL_GetHorizontalDistance ; Make the unit move to the destination in increments, unless it's closer than the increment ? (_distanceToUnit > 150) : _vehicle doMove ([getpos _vehicle,getpos S9] call CSL_GetMoveIncrementInfantry) ; if it's closer than the increment, just make it go there ? (_distanceToUnit <= 150) : _vehicle doMove getPos S9 ~15 ?!(alive S9):goto "Begin" ?(alive S9):goto "8" exit Share this post Link to post Share on other sites
Big Dawg KS 6 Posted February 13, 2007 Im using snipers, and all that you just posted is very confusing to me ^^ .. btw this is what im using atm.maybe if you could get that into sqf? Quote[/b] ]... Holy crap! That is way too long, much longer than it needs to be. I suggest you use this: Ex. of the parameters: [group hunter1,[s1,S2,S3,S4,S5,S6,S7,S8,S9]] execVM... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_hunters = _this select 0; _targets = _this select 1; _target = objNull; {_X allowfleeing 0} foreach (units _hunters); waitUntil{ while{(isNull _target || !(alive _target))&&({alive _X} count _targets >= 1)}do{_i = floor random (count _targets); _target = _targets select _i}; if({_X distance _target < 20} count (units _hunters) >= 1)then{{_X dotarget _target; _X dofire _target} foreach (units _hunters); dostop (units _hunters)}else{_hunters move (getpos _target)}; sleep 5; ({alive _X} count (units _targets) <= 0) || ({alive _X} count (units _hunters) <= 0) }; But if you insist on using sqs sytnax, this is your same script only shortened: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vehicle = _this select 0 _vehicle allowfleeing 0 _vehicle setbehaviour "STEALTH" _vehicle setspeedmode "FULL" _vehicle setUnitPos "AUTO" #Begin _list = [S1,S2,S3,S4,S5,S6,S7,S8,S9] _x = floor random (count _list) _target = _list select _x #Loop ?!(alive _vehicle): exit _vehile doTarget _target _vehicle doFire _target _vehicle domove [((getpos _target select 0) + 1), ((getpos _target select 1) - 0),((getpos _target select 2) + 0)] ~10 ?(alive _target): goto "Loop" goto "Begin" Also, just for your information, Stealth probably isn't the best behaviour for the hunter to be in since it causes him to go prone a lot and move very slowly, and it might even discourage him from engaging (though I'm not sure). Share this post Link to post Share on other sites