Ice_Rhino 3 Posted September 19, 2014 Hi (Again) Is there a way to get enemy forces to stalk and then attack the human player group. My group is called 'bluplagro' Thanks Toni IR Share this post Link to post Share on other sites
iceman77 18 Posted September 20, 2014 (edited) //Place this code anywhere in your init.sqf [] spawn { if (!isServer) exitWith {}; while {true} do { { if (getNumber (configfile >> "CfgVehicles" >> typeOf _x >> "side") in [0,2]) then { _x doMove getPosATL (leader myGrp); }; } forEach allUnits; sleep 60; }; }; or //Place this code anywhere in your init.sqf [] spawn { while {true} do { { if (side _x in [Opfor, Independent]) then { _x doMove getPosATL (leader bluplagro); }; } forEach allUnits; sleep 60; }; }; or //Place this code anywhere in your init.sqf [] spawn { if (!isServer) exitWith {}; while {true} do { { if (side _x != side (leader bluplagro)) then { _x doMove getPosATL (leader bluplagro); }; } forEach allUnits; sleep 60; }; }; or Could mess around with behaviours and such. w/e... [] spawn { while {true} do { { if (side _x in [Opfor, Independent]) then { _x doMove getPosATL (leader bluplagro); if (_x distance (leader bluplagro) < 100 && {behaviour _x != "COMBAT"}) then { (group _x) setBehaviour "COMBAT"; } else { (group _x) setBehaviour "AWARE"; }; }; } forEach allUnits; sleep 60; }; }; Edited September 20, 2014 by Iceman77 Share this post Link to post Share on other sites
Ice_Rhino 3 Posted September 20, 2014 Thank you IM77. I shall try your suggestions Toni IR Share this post Link to post Share on other sites
Gunter Severloh 4041 Posted September 20, 2014 Various posts related to this: These are from Arma2CO but the codes and concepts should work AI hunting player http://www.armaholic.com/forums.php?m=posts&q=8777&n=last#bottom Making enemy units chase player http://forums.bistudio.com/showthread.php?119376-Making-enemy-units-chase-player&highlight=chase All remaining enemy Chase player/team http://forums.bistudio.com/showthread.php?120914-All-remaining-enemy-Chase-player-team&highlight=chase Trying do make enemy hunt player script http://forums.bistudio.com/showthread.php?143249-Trying-do-make-enemy-hunt-player-script Enemies follow players? http://forums.bistudio.com/showthread.php?142242-Enemies-follow-players&highlight=paradrop Group chasing/hunting the player http://forums.bistudio.com/showthread.php?132772-Group-chasing-hunting-the-player&highlight=paradrop Also this mission for Arma3 btw has all the enemies stalk and hunt the player: Escape Roy http://www.armaholic.com/page.php?id=26558 Share this post Link to post Share on other sites
Ice_Rhino 3 Posted September 20, 2014 Thank you very much Gunter Toni IR Share this post Link to post Share on other sites
Gunter Severloh 4041 Posted September 20, 2014 Welcome. If you need anything more related for AI see my list here: http://forums.bistudio.com/showthread.php?175400-AI-Compilation-List-of-Addons-Mods-Scripts-amp-Misc&p=2656299#post2656299 Share this post Link to post Share on other sites
sttosin 67 Posted September 20, 2014 How about the opposite-ish? Any script to make AI retreat to new position when player pushes closer than distance y? Share this post Link to post Share on other sites
iceman77 18 Posted September 20, 2014 How about the opposite-ish? Any script to make AI retreat to new position when player pushes closer than distance y? Untested, probably better ways. // Put anywhere in your init.sqf [] spawn { while {true} do { { if (_x distance player < 200 && {side _x != side player}) then { _x doMove (player modelToWorld [0,1000,0]); }; } forEach allUnits; sleep 30; }; }; Share this post Link to post Share on other sites
sttosin 67 Posted September 20, 2014 Thanks! Will test asap Share this post Link to post Share on other sites
iceman77 18 Posted September 20, 2014 To get the ai to act properly, you may have to tinker with the ai's behaviours and such. Maybe disableAI too. If not, they may simply want to turn and attack you. Share this post Link to post Share on other sites
sttosin 67 Posted September 20, 2014 hmm. I am testing this with bcombat and vcom AI with mixed results. Is there such a thing as forcemove command which stops them from doing anything while retreating? Share this post Link to post Share on other sites
iceman77 18 Posted September 20, 2014 See post #10. Share this post Link to post Share on other sites
sttosin 67 Posted September 20, 2014 See post #10. Once I get another chance I'll test with _x disableAI "FSM"; //then re enable it? Thanks for the tips/ Share this post Link to post Share on other sites
sttosin 67 Posted September 21, 2014 This + Bcombat seems to be the sweet spot for the type of AI behavior I was looking for. Not too agressive but not always turning their back on bullets flying either. Play tested on PR Afghanistan Village with POMI PMC and very much a treat. [] spawn { while {true} do { { if (_x distance player < 250 && {side _x != side player}) then { _x disableAI "AUTOTARGET"; _x disableAI "TARGET"; _x doMove (player modelToWorld [0,300,0]); }; } forEach allUnits; sleep 10; _x enableAI "AUTOTARGET"; _x enableAI "TARGET"; }; }; Iceman thanks for your help! Share this post Link to post Share on other sites
fabrizio_t 58 Posted September 22, 2014 This + Bcombat seems to be the sweet spot for the type of AI behavior I was looking for. Not too agressive but not always turning their back on bullets flying either. Play tested on PR Afghanistan Village with POMI PMC and very much a treat. [] spawn { while {true} do { { if (_x distance player < 250 && {side _x != side player}) then { _x disableAI "AUTOTARGET"; _x disableAI "TARGET"; _x doMove (player modelToWorld [0,300,0]); }; } forEach allUnits; sleep 10; _x enableAI "AUTOTARGET"; _x enableAI "TARGET"; }; }; Iceman thanks for your help! You may consider to add: (group_x) setCombatMode "GREEN"; // Temporarily HOLD fire _x dowatch objNull; // Force disengage _x disableAI "FSM"; EDIT: by the way, till now i hardly saw any visible effects caused by disableAI "FSM", but it's probably worth adding. Share this post Link to post Share on other sites
sttosin 67 Posted September 22, 2014 Thanks fabrizio_T. Will give this a try. Didn't notice much with disableAI "FSM" either after much testing. Share this post Link to post Share on other sites
sttosin 67 Posted September 23, 2014 (edited) Anyone care to try this out: [] spawn { while {true} do { { if (_x distance player < 250 && {side _x != side player}) then { _x disableAI "AUTOTARGET"; _x disableAI "TARGET"; (group_x) setCombatMode "GREEN"; // Temporarily HOLD fire _x dowatch objNull; // Force disengage //_x disableAI "FSM"; _chance = round(random 5); switch _chance do { case 0: { _x doMove (player modelToWorld [300,300,0]); }; case 1: { _x doMove (player modelToWorld [300,-300,0]); }; case 2: { _x doMove (player modelToWorld [-300,300,0]); }; case 3: { _x doMove (player modelToWorld [-250,250,0]); }; case 4: { _x doMove (player modelToWorld [250,250,0]); }; case 5: { _x doMove (player modelToWorld [250,-250,0]); }; }; }; } forEach allUnits; sleep 30; _x enableAI "AUTOTARGET"; _x enableAI "TARGET"; //_x enableAI "FSM"; //sleep 60; }; }; Edited September 26, 2014 by sttosin Share this post Link to post Share on other sites