Jump to content
SSGT. Caine

Tell Ai to "Stop" and then continue

Recommended Posts

I'm making a MP Mission where I want an (addAction) to allow players to Halt the vehicle and then move it again. So if need we can tell the AI to stop driving towards the waypoint, and whenever we want to advance we would just use the (addAction). I've successfully been able to stop the Vehicle by using; "{dostop _x} foreach units cov1;" which (cov1 is the variable name for the convoy group), but after I use that command I can not use a move command to tell the AI to continue to the waypoint. Please Help :(

Share this post


Link to post
Share on other sites
5 hours ago, dreadedentity said:

To get them moving again, they need to be given a new move order which can be done with a command like doMove

It will not let me preform "{domove _x} foreach units cov1;" do you know what the code is to move the group specifically? I'm using triggers to activate the (addActions) could that be the issue?

Share this post


Link to post
Share on other sites
16 minutes ago, SSGT. Caine said:

It will not let me preform "{domove _x} foreach units cov1;" do you know what the code is to move the group specifically? I'm using triggers to activate the (addActions) could that be the issue?

 

Have you executed doFollow on them?

Share this post


Link to post
Share on other sites
5 minutes ago, Harzach said:

 

Have you executed doFollow on them?

"{con1 doFollow _x} foreach units con1;" I will test this.

 

Share this post


Link to post
Share on other sites

Don't bother. Read the Biki entry I linked above to see the correct syntax.

units cov1 doFollow leader cov1;

 

Share this post


Link to post
Share on other sites
56 minutes ago, SSGT. Caine said:

It will not let me preform "{domove _x} foreach units cov1;" [...] could that be the issue?

No. Your syntax is wrong for the command. Make sure you look at the wiki page when it is linked as many of us also spend a lot of time there making edits and adding information to make it the best it can be

doMove

Share this post


Link to post
Share on other sites
32 minutes ago, Harzach said:

Don't bother. Read the Biki entry I linked above to see the correct syntax.


units cov1 doFollow leader cov1;

 

After the "{dostop _x} foreach units cov1;" command. The vehicles will not continue to the waypoint even after doing the "units cov1 doFollow leader cov1;" command.

Share this post


Link to post
Share on other sites

Simply put, doStop breaks a group's cohesion, doFollow brings them back together so that they will move as a group.

 

In player unit init, riding in passenger seat of a full Hunter:

this addaction ["STOP", "{doStop _x} forEach units cov1;",""];
this addaction ["GO", "units cov1 doFollow leader cov1;",""];

 

If units are in a vehicle, it seems they are kicked out when doStop is executed, though they will be immediately ordered back in.

 

The "GO" action (doFollow) will set the group back on its way to the current waypoint. Tested.

 

 

Share this post


Link to post
Share on other sites
11 hours ago, Harzach said:

Simply put, doStop breaks a group's cohesion, doFollow brings them back together so that they will move as a group.

 

In player unit init, riding in passenger seat of a full Hunter:


this addaction ["STOP", "{doStop _x} forEach units cov1;",""];
this addaction ["GO", "units cov1 doFollow leader cov1;",""];

 

If units are in a vehicle, it seems they are kicked out when doStop is executed, though they will be immediately ordered back in.

 

The "GO" action (doFollow) will set the group back on its way to the current waypoint. Tested.

 

 

I really appreciate your help! How would I go about adding cov1 disableAI "PATH"; to make them not move but be able to fire? previously the leader would once again command them to move when they encounter enemies.

Share this post


Link to post
Share on other sites
1 hour ago, SSGT. Caine said:

How would I go about adding cov1 disableAI "PATH";

 

You can't. But if we look at the Biki entry for the command disableAI we can see that:

 

Quote

Syntax:  unit disableAI feature

 

...so we should be able to apply it in the same general manner as doStop:

{_x disableAI "PATH"} forEach units cov1;

Adding it the the first example addAction:

this addaction ["STOP", "{doStop _x} forEach units cov1; {_x disableAI 'PATH'} forEach units cov1;", ""];

...but that's redundant. We can do it all with disableAI/enableAI:

this addaction ["STOP", "{_x disableAI 'PATH'} forEach units cov1;", ""]; 
this addaction ["GO", "{_x enableAI 'PATH'} forEach units cov1;", ""];

Do note that "PATH" is in single quotes here. That's because we have been wrapping our code block in double quotes inside the addAction, which makes it a string - when we put a string inside of another string (like "PATH" here") we need to use single quotes instead.

We do not have to "stringify" our code block, however. The other syntax is to wrap it in curly brackets:

this addaction ["STOP", { {_x disableAI "PATH"} forEach units cov1; }, ""]; 
this addaction ["GO", { {_x enableAI "PATH"} forEach units cov1; }, ""];

 

Unlike doStop, units will not automatically disembark when the command is executed. However, if enemies are encountered, they might be commanded by the group leader to disembark (and just stand next to the vehicle as they can't move). It can be a bit fussy to get everyone back in the vehicle afterwards. Sometimes they all get back in with no problem, sometimes one will simply not. I suppose we could force them back in before enabling PATH...

 

Each method has its issues.

Share this post


Link to post
Share on other sites
11 hours ago, Harzach said:

 

You can't. But if we look at the Biki entry for the command disableAI we can see that:

 

 

...so we should be able to apply it in the same general manner as doStop:


{_x disableAI "PATH"} forEach units cov1;

Adding it the the first example addAction:


this addaction ["STOP", "{doStop _x} forEach units cov1; {_x disableAI 'PATH'} forEach units cov1;", ""];

...but that's redundant. We can do it all with disableAI/enableAI:


this addaction ["STOP", "{_x disableAI 'PATH'} forEach units cov1;", ""]; 
this addaction ["GO", "{_x enableAI 'PATH'} forEach units cov1;", ""];

Do note that "PATH" is in single quotes here. That's because we have been wrapping our code block in double quotes inside the addAction, which makes it a string - when we put a string inside of another string (like "PATH" here") we need to use single quotes instead.

We do not have to "stringify" our code block, however. The other syntax is to wrap it in curly brackets:


this addaction ["STOP", { {_x disableAI "PATH"} forEach units cov1; }, ""]; 
this addaction ["GO", { {_x enableAI "PATH"} forEach units cov1; }, ""];

 

Unlike doStop, units will not automatically disembark when the command is executed. However, if enemies are encountered, they might be commanded by the group leader to disembark (and just stand next to the vehicle as they can't move). It can be a bit fussy to get everyone back in the vehicle afterwards. Sometimes they all get back in with no problem, sometimes one will simply not. I suppose we could force them back in before enabling PATH...

 

Each method has its issues.

I appreciate your help man!

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

×