Search the Community
Showing results for tags 'case'.
Found 2 results
-
[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; }; }; -
Race Circuit Script (aka learning to count)
wogz187 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
This topic is solved. Clear courses by reaching the next marker. If you're looking for the module it's available here: Drive Link This is the test rig in the demo. Adding new marks and whole new courses is easy. From here on is the original topic, I need to learn how to count. I posted this the other day, with a plea to understand why it works when, in my estimation, it shouldn't really. Regardless. I set about to simplify ring counting. I don't like having one .sqf file for each ring course. I feel like 1 or 2 scripts should be able to do this. One file if somebody helps me to learn how to count. Two if this works: Determine which course and define ring marks with generic titles, ringCOURSE.sqf-- this example shows 2 courses with 3 rings each if (ringCHALL==1) then { ring1=ringMARK1_1; ring2=ringMARK1_2; //first course second mark ring3=ringMARK1_3; rings= []execVM "ringCLEAR.sqf"; }; if (ringCHALL==2) then { ring1=ringMARK2_1; ring2=ringMARK2_2; //second course second mark ring3=ringMARK2_3; rings= []execVM "ringCLEAR.sqf"; }; and then build a switchdo case for each ring, or a waitUntil loop, or... I don't know and that's the question. Keep in mind there is only one ring with one trigger attached to drive the ring clearing script(s). This is what it needs to do, ["task1",[currentRING,true]] call BIS_fnc_taskSetDestination; ringGOAL_1 setpos (getpos currentRING); The real trick in this is how to go from: ring1, ring2, ring3, to set the variable "currentRING" in sequence. Oh, boy! I hope that makes sense!