Sled88 0 Posted April 11, 2010 (edited) Hi folks, I got a problem. How do I disable a started loop-script? is there any way to "destroy" the loop script when the player enters a trigger? example of my script: _object1 = _this select 0 _light = "#lightpoint" createVehicle getpos anom1; _light setLightBrightness .40; _light setLightAmbient[1.0, 1.0, 1.0]; _light setLightColor[6.0, 1.0, 1.0]; _light lightAttachObject [_object1, [0,0,0]]; #loop anom1 setpos getpos al lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_1 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_2 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_3 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_4 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_5 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_6 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_7 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_8 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_9 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_10 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_11 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_12 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_13 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_14 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_15 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_16 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_17 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_18 lightpoint setpos getpos anom1 ~0.02 anom1 setpos getpos al_19 lightpoint setpos getpos anom1 ~0.02 goto "loop" now can i stop this script`? Edited April 11, 2010 by Sled88 Share this post Link to post Share on other sites
das attorney 858 Posted April 11, 2010 (edited) I think you could group the trigger (called say trig1) to the player for activation and then put ? (triggeractivated trig1) : goto "end" before the loop in the script, and at the end of the script put #end exit Sorry if this isn't right, I'm not at my Arma machine to test :) Edited April 11, 2010 by Das Attorney Share this post Link to post Share on other sites
Sled88 0 Posted April 11, 2010 will try it thanks in advance! Share this post Link to post Share on other sites
snkman 351 Posted April 11, 2010 Okay try this. I haven't tested it but it should work. in the OnActivation of the given trigger put: SkipLoop = True; private ["_object1","_light","_array","_count","_select"]; if (isNil "SkipLoop") then {SkipLoop = False}; _object1 = _this select 0; _light = "#lightpoint" createVehicle getpos anom1; _light setLightBrightness .40; _light setLightAmbient[1.0, 1.0, 1.0]; _light setLightColor[6.0, 1.0, 1.0]; _light lightAttachObject [_object1, [0,0,0] ]; _array = [al, al_1, al_2, al_3, al_4, al_5, al_6, al_7, al_8, al_9, al_10, al_11, al_12, al_13, al_14, al_15, al_16, al_17, al_18, al_19]; _count = 0; while { (True) } do { _select = (_array select _count); anom1 setpos getpos _select; lightpoint setpos getpos anom1; if (SkipLoop) exitWith {}; sleep 0.02; _count = _count + 1; if (_count >= count _array) then {_count = 0}; }; Note: This is .sqf so you need to execute the script with "execVM" instead of "exec". Share this post Link to post Share on other sites