Search the Community
Showing results for tags 'looping'.
Found 4 results
-
Just thinking... Which one is faster, generally? Of course, considering the same code into the loopings. TAG_fnc_functionName = { // Doc string... // Returns nothing. params ["_something"]; private ["_varPrivate1"]; // code that's need to be checked many, many times... // CPU breath: sleep 1; // Restart the function in a new branch: [_something] spawn TAG_fnc_functionName; // Return: true; }; true; Or while { _someCondTrue } do { // code that's need to be checked many, many times... // CPU breath: sleep 1; }; 🧐
-
Hello, I have been pulling my hair out the last couple of days trying to get this to work and I seem to really be stuck here. I am using JEBUS spawn script and have it where if I capture a place from Opfor then Opfor will spawn in the town over to launch an assault. After a certain time I'd like the assault to be called off but maybe in the future relaunch. In my first trigger activating the assault from AI I have this in the condition: Blufor Present Repeatable "!alive hq1 && This && random 1 < 0.5 && Attack1Trigger" A radio message attached says that Opfor are assaulting. In the second trigger covering the same area: Variable Name: OpForAss1 Blufor PresentRepeatable Condition: this Interval: 10 (For testing purposes) On Act: Attack1Trigger = True; publicVariable "Attack1Trigger"; Timeout: 10 seconds on all 3 inputs Third trigger covering the same area: Blufor Present Repeatable Condition: triggerActivated OpForAss1 Interval: 25 On Act: Attack1Trigger = False; publicVariable "Attack1Trigger"; Countdown: 25 seconds on all 3 inputs Radio message attached saying Opfor is no longer assaulting This does not repeat whenever I use the last trigger to change the variable to false. If I'm going about this completely wrong then by all means, please show me a way that is more efficient. I've been piecing this together the last few days from different threads on the internet over different problems since I try to exhaust my resources before making a thread about it on here. Thanks for any help and sorry in advance if I start asking some basic questions after these responses. Peace
-
[SOLVED] Looping switch-do, skip a case if true during earlier loop
Asmodeuz posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, the short script I've typed below is checking whether a player is inside a marker's area (or not). When the player is (inside the marker's area) an action "Test action" will be added to the player's action menu. Now, since the script is being looped a new action menu entry gets added to the action menu every 5 seconds. Thus far haven't been able to come up with anything meaningfull so: is there a way to stop new action menu entry being added if one has already been added during the earlier loop? [] spawn {while {alive player} do {switch (true) do { case (player inArea "marker1"): {testActionID = player addAction ["Test action",{}];}; case !(player inArea "marker1"): {player removeAction testActionID}; }; sleep 5; }; }; -
So I can get ambient sound/music to loop in a single player setting using ehID = addMusicEventHandler ["MusicStop", {playMusic "music1";}];playMusic "music1"; but I am not sure if this will work if I host a multiplayer game. Does anyone know if this is liable to break in MP or know of a sound looping script that will definitively work in MP? Finally, I would also like to end said loop once it got started via a radio command, I already know how to set the trigger up but I don't know what I have to put in the activation field to make it stop, I tried terminate my_music_handle; but that didn't work. Thanks in advance for the help.