Jump to content
Sign in to follow this  
nephros

confused on how to properly implement failcode in attach slingload function

Recommended Posts

I am having difficulty with the BIS attach slingload and detach slingload functions.

I am running a script in which I attach a slingload and drop it at a repair point. If the slingload rope breaks, I want the script to stop running and the markers, task etc. to be deleted. I can't figure out why it's not working.

I've tried setting the failcode for attach slingload to be a switch that I can then use to exit the remaining script:

_wreckTask setSimpleTaskDestination (getPosATL _wreck);
hint "Helicopter wreck recovery task assigned";
_Wp1 = [Player, _slingHelper, 10, 5,{[color="#0000FF"]_slingloadFailed = true;[/color]},targetWeight]spawn BIS_fnc_wpSlingLoadAttach;

waitUntil {scriptDone _Wp1};

[color="#0000FF"]while {!(scriptdone _wp2)} do
{
 	If (slingloadFailed) exitWith {hint "You dropped the cargo!"};
	_wreckTask setSimpleTaskDestination (getPosATL repairHelipad);
	_wp2 = [Player, repairHelipad, 20, 5, [0,360]] spawn BIS_fnc_wpSlingLoadDetach;
	waitUntil {scriptDone _wp2};
};[/color]

//cleanup
deleteVehicle _slingHelper;
deleteMarker wreckMarker;
player removeSimpleTask _wreckTask;
crashSwitchList set [_wreckID, false];
_slingloadFailed = nul;
_crashSwitch = nul;
-wreckID = nul;
};

but the helicopter automatically detaches the load as soon as it attaches when I run it. I've also tried deleting all of the script components directly in the failcode, but it ignores them:

_wreckTask setSimpleTaskDestination (getPosATL _wreck);
hint "Helicopter wreck recovery task assigned";
_Wp1 = [Player, _slingHelper, 10, 5,{
                              [color="#0000FF"] deleteVehicle _slingHelper;
                        deleteMarker wreckMarker;
                        player removeSimpleTask _wreckTask;
                        crashSwitchList set [_wreckID, false];
                       _slingloadFailed = nul;
                       _crashSwitch = nul;
                       -wreckID = nul;[/color]
                                                          },targetWeight]spawn BIS_fnc_wpSlingLoadAttach;

waitUntil {scriptDone _Wp1};


_wreckTask setSimpleTaskDestination (getPosATL repairHelipad);
_wp2 = [Player, repairHelipad, 20, 5, [0,360]] spawn BIS_fnc_wpSlingLoadDetach;

        waitUntil {scriptDone _wp2};

//cleanup
deleteVehicle _slingHelper;
deleteMarker wreckMarker;
player removeSimpleTask _wreckTask;
crashSwitchList set [_wreckID, false];
_slingloadFailed = nul;
_crashSwitch = nul;
-wreckID = nul;
};

... and lastly, I tried to use a failcode switch this way, which was also ignored:


_wreckTask setSimpleTaskDestination (getPosATL _wreck);
hint "Helicopter wreck recovery task assigned";
_Wp1 = [Player, _slingHelper, 10, 5,{[color="#0000FF"]_slingloadFailed = true; hint "You dropped the cargo"[/color]},targetWeight]spawn BIS_fnc_wpSlingLoadAttach;

waitUntil {scriptDone _Wp1};

_wreckTask setSimpleTaskDestination (getPosATL repairHelipad);
_wp2 = [Player, repairHelipad, 20, 5, [0,360]] spawn BIS_fnc_wpSlingLoadDetach;
[color="#0000FF"]waitUntil {(scriptDone _wp2) || (_slingloadFailed)}[/color];


//cleanup
deleteVehicle _slingHelper;
deleteMarker wreckMarker;
player removeSimpleTask _wreckTask;
crashSwitchList set [_wreckID, false];
_slingloadFailed = nul;
_crashSwitch = nul;
-wreckID = nul;
};

Any ideas why this doesn't work?

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  

×