Jump to content
Sign in to follow this  
ZU23

Problem with "if"

Recommended Posts

Hello, Im trying to make a command that spawns an AI but also kills him when hes at a certain distance from the player, however the distance thing doesnt seem to work.

_group = createGroup WEST;
_unit = _group createUnit ["B_Soldier_F", position player, [], 1, "FORM"];
_meters = player distance _unit;
if (_meters >= 10) then {_unit setDamage 1;};

 

Share this post


Link to post
Share on other sites

That's because the distance is to small. You check the distance only once when the unit was created. Add a loop and keep checking the distance.

Share this post


Link to post
Share on other sites

Normal. You're spawning the unit on player's position.

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  

×