Jump to content
Zaptoman

Having Trouble Getting Convoy Moving Post-Attack

Recommended Posts

Hey guys. Need some assistance. I've got a convoy travelling down the road. I've scripted them to switch group leader to the next available hunter if one is destroyed. However, often they just sit in place after combat. Hence I'm trying a new script to get them moving again. This is my code so far.

if (!alive cvoy1) then {cvoy setleader cvoy2};

if ((!alive cvoy1) and (!alive cvoy2)) then {cvoy setleader cvoy4};

if ((!alive cvoy1) and (!alive cvoy2) and (!alive cvoy4)) then {cvoy setleader cvoy6};

if ((units cvoy) findNearestEnemy cvoy=null) then {units cvoy doFollow leader cvoy};

However I can't get it to work. Do I need to define an object in the mission's init.sqf?

Share this post


Link to post
Share on other sites

You might try simply switching the survivors to "careless", although they may not engage at all

Share this post


Link to post
Share on other sites

Yeah, that'd be a problem, as I have multiple confrontations set up along their route.

Share this post


Link to post
Share on other sites

setLeader is working for team members.  Did you define some teams? First of all, what are cvoy, cvoy1?... units, vehicles, groups, team members?

see assignTeam.

Each time you're using a BI command, refer to BIKI for the correct syntax.

Then, I guess you don't need that bunch of conditions. But I don't understand what you intend to do.

"switch group leader to the next available hunter if one is destroyed" ??

 

Share this post


Link to post
Share on other sites

@pierremgi

cvoy is the group. cvoy1-cvoy6 are the individual convoy vehicles. What I intend to do is switch group leads from one Hunter HMG to the next in the convoy, even if he's behind my fuel truck etc. That part of the code works. What doesn't work is 

if ((units cvoy) findNearestEnemy cvoy=null) then {units cvoy doFollow leader cvoy};

Basically I want them to scan the area, and if no enemies are found, I want them to get moving again. Instead what happens (not EVERY time, but say 50%) is the convoy just sits there forever.

Share this post


Link to post
Share on other sites

Don't use findNearestEnemy. This command is unreliable for your aim. The problem here is you don't post your script with waypoints and it's hard to understand what happens in your scenario. Convoy cvoy seems to be a group of 6 vehicles. Not sure all units in the vehicle belongs to the same group. Probalby yes.. and probably in "SAFE" state to drive on roads. So, when attacked, the group status raises in combat mode (automatic) then leader is the first alive unit of the group (automatic) and waypoints are still here as far as the group is not deleted. So?

Share this post


Link to post
Share on other sites

@pierremgi

How should I post the script? I'd be glad to post it another way, I just only know the copy and paste method (from the .sqf file).

Your solution would work if i wanted the next available vehicle to lead. I don't. I have Hunter HMGs spaced throughout the convoy. Only if the first Hunter HMG is destroyed, I want the next available Hunter HMG to move out of his position (let's say 4th) and lead the convoy. But, like I said, that part of the script already works. Right now I'm having trouble with the restarting, and convoy following distance.

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

×