Hello!
I am trying to loop some commands within an .SQF that includes IF ELSE statements.
I need the script to loop while a certain variable is true so that the mission may later set the variable to false, disabling the script.
Here is my current script:
tester.sqf
____________________________________________________
_xxx3 = true;
While {_xxx3 == true} do {
sleep 1;
if (istouchingground player) then {
hint "You are on ground";
} else {
hint "Game Detected you are in water, will reset position in 3 seconds";
sleep 3;
if (istouchingground player) then {
hint "Not in water anymore";
} else {
player setpos [0,0,0]; hint "Position reset";};};
______________________________________________________
After the player has been detected in the water (or not touching ground) I have the script run another check 3 seconds afterwards to ensure that the player is actually in water and not glitching out in air for a few seconds, as is common in Arma, so that is why I have included another IF-ELSE statement below. The "sleep 1" I included in the beginning is to help minimize the impact on performance, so that the script only runs every second instead of every frame.
Running execvm "tester.sqf"; gives no error messages but the script does not run.
I tried scouring the forums for a similar situation and somehow I haven't found anything. If anyone can help me out I would be very grateful, I've been stumped on this for a few days now.
Thank you!!