Barba-negra 117 Posted October 26, 2018 hello guys I have come back here with other questions and to solve an error that is giving me a script that I did, the scripts work well, the error that is giving me is on a calculation outside the estimated range, I explain: //Demora missile Demora10 = [] spawn { while{true} do { if ((Barco distance missile1) < 3000 and (Barco distance missile1) > 1600 or (Barco distance missile2) < 3000 and (Barco distance missile2) > 1600 or (Barco distance missile3) < 3000 and (Barco distance missile3) > 1600 or (Barco distance missile4) < 3000 and (Barco distance missile4) > 1600 or (Barco distance missile5) < 3000 and (Barco distance missile5) > 1600 or (Barco distance missile6) < 3000 and (Barco distance missile6) > 1600 or (Barco distance missile7) < 3000 and (Barco distance missile7) > 1600 or (Barco distance missile8) < 3000 and (Barco distance missile8) > 1600 or (Barco distance missile9) < 3000 and (Barco distance missile9) > 1600 or (Barco distance missile10) < 3000 and (Barco distance missile10) > 1600 ) then { Demora9 = [] spawn { sonar say3d "alarmadeamenaza011"; }; }; if ((Barco distance missile1) < 1500 and (Barco distance missile1) > 800 or (Barco distance missile2) < 1500 and (Barco distance missile2) > 800 or (Barco distance missile3) < 1500 and (Barco distance missile3) > 800 or (Barco distance missile4) < 1500 and (Barco distance missile4) > 800 or (Barco distance missile5) < 1500 and (Barco distance missile5) > 800 or (Barco distance missile6) < 1500 and (Barco distance missile6) > 800 or (Barco distance missile7) < 1500 and (Barco distance missile7) > 800 or (Barco distance missile8) < 1500 and (Barco distance missile8) > 800 or (Barco distance missile9) < 1500 and (Barco distance missile9) > 800 or (Barco distance missile10) < 1500 and (Barco distance missile10) > 800 ) then { Demora8 = [] spawn { terminate Demora9; Sleep 2; sonar say3d "alarmadeamenaza022"; }; }; if ((Barco distance missile1) < 700 and (Barco distance missile1) > 400 or (Barco distance missile2) < 700 and (Barco distance missile2) > 400 or (Barco distance missile3) < 700 and (Barco distance missile3) > 400 or (Barco distance missile4) < 700 and (Barco distance missile4) > 400 or (Barco distance missile5) < 700 and (Barco distance missile5) > 400 or (Barco distance missile6) < 700 and (Barco distance missile6) > 400 or (Barco distance missile7) < 700 and (Barco distance missile7) > 400 or (Barco distance missile8) < 700 and (Barco distance missile8) > 400 or (Barco distance missile9) < 700 and (Barco distance missile9) > 400 or (Barco distance missile10) < 700 and (Barco distance missile10) > 400 ) then { Demora7 = [] spawn { terminate Demora8; Sleep 2; sonar say3d "alarmadeamenaza033"; }; }; if ((Barco distance missile1) < 350 and (Barco distance missile1) > 150 or (Barco distance missile2) < 350 and (Barco distance missile2) > 150 or (Barco distance missile3) < 350 and (Barco distance missile3) > 150 or (Barco distance missile4) < 350 and (Barco distance missile4) > 150 or (Barco distance missile5) < 350 and (Barco distance missile5) > 150 or (Barco distance missile6) < 350 and (Barco distance missile6) > 150 or (Barco distance missile7) < 350 and (Barco distance missile7) > 150 or (Barco distance missile8) < 350 and (Barco distance missile8) > 150 or (Barco distance missile9) < 350 and (Barco distance missile9) > 150 or (Barco distance missile10) < 350 and (Barco distance missile10) > 150 ) then { Demora6 = [] spawn { terminate Demora7; Sleep 2; sonar say3d "alarmadeamenaza044"; }; }; if ((Barco distance missile1) < 140 and (Barco distance missile1) > 1 or (Barco distance missile2) < 140 and (Barco distance missile2) > 1 or (Barco distance missile3) < 140 and (Barco distance missile3) > 1 or (Barco distance missile4) < 140 and (Barco distance missile4) > 1 or (Barco distance missile5) < 140 and (Barco distance missile5) > 1 or (Barco distance missile6) < 140 and (Barco distance missile6) > 1 or (Barco distance missile7) < 140 and (Barco distance missile7) > 1 or (Barco distance missile8) < 140 and (Barco distance missile8) > 1 or (Barco distance missile9) < 140 and (Barco distance missile9) > 1 or (Barco distance missile10) < 140 and (Barco distance missile10) > 1 ) then { Demora5 = [] spawn { terminate Demora6; Sleep 2; sonar say3d "alarmadeamenaza055"; }; }; if (!alive missile1 or !alive missile2 or !alive missile3 or !alive missile4 or !alive missile5 or !alive missile6 or !alive missile7 or !alive missile8 or !alive missile9 or !alive missile10) then { [] spawn { terminate Demora5; Sleep 2; }; }; Sleep 1 }; }; so far it works perfectly, the problem occurs when the enemy ship is arranged in a distance of less than 1500 meters, that is, close to the target ship, then the script will try to eliminate the demora9 spawn, which is observed in the second if, not finding that the spawn was created this throws the error of undefined variable, the function of the Demore spawn nine is a proximity alarm slower than the second, indicating that a threat is approaching, then being less than 1500 meters the new spawn finished the first and started the second with a little more speed, then how could I do to recognize the variable defined if it was not created? How can I do that? help Share this post Link to post Share on other sites
pierremgi 4903 Posted October 27, 2018 Take some vacations. Have a break! https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#IncomingMissile 1 Share this post Link to post Share on other sites
Barba-negra 117 Posted October 27, 2018 hahahah xD, I will do it @pierremgi, When I finish the work I'm doing, believe me, I'll take my vacations, I'm very close to finishing, very little. thanks mate, I'll check that information Share this post Link to post Share on other sites
HazJ 1289 Posted October 28, 2018 Also, use code tags. // Like this 2 Share this post Link to post Share on other sites
Barba-negra 117 Posted October 28, 2018 I found the solution, I found a way to finish it before I got to the other distance, and it does not give me the error :) and it works wonderfully Share this post Link to post Share on other sites