Jump to content
Blitzen88

Need Help with Helicopter Transport Script

Recommended Posts

This is what I have so far:



 

Sleep 5;

_Vehicle = _this select 0;

_VehicleCrew = crew _Vehicle;

_LZMrk = _this select 1;

_RTB = _this select 2;

_WayPoint1 = (group _Vehicle) addWaypoint [getMarkerPos _LZMrk, 0];
_WayPoint1 setWaypointType "TR UNLOAD";
_WayPoint1 setWaypointBehaviour "Aware";
_WayPoint1 setWaypointCombatMode "Yellow";
_WayPoint1 setWaypointSpeed "FULL";
_WayPoint1 setwaypointstatements ["this land 'land'"];


_WayPoint2 = (group _Vehicle) addWaypoint [getMarkerPos _RTB, 0];
_WayPoint2 setWaypointType "MOVE";
_WayPoint2 setWaypointBehaviour "Aware";
_WayPoint2 setWaypointCombatMode "Yellow";
_WayPoint2 setWaypointSpeed "FULL";
_Waypoint2 setWaypointStatements ["true", "{deletevehicle _x} foreach units (group _Vehicle)"];

 

Im having an issue with the last waypoint: the helicopter is not deleted...

 

Can anyone point me in the right direction?

 

Thanks
 

Share this post


Link to post
Share on other sites

Can't use local variables inside waypointStatements. _Vehicle

Try with the vehicle's editor name.

Share this post


Link to post
Share on other sites
12 hours ago, RCA3 said:

Can't use local variables inside waypointStatements.

Should probably be explained better, as could lead to misinformation.

You can use local variables inside waypoint statements, just not variables that are out of scope. Which, in this case, is what is happening.

The code passed, as string, into the waypoint activation is deferred to run when the waypoint is completed. When the waypoint executes its activation code, this code knows nothing about the code that originally set it. So _vehicle is undefined.

 

Waypoint Activation

Quote

On Activation

Another script code block, executed when the waypoint is completed. Within this block, this refers to the group leader, and thisList refers to an array containing each unit in the group

 

{ deleteVehicle _x }forEach ( thisList + [ vehicle this ] ) 

 

  • Like 3

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

×