redburn 20 Posted August 10, 2018 Hi, I need a help guys, can someone make me a simple script, where the enemy on the map chases the player wherever he moves? I tried some but I did not do anything, I have not been doing anything wrong, could you help me with this please? Share this post Link to post Share on other sites
davidoss 552 Posted August 10, 2018 [] spawn { while {alive player} do { sleep 30; {_x move (position player)} forEach (allGroups select {((side _x) getFriend (side player)) < 0.6}); }; }; 2 1 Share this post Link to post Share on other sites
Jnr4817 215 Posted August 10, 2018 This is a great script that will spawn in a group and chase players. 1 1 Share this post Link to post Share on other sites
Mr H. 402 Posted August 10, 2018 This function does exactly that: https://community.bistudio.com/wiki/BIS_fnc_stalk 3 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted August 10, 2018 (edited) Just now, GEORGE FLOROS GR said: 10 hours ago, redburn said: tell me add in your init or initServer.sqf Reveal hidden contents //________________ Author : [GR]GEORGE F ___________ 12.08.18 _____________ /* ________________ GF Hunting Groups ________________ Please keep the Credits or add them to your Diary https://community.bistudio.com/wiki/SQF_syntax Don't try to open this with the simple notepad. For everything that is with comment // in front or between /* means that it is disabled , so there is no need to delete the extra lines. You can open this ex: with notepad++ https://notepad-plus-plus.org/ and also use the extra pluggins (this way will be better , it will give also some certain colours to be able to detect ex. problems ) http://www.armaholic.com/page.php?id=8680 or use any other program for editing . For the Compilation List of my GF Scripts , you can search in: https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/ */ GF_Hunted_Players = allUnits select {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}}; GF_Hunted_Player_selected = GF_Hunted_Players call BIS_fnc_selectRandom; hint format ["GF_Hunted_Player %1 ",GF_Hunted_Player_selected]; systemchat format ["GF_Hunted_Player %1 ",GF_Hunted_Player_selected]; GF_Hunting_Group_spawn_time = 10; // The time to spawn the next GF_Hunting_Group [] spawn { while {true} do { _time = diag_tickTime + 1; _i = 0; waitUntil { sleep GF_Hunting_Group_spawn_time; _i = _i + 1; diag_tickTime >= _time }; [] execVM "Recon_Hunting_Group.sqf"; // hint "Recon_Hunting_Group.sqf"; }; }; [] spawn { while {true} do { _time = diag_tickTime + 1; _i = 0; waitUntil { sleep 20; // The time to Hunt the next random Player _i = _i + 1; diag_tickTime >= _time }; GF_Hunted_Player_selected = GF_Hunted_Players call BIS_fnc_selectRandom; //hint format ["GF_Hunted_Player %1 ",GF_Hunted_Player_selected]; //systemchat format ["GF_Hunted_Player %1 ",GF_Hunted_Player_selected]; }; }; Then create an .sqf _Recon_Hunting_Group.sqf Reveal hidden contents Edited August 12, 2018 by GEORGE FLOROS GR updated code 1 1 Share this post Link to post Share on other sites
redburn 20 Posted August 12, 2018 On 10/8/2018 at 5:02 PM, GEORGE FLOROS GR said: On 7/8/2018 at 12:07 PM, GEORGE FLOROS GR said: For anyone who is interested: This hunting script is part of my mission WIP Salvation 2 To set a hunting Group : add in your init or initServer.sqf Reveal hidden contents //________________ Author : [GR]GEORGE F ___________ 05.08.18 _____________ /* Please keep the Credits or add them to your Diary https://community.bistudio.com/wiki/SQF_syntax Don't try to open this with the simple notepad. For everything that is with comment // in front or between /* means that it is disabled , so there is no need to delete the extra lines. You can open this ex: with notepad++ https://notepad-plus-plus.org/ and also use the extra pluggins (this way will be better , it will give also some certain colours to be able to detect ex. problems ) http://www.armaholic.com/page.php?id=8680 or use any other program for editing . For the Compilation List of my GF Scripts , you can search in: https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/ */ //_________________________ GF_Get_AllPlayers_Positions_Salvation _________________________ GF_Get_AllPlayers_Positions_Salvation = { private ["_playerPositions"]; _playerPositions = []; if (isMultiplayer) then { { if (isPlayer _x) then { _playerPositions pushBack (position vehicle _x); }; } foreach (playableUnits); }else { if (player == player) then { _playerPositions = [position vehicle player]; }; }; _playerPositions }; GetAllPlayersPositions = call GF_Get_AllPlayers_Positions_Salvation; GF_Select_One_Player_Position_Salvation = GetAllPlayersPositions call BIS_fnc_selectRandom; // hint format ["Player Position %1 ",GF_Select_One_Player_Position_Salvation]; [] spawn { while {true} do { _time = diag_tickTime + 1; _i = 0; waitUntil { sleep 900; // The time to get the next random Player position _i = _i + 1; diag_tickTime >= _time }; GF_Select_One_Player_Position_Salvation = GetAllPlayersPositions call BIS_fnc_selectRandom; // hint format ["Player Position %1 ",GF_Select_One_Player_Position_Salvation]; }; }; GF_spawn_time = 15; // The time to spawn the next Group [] spawn { while {true} do { _time = diag_tickTime + 1; _i = 0; waitUntil { sleep GF_spawn_time; _i = _i + 1; diag_tickTime >= _time }; [] execVM "Hunting_Groups\Ravage_Zombies_Group.sqf"; // hint "Hunting_Groups\Ravage_Zombies_Group.sqf"; }; }; Then create an .sqf with your name , like: Ravage_Zombies_Group.sqf mine is on Hunting_Groups folder Reveal hidden contents //________________ Author : [GR]GEORGE F ___________ 05.08.18 _____________ /* Please keep the Credits or add them to your Diary https://community.bistudio.com/wiki/SQF_syntax Don't try to open this with the simple notepad. For everything that is with comment // in front or between /* means that it is disabled , so there is no need to delete the extra lines. You can open this ex: with notepad++ https://notepad-plus-plus.org/ and also use the extra pluggins (this way will be better , it will give also some certain colours to be able to detect ex. problems ) http://www.armaholic.com/page.php?id=8680 or use any other program for editing . For the Compilation List of my GF Scripts , you can search in: https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/ */ if (!isServer) exitWith {}; // hint"_GF_Ravage_Zombies_Group"; #define _GF_Ravage_Zombies_Group "zombie_runner","zombie_walker","zombie_bolter","zombie_runner","zombie_walker","zombie_bolter","zombie_runner","zombie_walker","zombie_bolter","zombie_runner","zombie_walker","zombie_bolter","zombie_runner","zombie_walker","zombie_bolter" _enemiesArray = [grpNull]; _GF_Ravage_Zombies_Teams = createGroup independent; _GF_randomPos = [[[GF_Select_One_Player_Position_Salvation, (1500)],[]],["water","out"]] call BIS_fnc_randomPos; _GF_Ravage_Zombies_Teams = [_GF_randomPos, independent,[_GF_Ravage_Zombies_Group]] call BIS_fnc_spawnGroup; _GF_Ravage_Zombies_Teams setCombatMode "YELLOW"; _enemiesArray = _enemiesArray + [_GF_Ravage_Zombies_Teams]; while {true} do { _time = diag_tickTime + 1; _i = 0; waitUntil { sleep 50; _i = _i + 1; diag_tickTime >= _time }; // hint "WP updated"; { deleteWaypoint [_x, 0]; _Updating_WP = _x addWaypoint [(GF_Select_One_Player_Position_Salvation ) ,0]; _Updating_WP setWaypointType "SAD"; // SAD MOVE _x setCombatMode "YELLOW"; // YELLOW RED _x setSpeedMode "NORMAL"; // NORMAL FULL _x allowFleeing 0; }foreach [_GF_Ravage_Zombies_Teams]; }; Define your desired group : #define _GF_Ravage_Zombies_Group "zombie_runner","zombie_walker","zombie_bolter" Keeping steady numbers is good for performance. I was trying your Script, at the beginning if they appear in several areas, but not as the game progresses they keep appearing in the same place they appeared the first time, and they do not follow you wherever you go, they only go to the point where You started in the game. Here only change the name for other sqf script and the time of spawn the units: //initServer.sqf //________________ Author : [GR]GEORGE F ___________ 05.08.18 _____________ /* Please keep the Credits or add them to your Diary https://community.bistudio.com/wiki/SQF_syntax Don't try to open this with the simple notepad. For everything that is with comment // in front or between /* means that it is disabled , so there is no need to delete the extra lines. You can open this ex: with notepad++ https://notepad-plus-plus.org/ and also use the extra pluggins (this way will be better , it will give also some certain colours to be able to detect ex. problems ) http://www.armaholic.com/page.php?id=8680 or use any other program for editing . For the Compilation List of my GF Scripts , you can search in: https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/ */ //_________________________ GF_Get_AllPlayers_Positions_Salvation _________________________ GF_Get_AllPlayers_Positions_Salvation = { private ["_playerPositions"]; _playerPositions = []; if (isMultiplayer) then { { if (isPlayer _x) then { _playerPositions pushBack (position vehicle _x); }; } foreach (playableUnits); }else { if (player == player) then { _playerPositions = [position vehicle player]; }; }; _playerPositions }; GetAllPlayersPositions = call GF_Get_AllPlayers_Positions_Salvation; GF_Select_One_Player_Position_Salvation = GetAllPlayersPositions call BIS_fnc_selectRandom; // hint format ["Player Position %1 ",GF_Select_One_Player_Position_Salvation]; [] spawn { while {true} do { _time = diag_tickTime + 1; _i = 0; waitUntil { sleep 900; // The time to get the next random Player position _i = _i + 1; diag_tickTime >= _time }; GF_Select_One_Player_Position_Salvation = GetAllPlayersPositions call BIS_fnc_selectRandom; // hint format ["Player Position %1 ",GF_Select_One_Player_Position_Salvation]; }; }; GF_spawn_time = 40; // The time to spawn the next Group [] spawn { while {true} do { _time = diag_tickTime + 1; _i = 0; waitUntil { sleep GF_spawn_time; _i = _i + 1; diag_tickTime >= _time }; [] execVM "Perseguidores.sqf"; // hint "Hunting_Groups\Ravage_Zombies_Group.sqf"; }; }; I change alone independent by opfor: //Perseguidores.sqf //________________ Author : [GR]GEORGE F ___________ 05.08.18 _____________ /* Please keep the Credits or add them to your Diary https://community.bistudio.com/wiki/SQF_syntax Don't try to open this with the simple notepad. For everything that is with comment // in front or between /* means that it is disabled , so there is no need to delete the extra lines. You can open this ex: with notepad++ https://notepad-plus-plus.org/ and also use the extra pluggins (this way will be better , it will give also some certain colours to be able to detect ex. problems ) http://www.armaholic.com/page.php?id=8680 or use any other program for editing . For the Compilation List of my GF Scripts , you can search in: https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/ */ if (!isServer) exitWith {}; // hint"_GF_Ravage_Zombies_Group"; #define _GF_Ravage_Zombies_Group "rhsgref_ins_rifleman_akm","rhsgref_ins_rifleman_aks74","rhsgref_ins_rifleman","rhsgref_ins_machinegunner","rhsgref_ins_rifleman_aksu","zombie_bolter","zombie_runner" _enemiesArray = [grpNull]; _GF_Ravage_Zombies_Teams = createGroup opfor; //I was change independient for opfor _GF_randomPos = [[[GF_Select_One_Player_Position_Salvation, (1500)],[]],["water","out"]] call BIS_fnc_randomPos; _GF_Ravage_Zombies_Teams = [_GF_randomPos, opfor,[_GF_Ravage_Zombies_Group]] call BIS_fnc_spawnGroup; _GF_Ravage_Zombies_Teams setCombatMode "YELLOW"; _enemiesArray = _enemiesArray + [_GF_Ravage_Zombies_Teams]; while {true} do { _time = diag_tickTime + 1; _i = 0; waitUntil { sleep 50; _i = _i + 1; diag_tickTime >= _time }; // hint "WP updated"; { deleteWaypoint [_x, 0]; _Updating_WP = _x addWaypoint [(GF_Select_One_Player_Position_Salvation ) ,0]; _Updating_WP setWaypointType "SAD"; // SAD MOVE _x setCombatMode "YELLOW"; // YELLOW RED _x setSpeedMode "NORMAL"; // NORMAL FULL _x allowFleeing 0; }foreach [_GF_Ravage_Zombies_Teams]; }; Could you tell me what I could be doing wrong? 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted August 12, 2018 6 hours ago, redburn said: Could you tell me Hold on let me check this! Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted August 12, 2018 8 hours ago, redburn said: Could you tell Yes you are right ! I have fix this now , but i 'll check this more! Because there was also this problem before , so maybe i messed up with the files ! Once it's ok , i'll post this again ! Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted August 12, 2018 10 hours ago, redburn said: tell me add in your init or initServer.sqf Spoiler //________________ Author : [GR]GEORGE F ___________ 12.08.18 _____________ /* ________________ GF Hunting Groups ________________ Please keep the Credits or add them to your Diary https://community.bistudio.com/wiki/SQF_syntax Don't try to open this with the simple notepad. For everything that is with comment // in front or between /* means that it is disabled , so there is no need to delete the extra lines. You can open this ex: with notepad++ https://notepad-plus-plus.org/ and also use the extra pluggins (this way will be better , it will give also some certain colours to be able to detect ex. problems ) http://www.armaholic.com/page.php?id=8680 or use any other program for editing . For the Compilation List of my GF Scripts , you can search in: https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/ */ GF_Hunted_Players = allUnits select {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}}; GF_Hunted_Player_selected = GF_Hunted_Players call BIS_fnc_selectRandom; hint format ["GF_Hunted_Player %1 ",GF_Hunted_Player_selected]; systemchat format ["GF_Hunted_Player %1 ",GF_Hunted_Player_selected]; GF_Hunting_Group_spawn_time = 10; // The time to spawn the next GF_Hunting_Group [] spawn { while {true} do { _time = diag_tickTime + 1; _i = 0; waitUntil { sleep GF_Hunting_Group_spawn_time; _i = _i + 1; diag_tickTime >= _time }; [] execVM "Recon_Hunting_Group.sqf"; // hint "Recon_Hunting_Group.sqf"; }; }; [] spawn { while {true} do { _time = diag_tickTime + 1; _i = 0; waitUntil { sleep 20; // The time to Hunt the next random Player _i = _i + 1; diag_tickTime >= _time }; GF_Hunted_Player_selected = GF_Hunted_Players call BIS_fnc_selectRandom; //hint format ["GF_Hunted_Player %1 ",GF_Hunted_Player_selected]; //systemchat format ["GF_Hunted_Player %1 ",GF_Hunted_Player_selected]; }; }; Then create an .sqf _Recon_Hunting_Group.sqf Spoiler //________________ Author : [GR]GEORGE F ___________ 12.08.18 _____________ /* ________________ GF Hunting Groups ________________ Please keep the Credits or add them to your Diary https://community.bistudio.com/wiki/SQF_syntax Don't try to open this with the simple notepad. For everything that is with comment // in front or between /* means that it is disabled , so there is no need to delete the extra lines. You can open this ex: with notepad++ https://notepad-plus-plus.org/ and also use the extra pluggins (this way will be better , it will give also some certain colours to be able to detect ex. problems ) http://www.armaholic.com/page.php?id=8680 or use any other program for editing . For the Compilation List of my GF Scripts , you can search in: https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/ */ if (!isServer) exitWith {}; hint"_Recon_Hunting_Group"; #define _Recon_Hunting_Group "I_Soldier_SL_F", "I_Soldier_TL_F", "I_soldier_UAV_F", "I_Soldier_M_F","I_medic_F","I_Soldier_AR_F" _enemies_Array = [grpNull]; _Recon_Hunting_Teams = createGroup independent; _GF_randomPos = [[[GF_Hunted_Player_selected, (1500)],[]],["water","out"]] call BIS_fnc_randomPos; _Recon_Hunting_Teams = [_GF_randomPos, independent,[_Recon_Hunting_Group]] call BIS_fnc_spawnGroup; _Recon_Hunting_Teams setCombatMode "YELLOW"; _Recon_Hunting_Teams setSpeedMode "NORMAL"; _Recon_Hunting_Teams allowFleeing 0; _Waypoint =_Recon_Hunting_Teams addWaypoint [(GF_Hunted_Player_selected ) ,0]; _Waypoint setWaypointType "SAD"; _enemies_Array = _enemies_Array + [_Recon_Hunting_Teams]; while {true} do { _time = diag_tickTime + 1; _i = 0; waitUntil { sleep 10; _i = _i + 1; diag_tickTime >= _time }; hint "_Updating_WP"; { deleteWaypoint [_x, 0]; _Updating_WP = _x addWaypoint [(GF_Hunted_Player_selected ) ,0]; _Updating_WP setWaypointType "SAD"; // SAD MOVE _x setCombatMode "YELLOW"; // YELLOW RED _x setSpeedMode "NORMAL"; // NORMAL FULL _x allowFleeing 0; }foreach [_Recon_Hunting_Teams]; }; 1 2 Share this post Link to post Share on other sites
redburn 20 Posted August 13, 2018 Spoiler thanks @GEORGE FLOROS GR, Now if the Script is working, I've done tests teleportandome to several places and it works well, now I just need to be able to customize the ability of the AI to adjust it to the players and not be so expert. 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted August 13, 2018 18 hours ago, redburn said: now I just need to be able to customize the ability of the AI to adjust it to the players and not be so expert. check here: Share this post Link to post Share on other sites
redburn 20 Posted August 14, 2018 48 minutes ago, GEORGE FLOROS GR said: check here: thank you brother :D Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted April 14, 2019 I have add a script above in August 12, 2018, but actually the best is to use the : https://community.bistudio.com/wiki/BIS_fnc_stalk Share this post Link to post Share on other sites