He'sCalledTheStig 4 Posted May 14, 2020 So I found this line somewhere that goes in the init box of the AI vehicle, or the group leader. I want to change it to target the nearest player/playable character instead of "the player". _null = this spawn { Hunt_players_fnc = { _player = ""; { if (isPlayer _x AND alive _x) then {_player = _x}; } foreach (playableUnits + switchAbleUnits); _wp = _this addWaypoint [getPos _player, (50 + (floor(random 70)))]; _wp setWaypointStatements ["true", "_null = (group this) spawn Hunt_players_fnc;"]; _wp setWaypointType "SAD"; _wp setWaypointCombatMode "RED"; _wp setWaypointSpeed "FULL"; }; _null = (group _this) spawn Hunt_players_fnc; }; Keep in mind I'm kind of rarted when it comes to this sort of thing. Thanks. Share this post Link to post Share on other sites
opusfmspol 282 Posted May 15, 2020 12 hours ago, He'sCalledTheStig said: I want to change it to target the nearest player/playable character instead of "the player". Try this: Spoiler if (isServer) then { _null = this spawn { Hunt_players_fnc = { _player = objNull; _distance = 100000; { if (_x In allPlayers && alive _x && _x distance (Leader _this) < _distance) then { _distance = _x distance (Leader _this); _player = _x; }; } foreach (playableUnits + switchAbleUnits); if !(isNull _player) then { _wp = _this addWaypoint [getPos _player, (50 + (floor(random 70)))]; _wp setWaypointStatements ["true","_null = (group this) spawn Hunt_players_fnc;"]; _wp setWaypointType "SAD"; _wp setWaypointCombatMode "RED"; _wp setWaypointSpeed "FULL"; }; }; _null = (group _this) spawn Hunt_players_fnc; }; }; Share this post Link to post Share on other sites
He'sCalledTheStig 4 Posted May 16, 2020 On 5/15/2020 at 2:31 AM, opusfmspol said: Try this: Hide contents if (isServer) then { _null = this spawn { Hunt_players_fnc = { _player = objNull; _distance = 100000; { if (_x In allPlayers && alive _x && _x distance (Leader _this) < _distance) then { _distance = _x distance (Leader _this); _player = _x; }; } foreach (playableUnits + switchAbleUnits); if !(isNull _player) then { _wp = _this addWaypoint [getPos _player, (50 + (floor(random 70)))]; _wp setWaypointStatements ["true","_null = (group this) spawn Hunt_players_fnc;"]; _wp setWaypointType "SAD"; _wp setWaypointCombatMode "RED"; _wp setWaypointSpeed "FULL"; }; }; _null = (group _this) spawn Hunt_players_fnc; }; }; Works fine in singleplayer, but doesn't function on dedicated server. Share this post Link to post Share on other sites
opusfmspol 282 Posted May 16, 2020 See if this works for dedicated: if (isServer) then { _null = this spawn { Hunt_players_fnc = { _player = objNull; _players = +(allPlayers - (entities "HeadlessClient_F")); _distance = 100000; { if (alive _x && _x distance (Leader _this) < _distance) then { _distance = _x distance (Leader _this); _player = _x; }; } foreach _players; if !(isNull _player) then { _wp = (Group _this) addWaypoint [getPos _player, (50 + (floor(random 70)))]; _wp setWaypointStatements ["true","_null = this spawn Hunt_players_fnc;"]; _wp setWaypointType "SAD"; _wp setWaypointCombatMode "RED"; _wp setWaypointSpeed "FULL"; }; }; _null = _this spawn Hunt_players_fnc; }; }; 1 Share this post Link to post Share on other sites
JD Wang 352 Posted May 17, 2020 Have you tried these?https://forums.bohemia.net/forums/topic/222092-release-fn_taskrushhuntcreep-by-nkenny/ 1 Share this post Link to post Share on other sites