Jump to content
Sign in to follow this  
hyzoran

Assisting Squads

Recommended Posts

One thing that currently annoys me about my missions, is that I cannot figure out how to get 2 or more AI squads to stay within a certain radius of eachother, support eachother, etc. without having them share a single formation, infantry get in APCs, as if they were one squad. Basically all I need is something that tells one squad to follow another, at the least. Do I need to use a waypoint with certain parameters? Do I need to script a waypoint? If so, then how? (I have tried synchronizing waypoints of the squads buts its too slow, unrealiable, and not dynamic enough, I have also tried support and guard waypoints, the other squads dont do anything really) Thanks to anyone that offers any help or suggestions.

Share this post


Link to post
Share on other sites

Hi mate... look at this little test mission that I just put together for you. It will make one group follow another. More can be added but it is a start for you and I commented the crap out of it.

This is the script... follow.sqf

_grplead = _this select 0;		//leading group
_grpfollow = _this select 1;	//following group
_distance = _this select 2;		//distance for checking

_loop = true;

//keep looping till _loop = false
while {_loop} do {

//get distance between the leaders of each group
_currentdist = leader _grplead distance leader _grpfollow;

//if distance greater than max distance then update followers waypoint
if (_currentdist > _distance) then {

	//get the index of the followers current waypoint
	_index = currentWaypoint _grpfollow;

	//delete this waypoint
	deletewaypoint [_grpfollow,_index];

	//add a new waypoint near (20m) the position of the leader of leading group
	_wp = _grpfollow addWaypoint [position leader _grplead, 20];

};

//sleep some arbitrary time....5 seconds seems good
sleep 5;

//if either group has no units left set _loop = false and stop looping
if (({alive _x} count units _grplead ==0) or ({alive _x} count units _grpfollow ==0)) then {
	_loop = false;
};
};

Execute the script like this...

nul = [leading_group,following_group,distance] execVM "follow.sqf";

Hope it helps in some way.

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

Thanks! Works perfectly! I only wish I had the ability to have done it myself, I don't like relying on other people, I have to get around to scripting and shit :P

Share this post


Link to post
Share on other sites

You're welcome... keep reading and fiddling with other peoples scripts. Best way to learn.

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  

×