davidoss 552 Posted August 27, 2015 Hi. I am creating a side mission and have a trouble to define the task filed or task succeeded. Well i have found the solution using spawn and script handle but if i succeeded the task the other script handle still waiting to fire. I this way i cant delete the prisoner because this fired the other script handle and fail the mission which is already succeeded. [west, "escort", ["Escort the Afghan Militia High Commander to Base.", "Escort AMHC", "Escort AMHC"], getMarkerPos "respawn_west", true] spawn BIS_fnc_taskCreate; ["escort", "CREATED",true] call BIS_fnc_taskSetState; script_handler = [] spawn { waitUntil {warlord distance getMarkerPos "respawn_west" < 50 AND (vehicle warlord == warlord) AND (alive warlord) }; ["escort", "SUCCEEDED", true] call BIS_fnc_taskSetState; [west, "HQ"] sideRadio "good_job"; }; script_handler1 = [] spawn { waitUntil {!alive warlord}; ["escort", "FAILED", true] call BIS_fnc_taskSetState; [west, "HQ"] sideRadio "task_failed"; }; waitUntil { scriptDone script_handler OR scriptDone script_handler1 }; deleteMarker _markerwlord; ["capture", west] call BIS_fnc_deleteTask; ["escort", west] call BIS_fnc_deleteTask; How to remove the remaining script handle when other script handle was executed or maybe someone has a better solution for that scenario? Share this post Link to post Share on other sites
jshock 513 Posted August 27, 2015 Try something more like this, just re-work your logic on it: [west, "escort", ["Escort the Afghan Militia High Commander to Base.", "Escort AMHC", "Escort AMHC"], getMarkerPos "respawn_west", true] spawn BIS_fnc_taskCreate; ["escort", "CREATED",true] call BIS_fnc_taskSetState; script_handler = [] spawn { waitUntil {warlord distance getMarkerPos "respawn_west" < 50 AND (vehicle warlord == warlord) AND (alive warlord) }; }; waitUntil {!alive warlord || scriptDone script_handler}; if (!alive warlord) then { ["escort", "FAILED", true] call BIS_fnc_taskSetState; [west, "HQ"] sideRadio "task_failed"; } else { ["escort", "SUCCEEDED", true] call BIS_fnc_taskSetState; [west, "HQ"] sideRadio "good_job"; }; deleteMarker _markerwlord; ["capture", west] call BIS_fnc_deleteTask; ["escort", west] call BIS_fnc_deleteTask; 1 Share this post Link to post Share on other sites
davidoss 552 Posted August 27, 2015 Works perfect. Thank you. Share this post Link to post Share on other sites