Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
flyer_ofp.info

Vehicle stuck after troops get in

Recommended Posts

Hello all,

 

I am trying to create a convoy, which stops, unloads a group, the group performs a task, returns, get back into the vehicle and the convoy continues to move.

 

To do this

  • I have two groups:
    • cov1 is a Strider and AFV-4 (the AFV-4 is named t1)
    • grp are eight soldiers
  • Placed one MOVE waypoint for cov1 in the editor on the other side of map
  • Added three triggers with radio calls to execute three scripts
  • Two global variables wp_ind_grp, wp_ind_cov1 which I use to control the indices of the waypoints (both initialized as 0)

 

First radio call: Pick-up script to load grp into t1:

wp_ind_grp = wp_ind_grp+1;
wp_ind_cov1 = wp_ind_cov1+1;

{_x assignAsCargo t1} foreach (units grp);
_wp = grp addWaypoint [getPosASL player, -1,wp_ind_grp];
_wp setWaypointType "GETIN";

_wpt1 = cov1 addWaypoint [getPosASL player, -1,wp_ind_cov1];
_wpt1 setWaypointType "LOAD";

[cov1, wp_ind_cov1] synchronizeWaypoint [[grp, wp_ind_grp]]; 

This works, and cov1 continues to move towards the waypoint placed in the editor.

 

Second radio call: divert cov1 to a position, stop there, unload grp, and subsequently grp moves 150m in front of t1.

wp_ind_grp = wp_ind_grp+1;
wp_ind_cov1 = wp_ind_cov1+1;

_wp = grp addWaypoint [getPosASL unload1, -1,wp_ind_grp];
_wp setWaypointType "GETOUT";

_wpt1 = cov1 addWaypoint [getPosASL unload1, -1,wp_ind_cov1];
_wpt1 setWaypointType "TR UNLOAD";

[cov1, wp_ind_cov1] synchronizeWaypoint [[grp, wp_ind_grp]];

wp_ind_grp = wp_ind_grp+1;
_wpt1 setWaypointStatements ["true", "doStop (units cov1); { unassignVehicle _x } forEach units grp; _wp1 = grp addWaypoint [t1 modelToWorldWorld [0,150,0],-1,wp_ind_grp];"];

This works as well as intended.

 

Third radio call: get grp back into t1, add a new waypoint for cov1 and subsequently cov1 follows again the one placed in the editor.

wp_ind_grp = wp_ind_grp+1;
wp_ind_cov1 = wp_ind_cov1+1;


(units cov1) doFollow (leader cov1); 
{_x assignAsCargo t1} foreach (units grp);
_wp = grp addWaypoint [getPosASL t1, -1,wp_ind_grp];
_wp setWaypointType "GETIN";

_wpt1 = cov1 addWaypoint [getPosASL t1, -1,wp_ind_cov1];
_wpt1 setWaypointType "LOAD";

[cov1, wp_ind_cov1] synchronizeWaypoint [[grp, wp_ind_grp]]; 




wp_ind_cov1 = wp_ind_cov1+1;

_wpt2 = cov1 addWaypoint [getPosASL stop1, -1,wp_ind_cov1]; 
_wpt2 setWaypointType "MOVE";

And now something is off. The strider and the AFV-4 are moving (=doFollow deactived doStop as intended), the AFV-4 (t1) is picking up grp, but once everybody in grp boarded t1, only the Strider (leader of cov1) continues to the new waypoint, while the AFV-4 (t1) is stuck. Oddly, it worked when I have ONLY the AFV-4 in cov1 and no other vehicles.

 

Any idea what is happening?

Share this post


Link to post
Share on other sites

I am still not completly sure what happened, but it seems that the "doStop" in the "_wpt1 setWaypointStatements" was an issue. After I have removed it from there, it worked better... Maybe the waypoint on the map interfered with the indices of the waypoints so that the third waypoints statement was evaluated multiple times (but I do not understand why, because it was the last waypoint of grp in that example).

 

However, I needed the doStop somewhere else, and so I set a local variable = true in the "_wpt1 setWaypointStatements" (and initialized it false on top of the second script). And I used a waitUntil with this local variable before executing doStop... it did not work, the convoy moved (despite other commands after the waitUntil were clearly executed...). Instead, once I have called the third script (which has no doStop at all), the leader of the convoy has stopped sometimes at the intermediate waypoint... I have still no clue what is going on.

 

I will try to replace all doStop with disableAI "PATH" and the doFollow with enableAI "PATH"...

 

 

Share this post


Link to post
Share on other sites

×