Jump to content
Sign in to follow this  
katipo66

call bis_fnc_taskPatrol globally for every unit

Recommended Posts

I know how to use it on single groups like this for example:

[group this, getPos this, 1000] call bis_fnc_taskPatrol;

But is it possible to apply it globally somehow so that every unit in the editor uses it?.

Share this post


Link to post
Share on other sites

It is group based but yes you could use allGroups and apply it to each one.

------------------------------------------------

This is not tested but something like this should work.

{
   [_x, (getPos(leader _x)), 1000] call bis_fnc_taskPatrol; 

} forEach allGroups;

Edited by Riouken

Share this post


Link to post
Share on other sites

No problem.

If you want to randomize the distance for each group you could do this:

{

   _dist = (floor(random 950)) + 50;
   [_x, (getPos(leader _x)), _dist] call bis_fnc_taskPatrol; 

} forEach allGroups;

That will give you give you a min patrol distance of 50 m. and a max of 1000 m.

Share this post


Link to post
Share on other sites

Oh cool!, now i have to ask.. how to randomize _wp setWaypointSpeed

Share this post


Link to post
Share on other sites

I dont think you can change the waypoint speed with out editing the function.

But you could try this ( Im not sure if this will work but its worth a shot.)

_sm = ["LIMITED","NORMAL","FULL"];

{ 
   _dist = (floor(random 950)) + 50;
   [_x, (getPos(leader _x)), _dist] call bis_fnc_taskPatrol;
   _spd = (_sm select (floor(random 2)));
   _x setSpeedMode _spd; 

} forEach allGroups;

fyi setSpeedMode

Edited by Riouken

Share this post


Link to post
Share on other sites

No i didnt seem to work, not from what i saw anyway, there was a script error 'missing ;'

_sm = ["LIMITED","NORMAL","FULL"];

Anyway its doing what i wanted it to do, thanks :D

Share this post


Link to post
Share on other sites

How can I now exclude a group? bis_fnc_taskPatro=false removes from everyone

Share this post


Link to post
Share on other sites

Make a copy of allGroups and then subtract whatever group(s) from the copy. Work with this new array.

_mygroups = allGroups;
_mygroups = _mygroups - [somegroup];

Then use _mygroups for bis_fnc_taskPatrol.

Share this post


Link to post
Share on other sites

Actually while doing that I realized that's not how I really want to do it, out of 20 units only 2 would not be using them for example, is there something I can put in the init of those units?

This is more like a base template I use and constantly changing different groups etc, that's why I wanted the global call

Share this post


Link to post
Share on other sites
Actually while doing that I realized that's not how I really want to do it, out of 20 units only 2 would not be using them for example, is there something I can put in the init of those units?

This is more like a base template I use and constantly changing different groups etc, that's why I wanted the global call

what Twirly said, just make it a global array, name it whatever, but do not use underscore in front:

place in init.sqf:

global_groups = [];

in the groups you want excluded from the patrols, place this in init.sqf(this should ofc be initline of leader):

global_groups = global_groups + [(group this)];

now run the script like this, only those groups that do not have the above line in their init line will patrol.

_sm = ["LIMITED","NORMAL","FULL"];

{
if (!(_x in global_groups)) then {
	_dist = (floor(random 950)) + 50;
	_patrol = [_x, (getPos(leader _x)), _dist] call bis_fnc_taskPatrol;
	_spd = (_sm select (floor(random 2)));
	_x setSpeedMode _spd; 
};
} forEach allGroups;

Edited by Demonized

Share this post


Link to post
Share on other sites

Ok, sori Twirly bro, i thought i knew what i was doing! that works perfect, thanks guys and cheers for detailed description. :ok:

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×