Blitzen88 18 Posted June 2, 2019 Greetings everyone, Im trying to modify Jebus' pilot kill function to include more scenarios. Here is what I have: _SubjectVehicle = vehicle (_this select 0); _Vehiclecrew = crew _SubjectVehicle; WaitUntil {!canMove _SubjectVehicle} OR {{_x in _SubjectVehicle} Count (_Vehiclecrew) == 0} OR {!canFire _SubjectVehicle}; {DeleteVehicle _x} foreach _Vehiclecrew; _SubjectVehicle setdamage 1; Im trying to tweak this so that a vehicle and its crew are destroyed when the following conditions are met: The vehicle can no longer move The crew is no longer in the vehicle The vehicle can no longer fire/shoot its gun The vehicle crew has been killed (not listed) I can get one these conditions to work but I cant seem to make all of the conditions work...? Also, does a sleep command need to be added to save performance? Thank you Share this post Link to post Share on other sites
Schatten 275 Posted June 2, 2019 @Blitzen88, waitUntil { sleep 1; !(canMove _SubjectVehicle) and {({alive _x} count (crew _SubjectVehicle)) == 0} and {!(canFire _SubjectVehicle)} }; 22 minutes ago, Blitzen88 said: Also, does a sleep command need to be added to save performance? Yes, it makes sense. Share this post Link to post Share on other sites
Blitzen88 18 Posted June 2, 2019 1 minute ago, Schatten said: @Blitzen88, waitUntil { sleep 1; !(canMove _SubjectVehicle) and {({alive _x} count (crew _SubjectVehicle)) == 0} and {!(canFire _SubjectVehicle)} }; Yes, it makes sense. Thank you for the quick response but I think didnt explain clearly - which is my fault. I want the vehicle to be destroyed when any one of the those conditions are met. Can I just change the "and's" to "or's"...? Thank you! Share this post Link to post Share on other sites
sarogahtyp 1108 Posted June 2, 2019 3 minutes ago, Blitzen88 said: Can I just change the "and's" to "or's"...? this Share this post Link to post Share on other sites
Schatten 275 Posted June 2, 2019 13 minutes ago, Blitzen88 said: Can I just change the "and's" to "or's"...? Sure. Share this post Link to post Share on other sites
Blitzen88 18 Posted June 2, 2019 7 hours ago, Schatten said: Sure. I just tested it with "Ors" and it didnt seem to work. I dont know what I'm doing wrong WaitUntil { Sleep 1; !(canMove _SubjectVehicle) or {({alive _x} count (crew _SubjectVehicle)) == 0} or {!(canFire _SubjectVehicle)} or {({_x in _SubjectVehicle} Count (crew _SubjectVehicle)) == 0} }; EDIT I dont know what I did but it seems to be working now Thank you for your help! Share this post Link to post Share on other sites
ZaellixA 383 Posted June 2, 2019 Well, just a quick one (please correct me if I am wrong). At the initial post your structure was faulty. You wrote (I have edited to make it more clear): waitUntil { !canMove _SubjectVehicle } OR { {_x in _SubjectVehicle} Count (_Vehiclecrew) == 0 } OR { !canFire _SubjectVehicle }; To my knowledge (which is definitely not great) waitUntil is not structured like an if-else. So the way you have it coded, only the first condition would be checked by waitUntil (not sure this wouldn't end up as an error due to a missing ';' after waitUntil). So, what you should had done is what Schatten suggested (also, correctly structured). Reproducing with the same kind of format I used in the above code to make the difference more distinct. waitUntil { Sleep 1; !(canMove _SubjectVehicle) or { ({alive _x} count (crew _SubjectVehicle)) == 0 } or { !(canFire _SubjectVehicle) } or { ({_x in _SubjectVehicle} Count (crew _SubjectVehicle)) == 0 } }; Hope I didn't confuse you . 1 Share this post Link to post Share on other sites