Duffman_DK 0 Posted October 6, 2020 Cannot seem to get this while loop to repeat the code with these 2 if conditions. It stops after the first sleep, and does not loop to check the if conditions. What am I missing? phoneringing = false; phonehascalled = 0; addactionphone = false; phonepickedup = false; while { phoneringing } do { Playsound ["Orange_PhoneCall_Ringtone", true]; phonehascalled = phonehascalled +1; sleep 1; if (Player2 inArea homedesk) && (!addactionphone) then { [deskphonehome, ["Tag telefonen", { phoneringing = false; phonepickedup = true; ["pickupphone","SUCCEEDED"] call BIS_fnc_taskSetState; (_this select 0) removeaction (_this select 2)}]]remoteExec ["addAction"]; addactionphone = true; } else { sleep 1; if (phonehascalled > 30) then { phoneringing = false; [ ["I nåede ikke at tage telefonen"],safeZoneX, safeZoneH / 2,true,"<t font='PuristaBold'>%1</t>",[],{ false },true ] spawn BIS_fnc_typeText2; ["pickupphone","FAILED"] call BIS_fnc_taskSetState; ["endm3", false, 10] call BIS_fnc_endMission; } else {}; }; }; waituntil {phonepickedup}; Share this post Link to post Share on other sites
beno_83au 1369 Posted October 6, 2020 https://community.bistudio.com/wiki/Debugging_Techniques - and look for showScriptErrors, you may want to turn that on. But, how is your first while loop even running? phoneringing = false; while { phoneringing } do For the two conditions: //WRONG if (Player2 inArea homedesk) && (!addactionphone) then //RIGHT if ((Player2 inArea homedesk) && (!addactionphone)) then 1 Share this post Link to post Share on other sites
Duffman_DK 0 Posted October 7, 2020 beno83_au thx a lot for the link to the debugging , will definitely check that out. 18 hours ago, beno_83au said: https://community.bistudio.com/wiki/Debugging_Techniques - and look for showScriptErrors, you may want to turn that on. But, how is your first while loop even running? phoneringing = false; while { phoneringing } do Ahh yes sorry, forgot the include the first part of the code that sets the phoneringing variable to true .. 18 hours ago, beno_83au said: //WRONG if (Player2 inArea homedesk) && (!addactionphone) then //RIGHT if ((Player2 inArea homedesk) && (!addactionphone)) then Great, thx a lot, will test it when I get a chance :) Share this post Link to post Share on other sites