{"name":"BIS_fnc_stalk","title":"BIS fnc stalk","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_stalk","revid":327438,"updated":"2022-07-12T22:12:09Z","groups":["Object Manipulation","Combat"],"status":"ok","games":{"arma3":"1.00"},"since":"arma3 1.00","arma3_since":"1.00","exec":"spawn","description":"Continuously set WP of one group to a different group to hunt it. It does not change the group's behaviour.\nScript terminates if one of the groups is eliminated or if the optional condition is activated.","syntaxes":[{"syntax":"[stalker, stalked, refresh, radius, endCondition, endDestination] spawn BIS_fnc_stalk","params":[{"name":"stalker","type":"Group","description":"the group that will move towards the other","type_expr":"Group"},{"name":"stalked","type":"Group","description":"the group that will be followed","type_expr":"Group"},{"name":"refresh","type":"Number","optional":true,"default":"10, minimum 5","description":"time between waypoint updates","type_expr":"Number","text":"refresh: Number - (Optional, default 10, minimum 5) time between waypoint updates"},{"name":"radius","type":"Number","optional":true,"default":"0, minimum 0","description":"waypoint \"precision\"","type_expr":"Number","text":"radius: Number - (Optional, default 0, minimum 0) waypoint \"precision\""},{"name":"endCondition","type":"Code","optional":true,"default":"{false}","description":"condition that if true stops *stalker* to follow *stalked*","type_expr":"Code","text":"endCondition: Code - (Optional, default {false}) condition that if true stops *stalker* to follow *stalked*"},{"name":"endDestination","type":"String or Position or Object or Number","optional":true,"default":"0","description":"destination *stalker* will go after *endCondition* is met (or *stalked* is killed)\n\n- String - destination marker name\n- Position - destination\n- Object - destination\n- Number\n  - 0: return to original group waypoints\n  - 1: search around their current stalking position, in a 50m radius\n  - 2: return to the original position before stalking","type_expr":"String | Position | Object | Number","text":"endDestination: String or Position or Object or Number - (Optional, default 0) destination *stalker* will go after *endCondition* is met (or *stalked* is killed)\n\n- String - destination marker name\n- Position - destination\n- Object - destination\n- Number\n  - 0: return to original group waypoints\n  - 1: search around their current stalking position, in a 50m radius\n  - 2: return to the original position before stalking"}],"returns":{"type":"Boolean","type_expr":"Boolean","description":"true when done"}}],"examples":[{"code":["private _stalking = [BIS_grpStalkers, BIS_grpPlayer] spawn BIS_fnc_stalk;"]},{"code":["private _stalking = [grp1, group player, nil, nil, { player distance BIS_Heli < 100 }, \"BIS_mrkRetreatMarker\"] spawn BIS_fnc_stalk;"]},{"code":["private _stalking = [BIS_grpStalkers, BIS_grpPlayer, 20, 10, { BIS_Return }, 1] spawn BIS_fnc_stalk;"]},{"code":["private _stalking = [BIS_grpStalkers, BIS_grpPlayer, 5, 0, { dayTime > 20 }, [3600,600,0]] spawn BIS_fnc_stalk;"]}],"see_also":["BIS_fnc_spawnGroup"]}