Jump to content
Sign in to follow this  
Wetherby

Another Problem with player distance

Recommended Posts

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

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

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 by Jacmac

Share this post


Link to post
Share on other sites

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×