Jump to content
Sign in to follow this  
zilfondel

Script waypoint issue - after loading into vehicle

Recommended Posts

Hi everyone, I've never posted in the scripts area before, but I've ran into some difficulties developing scripts for the AI in coop multiplayer missions. I should mention that I am a total noob at scripting, particularly in Arma.

I've been working on a test mission to hone my scripting skills first.

Here's the mission plan (nothing fancy):

-AI group starts in a small convoy of 2 vehicles [truck1, truck2]

-All AI gets out of the vehicles [GETOUT] and follows a few waypoints on foot

-at one of the waypoints, a script executes

-2 of the group members are assigned into a new group (f and d)

-the new group gets assigned a new (previously empty) vehicle into their group (car1)

-they board the vehicle (car1)

-they are supposed to follow a few waypoints to leave the AO by following markers set on the road

Now, after a lot of trial and error, everything seems to work. Except... they will only visit the first waypoint after they get into the vehicle.

I'm assuming this is because of the issue with assigning units waypoints when they are "men" units, and then they won't follow them once they are "vehicle" units (as drivers).

Correct me if I'm wrong.

Anyway, here is the script that has been giving me grief:

//f & d units join a new group, board their vehicle, and drive (by themselves) through a set of waypoints
if (!isServer) exitwith {};

_grp = createGroup EAST;
[f,d] join _grp;
_grp selectLeader d;
_grp addVehicle car1;
d assignAsDriver car1;
f assignAsCargo car1;

sleep 10;

_wp = _grp addWaypoint [getPos car1,0];
[_grp, 1] setWaypointType "MOVE";
_wp = _grp addWaypoint [getPos car1,0];
[_grp, 2] setWaypointType "LOAD";

//sleep 10;
//hint "units are leaving in car";

_wp = _grp addWaypoint [markerPos "way1",0];
[_grp, 1] = setWaypointType "MOVE";
[_grp, 1] = setWaypointCompletionRadius 10;
_wp = _grp addWaypoint [markerPos "way2",0];
[_grp, 2] = setWaypointCompletionRadius 10;
_wp = _grp addWaypoint [markerPos "way3",0];
[_grp, 3] = setWaypointCompletionRadius 10;
_wp = _grp addWaypoint [markerPos "way4",0];
[_grp, 4] = setWaypointCompletionRadius 10;

//Note: the unit will only go to the 1st waypoint

Now, I suspect that the solution may be to have the units do a waituntil right after the board the vehicle.

1) is this correct?

2) if correct, how do you do it?

I've found these snippets of the waituntil command that don't seem to work:

//waintUntil {unitReady [f,d]};
//waituntil {d in car1};

-by "don't seem to work," the car never even goes to the first waypoint. :confused:

Thanks for any feedback/assistance. This is an amazingly informative forum.

Sidenote: I use ACE/ACRE, as I have to develop these for the server we run them on.

Share this post


Link to post
Share on other sites

No feedback yet?

Oh well. I noticed there were some issues in the above script, so here is the updated one that I've actually been using. It works, up until waypoint 3 - the driver stops just a few meters short of the waypoint, so they never complete it - and will not continue on to any other waypoints. Does anyone know why this is or a workaround?

According to this thread (from 2010), issuing waypoint orders to a unit after they move out of a vehicle will not work. However, they are talking about disembarking troops, and I'm working on loading them.

if (!isServer) exitwith {};

_grp = createGroup EAST;
[f,d] join _grp;
_grp selectLeader d;
_grp addVehicle car1;
d assignAsDriver car1;
f assignAsCargo car1;

sleep 10;

_wp = _grp addWaypoint [getPos car1,0];
[_grp, 1] setWaypointType "MOVE";
_wp = _grp addWaypoint [getPos car1,0];
[_grp, 2] setWaypointType "LOAD";

sleep 10;

_wp = _grp addWaypoint [markerPos "way1",0];
[_grp, 3] = setWaypointType "MOVE";
_wp = _grp addWaypoint [markerPos "way2",0];
[_grp, 4] = setWaypointType "MOVE";
_wp = _grp addWaypoint [markerPos "way3",0];
[_grp, 5] = setWaypointType "MOVE";
_wp = _grp addWaypoint [markerPos "way4",0];
[_grp, 6] = setWaypointType "MOVE";

And here is the error I get in-game. I really have no idea what it means:

smuggle-error.jpg

line 24: _wp = _grp addWaypoint [markerPos "way1",0];
line 25: [_grp, 3] = setWaypointType "MOVE";

*EDIT*

I'm such an idiot.

I hate equal signs.

_wp = _grp addWaypoint [markerPos "way1",0];
[_grp, 3] setWaypointType "MOVE";

Script works beautifully now!

Anyone know where I can learn more about how to use the waituntil condition? I could never get it to work. Are there any tutorials out there?

Edited by Justino

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  

×