PDA

View Full Version : scripted waypoint trouble



Deg
May 18 2011, 03:10
Hi all im having a little trouble with my script im trying to delete this group after it reaches the second waypoint and im not quit sure how to add in deleteVehicle do i need to use setWaypointStatements? ive been searching around but still cant figure it out.
grp = [getMarkerPos "Spawn1",side player, (configFile >> "CfgGroups" >> "West" >> "USMC" >> "Infantry" >> "USMC_InfSquad")] call BIS_fnc_spawnGroup;
wp = grp addwaypoint [getMarkerPos "s1",0];
wp setWaypointType "SAD";
wp setWaypointCombatMode "RED";
wp setWaypointSpeed "FULL";
wp setWaypointBehaviour "AWARE";
wp1 = grp addwaypoint [getMarkerPos "s2",0];
wp1 setWaypointType "MOVE";
wp1 setWaypointCombatMode "RED";
wp1 setWaypointSpeed "FULL";
wp1 setWaypointBehaviour "AWARE"; Any help will be appreciated, thanks in advanced :)

Deg

Demonized
May 18 2011, 03:48
this will delete any vehicle and units in the group wich has the waypoints.

wp1 setWaypointStatements ["true", "deletevehicle (vehicle this); {deleteVehicle _x} forEach units group this;"];

Deg
May 18 2011, 05:56
That kind of worked, but when the first guy reached the waypoint he deleted and the rest of the group just stayed there. Thanks

Deg

---------- Post added at 12:57 AM ---------- Previous post was at 12:43 AM ----------

Thanks i got it to work i just didnt use ''deletevehicle (vehicle this)''; and they all deleted when the squad leader reached the waypoint. One other question how would i add a sleep delay to that so it will give a chance for all squad members to reach the waypoint before they get deleted?

---------- Post added at 01:56 AM ---------- Previous post was at 12:57 AM ----------

duh setwaypointtimeout :o. Thanks for your help

Demonized
May 18 2011, 06:04
you can use spawn (http://community.bistudio.com/wiki/spawn) to use sleep (http://community.bistudio.com/wiki/sleep) functions, like this:

wp1 setWaypointStatements ["true", "_null = this spawn {sleep 30; {deleteVehicle _x} forEach units group _this;};"];
there is also distance (http://community.bistudio.com/wiki/distance) that can be used in a waituntil (http://community.bistudio.com/wiki/waitUntil) instead of sleep 30;

waitUntil {{(_x distance (getWPPos wp1)) < 50 OR !alive _x} count units group _this};

basically, spawn allows you to create a script without physically having a script file in your mission, thus alowing you to use all script commands not easily used in setWaypointStatements without it.