Jump to content
Sign in to follow this  
craptakular

crate unit, move to waypoint, enter vehicle as driver, then vehicle patrols

Recommended Posts

I have written the script below but it isn't working as intended. The units spawn at "spawnpoint1" and are then magically teleported into the vehicle, then they begin there patrol.

It seems my move to waypoint before entering the vehicles is being completely ignored. Can anyone shed some light for me?

if (!isServer) exitWith {};

//Spawnpoint marker position & patrol marker
_spawnPos = getMarkerPos "spawnpoint1";

//Create group1 on side EAST
_group1 = createGroup EAST;
_unit1 = _group1 createUnit ["TK_Soldier_EP1", [_spawnPos select 0,_spawnPos select 1,1], [], 1, "FORM"];
_unit2 = _group1 createUnit ["TK_Soldier_GL_EP1", [_spawnPos select 0,_spawnPos select 1,1], [], 1, "FORM"]; 

//Create group2 on side EAST
_group2 = createGroup EAST;
_unit3 = _group2 createUnit ["TK_Soldier_EP1", [_spawnPos select 0,_spawnPos select 1,1], [], 1, "FORM"];
_unit4 = _group2 createUnit ["TK_Soldier_GL_EP1", [_spawnPos select 0,_spawnPos select 1,1], [], 1, "FORM"]; 

//Move group1 to waypoint wp3a
_wp1 = _group1 addWaypoint [(getmarkerpos "wp3a"), 30];
_wp1 setWaypointBehaviour "AWARE";
_wp1 setwaypointtype "MOVE";
_wp1 setWaypointFormation "STAG COLUMN";
_wp1 setWaypointSpeed "FULL";
_wp1 setwaypointstatements ["True", ""];

//Move group2 to waypoint wp3a
_wp1 = _group2 addWaypoint [(getmarkerpos "wp3a"), 30];
_wp1 setWaypointBehaviour "AWARE";
_wp1 setwaypointtype "MOVE";
_wp1 setWaypointFormation "STAG COLUMN";
_wp1 setWaypointSpeed "FULL";
_wp1 setwaypointstatements ["True", ""];

//After reaching waypoint 3a, units enter the cars
_unit1 moveInDriver car1;
_unit2 moveInGunner car1;
_unit3 moveInDriver car2;
_unit4 moveInGunner car2;

//Once the cars are manned, they patrol a 400m radius around spointpoint1
[car1, _spawnPos, 400, 6, "MOVE", "SAFE", "YELLOW", "LIMITED", "STAG COLUMN", "", [3,6,9]] call CBA_fnc_taskPatrol;
[car2, _spawnPos, 400, 6, "MOVE", "SAFE", "YELLOW", "LIMITED", "STAG COLUMN", "", [3,6,9]] call CBA_fnc_taskPatrol;

Share this post


Link to post
Share on other sites

The script isn't waiting for the waypoint task to be completed. It just assigns it then moves on to the next command, moveInCargo, which does exactly as you describe - teleports the selected units into the target vehicle.

Instead of using moveInCargo, assign a second waypoint (type: Get In). This should give you the results you are looking for.

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  

×