gopgop 1 Posted February 15, 2013 I have the following scripts: ins_atease.sqf: _player = _this select 0; if (atease == 0) then { atease = 1; hint "AtEase"; } else { atease = 0; hint "StopAtEase"; (_player) playmove "AmovPercMstpSlowWrflDnon"; exit; }; while {atease == 1} do { (_player) playmove "AmovPercMstpSnonWnonDnon_Ease"; }; exit; init.sqf: atease = 0; publicVariable "atease"; What I want is when ever i call ins_atease it will toggle the at ease animation.. The first part works when ever i call it, it puts me into the at ease animation. but then when i toggle it the hint for stopatease shows up but it doesnt stop my at ease animation.. what am I doing wrong? Share this post Link to post Share on other sites
tryteyker 28 Posted February 15, 2013 You need to use player playmove "" for it to stop. Also exit is unnecessary as this does not stop an sqf script, only an sqs script. Use exitWith instead. Put this at the bottom of the script: player playMove ""; Share this post Link to post Share on other sites
gopgop 1 Posted February 15, 2013 You need to use player playmove "" for it to stop. Also exit is unnecessary as this does not stop an sqf script, only an sqs script. Use exitWith instead.Put this at the bottom of the script: player playMove ""; The problem is that it the animation doesn't toggle so I solve that by using a while loop until I call the script again and it needs to stop it... but it doesn't.. the while loop doesn't stop. Without the while loop he would do it only for 1 second and then go back to normal... Share this post Link to post Share on other sites
f2k sel 163 Posted February 15, 2013 (edited) This should work. //null=[unitname] execvm "atease.sqf" _player = _this select 0; if !(_player getvariable ["atease",false]) then { _player setvariable ["atease",true]; while {_player getvariable "atease"} do { _player playmove "AmovPercMstpSnonWnonDnon_Ease"; sleep 0.1;// try smaller delay if it doesn't work 0.01 }; hint "AtEase"; } else { _player setvariable ["atease",false]; hint "StopAtEase"; sleep 2; _player switchmove ""; //exit; }; Edited February 15, 2013 by F2k Sel Share this post Link to post Share on other sites
gopgop 1 Posted February 15, 2013 (edited) One problem, because of the sleep the animation is not continues meaning it plays it from start to end many times... Switched it to sleep 0.01; and it works! thanks! Edited February 15, 2013 by gopgop Share this post Link to post Share on other sites
f2k sel 163 Posted February 15, 2013 Yea I didn't get that problem unless I ran at higher speeds x4. Share this post Link to post Share on other sites