offStation = group this; deleteVehicle this;
The rifleman and these commands setup the ability to use copyWaypoints command later. First we name the group offStation using the = group this; command. This means we'll be able to refer to that group later as offStation. The deleteVehicle this; will delete the rifleman since all we needed was the group and the waypoints.
cleanUpveh = vehicle leader this; {deleteVehicle _x} forEach crew cleanUpveh + [cleanUpveh]
Waypoints onAct field refers to the group that owns the waypoint as this. Since we knew the name of the helo we could have simply done this:
{deleteVehicle _x} forEach crew knope + [knope];
but I decided to make it reusable so the first thing we do is grab the object of the vehicle we're in.
cleanUpveh = vehicle leader this;
First part of that that gets evaluated is the leader this part. That returns the leader of the group. Then we check for what vehicle he's in, returning the knope helicopter and we store that value as cleanUpveh. Now that we know the vehicle we can delete the crew then delete the vehicle with the rest of that code:
{deleteVehicle _x} forEach crew cleanUpveh + [cleanUpveh]
Then for the group switch:
leavingGroup = createGroup west; {[_x] joinSilent leavingGroup} forEach crew knope; leavingGroup copyWaypoints offStation;
leavingGroup = createGroup west; This creates a new group for the pilot/gunner to join. Then we use the forEach for the crew of the helicopter to silently join that group. Finally we return to the offStation group we created at first and apply their waypoints (the move with the delete everyone code) to this new group and they'll start to follow that waypoint right away. copyWaypoints is: groupTo copyWaypoints groupFrom.
Let me know if you have questions about any of this.