Jump to content
Sign in to follow this  
Norbak

detecting a single or the first enemy that gets closer to player (90 meters)

Recommended Posts

Well. The cuestión is just that. I need to make a script (not using triggers con editor) .I tried using some IF but brutal fail.

Can anyone help me?. Maybe creating a trigger inside the script?. My knowledge is quite poor.

 

Share this post


Link to post
Share on other sites

I tried something like this:

 

 

_Target = nearestObject position player;

 

if (_Target isKindof "Man" && _Target distance player <= 20) then     {

 

                                                        Hint "somebody is near";
                                                                                                                          };
 

 

And i think it works but i need to make a distance between >90 and <10. Or something like that because the condition is detecting player as himself like an "Man"  . Any idea please?.

Thanks in advance.

Share this post


Link to post
Share on other sites


_nearestUnits = player nearEntities ["CAManBase", 90]; // CAManBase class doesn't contain animals unlike Man

if ((count _nearestUnits) > 1) then { // _nearestUnits contains at least player

hint "Somebody is near";

};

Share this post


Link to post
Share on other sites

Yes!. It works!. Nice solution!. Thanks, Master Schatten!

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  

×