Praxtor 0 Posted July 29, 2007 I want to know if is posible put inside of one Eventhandler one waituntil or while sintax like this; Quote[/b] ]pilotillo addEventHandler ["killed",{ Â Â Helii SETDAMMAGE 0; Â Â deletevehicle pilotillo; Â Â "SoldierWPilot" createUnit [position leader group player, trip_HeliAU_W,"pilotillo=this;pilotillo moveindriver HeliAU", 1, "corporal"]; Â Â deletegroup trip_HeliAU_W; Â Â Â Â Â HeliA removeEventHandler ["killed", 0]} Â Â ]; This code works normaly but the problem if is i put one waitunitl inside of the code, it allways return error. Quote[/b] ]pilotillo addEventHandler ["killed",{ waituntil { Â Â Â Â Â Â Â dammage choper_1 Â > 0.5; Â Â Â Â Â }; Â Â deletevehicle pilotillo; Â Â deletegroup trip_HeliAU_W; Â Â Â Â Â HeliA removeEventHandler ["killed", 0]} Â Â ]; In wait until i allways get one error. Is the same if i put Sleep 5; i get error. Some idea? Thanks a lot. Share this post Link to post Share on other sites
Synide 0 Posted July 29, 2007 you cannot 'sleep' or 'waitUntil' a script that is run as an eventhandler as this script is synchronous. you can however 'spawn' a 'script thread' from a script being run as an eventhandler. So, have your eventHandler 'killed' call an sqf script called KilledEH.sqf. in the 'KilledEH.sqf' have this script spawn a precompiled script (in the case where one is calling it alot) or execVM another script. In this 'other' script is where you do your 'waitUntil'. eg. Get Killed -> KilledEH gets run -> KilledEH spawns a script thread to watch for my aliveness -> when alive, remove all my weapons... got it? Share this post Link to post Share on other sites
UNN 0 Posted July 29, 2007 Also the WaitUntil part, needs to have the ; removed. So it looks like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">waituntil     {     ((dammage choper_1)  > 0.5)     }; Share this post Link to post Share on other sites