Jump to content

Max2

Member
  • Content Count

    2
  • Joined

  • Last visited

  • Medals

Community Reputation

0 Neutral

About Max2

  • Rank
    Newbie
  1. Thank you @HazJ! I have adjusted my script and it is now functioning as I intended. @killzone_kid my apologies, I failed to highlight the last bracket when I copied and pasted my code. Good eyes though, I appreciate it! Here is my final working product for anyone referencing the thread, or if anyone else has any additional tips: testers.sqf _____________________________________________________________________ xxx3 = true; While {xxx3} do { sleep 3; 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";};};}; _____________________________________________________________________ To end this loop you can create a trigger or another .sqf that contains "xxx3 = false" and the script will end. Thanks again for helping me solve this problem!
  2. 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!!
×