redarmy 420 Posted December 4, 2020 I'm trying to customize the patrol behaviour of the group.In the group leaders init i have the following: _null = [group this, getPos car, 444, setBehaviour "AWARE"] spawn BIS_fnc_taskPatrol its returnng errors and im unable to use this line but if i use: _null = [group this, getPos car, 444] spawn BIS_fnc_taskPatrol It allows me to proceed with OK. Basically i want a group using BIS patrol function but have them not in standard careless/safe behaviour. Am i writing this incorrectly or am i not able to even modify the function? Share this post Link to post Share on other sites
wogz187 1085 Posted December 4, 2020 @redarmy, _null = [group this, getPos car, 444, setBehaviour "AWARE"] spawn BIS_fnc_taskPatrol The behavior doesn't go there. That param is for the blacklist. Wiki Instead, call { [group this, getPos car, 444] spawn BIS_fnc_taskPatrol; group this setBehaviour "AWARE"; }; Have fun! 1 Share this post Link to post Share on other sites
redarmy 420 Posted December 4, 2020 1 minute ago, wogz187 said: @redarmy, _null = [group this, getPos car, 444, setBehaviour "AWARE"] spawn BIS_fnc_taskPatrol The behavior doesn't go there. That param is for the blacklist. Wiki Instead, call { _null = [group this, getPos car, 444] spawn BIS_fnc_taskPatrol; group this setBehaviour "AWARE"; }; Have fun! Thanks but its not working.I already tried a variation of this,then tried your,and the result is the same...AI stay in a relaxed behaviour. Share this post Link to post Share on other sites
Larrow 2802 Posted December 4, 2020 Problem is BIS_fnc_taskPatrol sets the groups behaviour in the first couple of lines of the script to SAFE, it then adds the waypoints. So you need to wait until the groups waypoints start being added and then reset their behaviour to what ever you like. nul = this spawn { _wps = count waypoints group _this; _null = [group _this, getPos car, 444] spawn BIS_fnc_taskPatrol; waitUntil{ count waypoints group _this > _wps }; group _this setBehaviour "AWARE"; }; 4 Share this post Link to post Share on other sites
redarmy 420 Posted December 4, 2020 45 minutes ago, Larrow said: Problem is BIS_fnc_taskPatrol sets the groups behaviour in the first couple of lines of the script to SAFE, it then adds the waypoints. So you need to wait until the groups waypoints start being added and then reset their behaviour to what ever you like. nul = this spawn { _wps = count waypoints group _this; _null = [group _this, getPos car, 444] spawn BIS_fnc_taskPatrol; waitUntil{ count waypoints group _this > _wps }; group _this setBehaviour "AWARE"; }; Thank you Larrow , that seemed to work.However their speed is still set on LIMITED. I modified the the line to include set speed,alotogether it looks like this: nul = this spawn { _wps = count waypoints group _this; _null = [group _this, getPos car, 444] spawn BIS_fnc_taskPatrol; waitUntil{ count waypoints group _this > _wps }; group _this setBehaviour "AWARE"; group _this setSpeedMode "FULL"; }; However it doesnt change their speed.They are walking guns up,limited pace. Im getting no errors when entering the info into units init,and it looks correct.Can you confirm what i have here should work? Share this post Link to post Share on other sites
wogz187 1085 Posted December 4, 2020 (edited) @redarmy, There was an attempt made 😄 Have fun! Edited December 4, 2020 by wogz187 see below Share this post Link to post Share on other sites
redarmy 420 Posted December 4, 2020 5 minutes ago, wogz187 said: @redarmy, You could try, call { private _wp = count waypoints group _this; [group _this, getPos car, 444] spawn BIS_fnc_taskPatrol; [_this, _wp] spawn { waitUntil {count waypoints group (_this select 0) > (_this select 1) }; doStop (_this select 0); (_this select 0) doFollow leader (group (_this select 0)); group (_this select 0) setBehaviour "AWARE"; group (_this select 0) setSpeedMode "FULL"; }; }; To jump start their behaviour. Have fun! Thanks,it gave an error about "wait until,returned nil".And Group never began the patrol Share this post Link to post Share on other sites
Larrow 2802 Posted December 4, 2020 nul = this spawn { _null = [group _this, getPos car, 444] spawn BIS_fnc_taskPatrol; waitUntil{ waypoints group _this findIf{ waypointType _x == "CYCLE" } > -1 }; { _x setWaypointSpeed "FULL"; }forEach waypoints group _this; group _this setBehaviour "AWARE"; group _this setSpeedMode "FULL"; }; BIS_fnc_taskPatrol sets each waypoint it adds to speed "LIMITED". So wait until the final "CYCLE" waypoint has been added, then change all waypoint speeds to "FULL" and set the groups current speed to "FULL". Plus the groups behaviour. 2 1 Share this post Link to post Share on other sites
redarmy 420 Posted December 4, 2020 1 minute ago, Larrow said: nul = this spawn { _null = [group _this, getPos car, 444] spawn BIS_fnc_taskPatrol; waitUntil{ waypoints group _this findIf{ waypointType _x == "CYCLE" } > -1 }; { _x setWaypointSpeed "FULL"; }forEach waypoints group _this; group _this setBehaviour "AWARE"; group _this setSpeedMode "FULL"; }; BIS_fnc_taskPatrol sets each waypoints speed as "LIMITED". So wait until the final "CYCLE" waypoint has been added, then change all waypoint speeds to "FULL" and set the groups current speed to "FULL". Plus the groups behaviour. And four hours later we have a winner.That did it. Its very interesting to see all default behaviour under the hood and modify it.Arma3 Never stops suprising me nor does the helpful community.Thanks guys! Is it safe performance wise to run this on multiple groups?As in it wouldnt bog down the CPU on each cycle? 3 Share this post Link to post Share on other sites
Larrow 2802 Posted December 4, 2020 8 minutes ago, redarmy said: Is it safe performance wise to run this on multiple groups? Dont see why not, BIS_fnc_taskPatrol just adds waypoints and exits. 8 minutes ago, redarmy said: As in it wouldnt bog down the CPU on each cycle? There is no cycle( code wise ), waypoints get added( BIS_fnc_taskPatrol ) and code exits, code in post changes waypoints once taskPatrol has done its thing and exits. 1 1 Share this post Link to post Share on other sites
wogz187 1085 Posted December 4, 2020 All fixed as per Larrow's suggestions, Spoiler call { private _wp = count waypoints group this; [group this, getPos player, 100] spawn BIS_fnc_taskPatrol; [this, _wp] spawn { waitUntil {count (waypoints group (_this select 0)) > (_this select 1) }; { _x setWaypointSpeed "FULL" }forEach waypoints group (_this select 0); group (_this select 0) setBehaviour "AWARE"; group (_this select 0) setSpeedMode "FULL"; }; }; Have fun! Share this post Link to post Share on other sites
Larrow 2802 Posted December 4, 2020 8 minutes ago, wogz187 said: fixed as per Larrow's suggestions, 8 minutes ago, wogz187 said: waitUntil {count (waypoints group (_this select 0)) > (_this select 1) }; That still wouldn't work @wogz187 as not all the waypoints have been added by the time this waituntil condition is true (only one would need to be added). Working code is my previous post, it is not a suggestion. 1 1 Share this post Link to post Share on other sites
wogz187 1085 Posted December 4, 2020 @Larrow, call { [group this, getPos player, 100] spawn BIS_fnc_taskPatrol; group this spawn { waitUntil{ waypoints _this findIf { waypointType _x == "CYCLE" } > -1 }; { _x setWaypointSpeed "FULL" }forEach waypoints _this; _this setBehaviour "AWARE"; _this setSpeedMode "FULL"; }; }; Perfect, thanks! Share this post Link to post Share on other sites
Larrow 2802 Posted December 4, 2020 Due to now having to wait for all waypoints to be added, we can really just get rid of the waitUntil and just call( wait until the script exits ) the taskPatrol instead. _null = [group this, getPos car, 444] call BIS_fnc_taskPatrol; { _x setWaypointSpeed "FULL"; }forEach waypoints group this; group this setBehaviour "AWARE"; group this setSpeedMode "FULL"; Straight in the init box. 1 1 Share this post Link to post Share on other sites
redarmy 420 Posted December 4, 2020 23 minutes ago, Larrow said: Due to now having to wait for all waypoints to be added, we can really just get rid of the waitUntil and just call( wait until the script exits ) the taskPatrol instead. _null = [group this, getPos car, 444] call BIS_fnc_taskPatrol; { _x setWaypointSpeed "FULL"; }forEach waypoints group this; group this setBehaviour "AWARE"; group this setSpeedMode "FULL"; Straight in the init box. Lovely stuff. I have been testing it,works great. I put down a vehicle with a move,S and D,move,cycle WP.That vehicle when on the first or second WP engages enemy but then stops and seems to forget its WPs.Turns engine off and does nothing ever again except shoot anything that comes in sight. So my question is do you think this modified patrol function could help the AI driver and is it a better idea to give the patrol function to the vehicle,or to the commander/driver? Im sure this is a vanilla Arma3 issue as its what stopped me playing two years back. Share this post Link to post Share on other sites