Crotchety_Old_Buzzard 1 Posted July 11, 2021 (edited) I am getting "Error Type Array, expected Group" when attempting to use setCurrentWaypoint, even though I am putting a group class variable in the correct position in the following script: _grpLiftHeli = createGroup east; _vehLiftHeli = createVehicle ["O_Heli_Transport_04_F", getMarkerPos "wpHeli_1", [], 0, "FLY"]; createVehicleCrew _vehLiftHeli; _vehLiftHeli setDir 240; _grpLiftHeli addVehicle _vehLiftHeli; _wpHeli1 = _grpLiftHeli addWaypoint [getPos wp6, 0]; _wpHeli1 waypointAttachObject TempTarget; _wpHeli1 setWaypointType "HOOK"; _grpLiftHeli setCurrentWaypoint [_wpHeli1, 1]; //group _vehLiftHeli setCurrentWaypoint [_wpHeli1, 1]; The error always gives the setCurrentWaypoint line number with the above listed explanation. I use prefixes that tell me the data type of the variables to avoid these kinds of trouble. As you can see, _grpLiftHeli is the created group I am using. addVehicle and addWaypoint require a Group Data Type for their opening parameters, as does setCurrentWaypoint. I used the same variable "_grpLiftHeli" for all three statements, yet, while addVehicle and addWaypoint give no errors, setCurrentWaypoint gives the "Error Type Array, expected Group" message. In the debug console I watched "xxx = groupID _grpLiftHeli;" and got back "Alpha 2-1", so it seems to be a proper group. I also tried replacing the last code line with the commented code line below it with the same results. I believe my syntax is correct based on BIS wiki, but know I still make mistakes. If anyone can explain this to me, I would be greatly appreciative. EDIT: I forgot to mention that I used the same general setup for creating a vehicle convoy and had no problems with the error. setCurrentWaypoint worked fine. Edited July 11, 2021 by Crotchety_Old_Buzzard Add'l Info Share this post Link to post Share on other sites
beno_83au 1369 Posted July 11, 2021 Well, https://community.bistudio.com/wiki/addWaypoint returns an array. So _wpHeli1 is an array, and that's what you're using with setCurrentWaypoint. But also, no units are actually assigned to your group. You create the group, then create the vehicle crew, but you never add the crew/units to the group. https://community.bistudio.com/wiki/createVehicleCrew returns it's own group anyway, which means you don't need to create a group at the start: _vehLiftHeli = createVehicle ["O_Heli_Transport_04_F", getMarkerPos "wpHeli_1", [], 0, "FLY"]; _grpLiftHeli = createVehicleCrew _vehLiftHeli; _vehLiftHeli setDir 240; _grpLiftHeli addVehicle _vehLiftHeli; 1 Share this post Link to post Share on other sites
Crotchety_Old_Buzzard 1 Posted July 11, 2021 (edited) Thanks for the response, beno. At one point I did have the "join" command in place, but since it didn't seem to make a difference, I took it back out. Based on your reply, I changed the code to: _vehLiftHeli = createVehicle ["O_Heli_Transport_04_F", getMarkerPos "wpHeli_1", [], 0, "FLY"]; _grpLiftHeli = createVehicleCrew _vehLiftHeli; _vehLiftHeli setDir 240; _grpLiftHeli addVehicle _vehLiftHeli; _wpHeli1 = _grpLiftHeli addWaypoint [getPos wp6, 0]; //Newly changed line _wpHeli1 waypointAttachObject TempTarget; _wpHeli1 setWaypointType "HOOK"; _grpLiftHeli setCurrentWaypoint [_wpHeli1, 1]; It returned the same error. The syntax for setCurrentWaypoint is showing "Group/Object setCurrentWaypoint waypoint", so I have _grpLiftHeli in the Group/Object position and _wpHeli1 in the waypoint position, which fits the wiki's syntax. Yet the error shows "Error Type Array, expected Group", which I'm reading as the compiler seeing _grpLiftHeli as an array instead of a group. In another of my scripts (which I used as a template for this script), I use the same setup, with the line "grpConvoy1 setCurrentWaypoint [_wp1, 1];" and it works without the error. I tried using a global variable in place of the local in this attempt, also, but no change. This just doesn't make sense to me. Hoping for further insights. Edit: After posting this, I tried changing the line to "grpConvoy1 setCurrentWaypoint [_wpHeli1, 1];" since grpConvoy1 is a global group variable, and I received the error again. Also, in case it makes a difference, in the grpConvoy1 script, I used createUnit and added them to the group, instead of createVehicleCrew. I don't think it should matter since using grpConvoy1 gave the same error, but thought I ought to mention it. Edited July 11, 2021 by Crotchety_Old_Buzzard Update Share this post Link to post Share on other sites
Crotchety_Old_Buzzard 1 Posted July 11, 2021 I figured it out. While the syntax for the command says "groupname setCurrentWaypoint waypoint", the example shows "_grp setCurrentWaypoint [_grp, 1];". I removed the waypoint variable from "_grpLiftHeli setCurrentWaypoint [_wpHeli1, 1];" and changed it to the group variable: "_grpLiftHeli setCurrentWaypoint [_grpLiftHeli, 1];". No more error. 1 Share this post Link to post Share on other sites
beno_83au 1369 Posted July 12, 2021 Yeah, that'll work fine. But the initial problem was your use of _wpHeli1. When you create the waypoint it generates an array of the group and waypoint index. So _wpHeli1 is actually [_group,_index], not just the group. Food for thought at this point really. Share this post Link to post Share on other sites