Wetherby 10 Posted March 15, 2014 Hello everyone, I have a problem, i want to check a distance between all west unit and a position and when west unit is in the disatnce range OPFOR spawn, i have try this command but it doesn't work, no OPFOR spawn: waitUntil {{side _x == west && _x distance _spawnpos <= 500 } foreach allunits}; _spawnpos variable is a position. Thank you for your help,your time and attention. Share this post Link to post Share on other sites
f2k sel 164 Posted March 15, 2014 Not tested but might work waituntil {{side _x == west && _x distance _spawnpos <= 500 } count allunits >0}; It should fire if any Blufor is less than 500 meters from _spawnpos Share this post Link to post Share on other sites
jacmac 2 Posted March 15, 2014 (edited) I think what you want to do is look at createTrigger and related setTriggerxxx commands. It can get a little tricky to debug triggered code, but far easier than what you are doing. Your waitUntil code might work but it also is going to chew up a lot of processor time constantly checking and debugging that means attempting to log the distance between all units and _spawnpos literally hundreds of times per second (not going to happen). What you're doing is polling for an event, but what you need to do is handle a triggered event instead. Edited March 15, 2014 by Jacmac Share this post Link to post Share on other sites
Wetherby 10 Posted March 15, 2014 Thank F2k SEL it work! Jacmac I use trigger to spawn unit but i want a to despawn unit when west is more 500m between position and trigger can't do that i think but if i have wrong tell me what can i do that because if it's better for permormance i will take it. Sorry for english mistake. Share this post Link to post Share on other sites