Sign in to follow this  
BlackheartsGaming

NearEntities Question

2 posts in this topic

I'm stuck on some code and need a bit of help.  I'm writing a script that checks that Exile_Unit_Player is within a specific range of an ASL position on the map.

_nearPlayers = (count (_pos nearEntities [['Exile_Unit_Player'],30]));

_nearPlayers is a variable with a number of players, _pos is a given ASL coordinate, 30 meters is the distance I am after.

This works perfectly, unless the players are in a vehicle.  nearEntities doesn't seem to want to detect them.

What am I doing stupid?

Share this post


Link to post
Share on other sites
5 hours ago, BlackheartsGaming said:

I'm stuck on some code and need a bit of help.  I'm writing a script that checks that Exile_Unit_Player is within a specific range of an ASL position on the map.

_nearPlayers = (count (_pos nearEntities [['Exile_Unit_Player'],30]));

_nearPlayers is a variable with a number of players, _pos is a given ASL coordinate, 30 meters is the distance I am after.

This works perfectly, unless the players are in a vehicle.  nearEntities doesn't seem to want to detect them.

What am I doing stupid?

_nearPlayers = 0;
_distance = 30;
{
	if ((_x distance _pos) <= _distance) then
	{
		_nearPlayers = _nearPlayers + 1;                                 
	};
} forEach allPlayers;

this is slower but, it will get players in vehicles.

Edited by StokesMagee
  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.