Sign in to follow this  
Followers 0
Patrix87

Exile functions and territory list

7 posts in this topic

Hi,

Is there a place where I could find information related to exile functions ?

E.G. I tried to use ExilePlayerInSafezone and it did not work and I could not find any information about it anywhere.

There's probably a function to find if an object is within the limits of someone's territory but again... I can't find anything about that...

Thanks for your help.

Share this post


Link to post
Share on other sites

This isn't exactly what you are looking for, but it might help with some modification. Then again, it might not even work, it's just something I'm working on in an unrelated script trying to count the number of objects within someone's territory. It was cribbed from Exile's function to determine how much territory protection money you owe. I'd recommend looking there also in the Exile Client files. Or maybe in the script that is utilized when a player is trying to place a construction, as that returns an error message if you're not in your own territory?

{
_flag = _x;
_flagOwner = _flag getVariable ["ExileOwnerUID", ""];
if (_playerUID = isEqualTo _flagOwner) then
	{
	_flagLevel = _flag getVariable ["ExileTerritoryLevel", 1];
	_flagRadius = _flag getVariable ["ExileTerritorySize", 15];
	_flagObjects = 1 + (count ((getPosATL _flag) nearObjects ["Exile_Construction_Abstract_Static", _flagRadius]));
	_territoriesNumber = _territoriesNumber + 1;
	_territoriesLevels = _territoriesLevels + _flagLevel;
	_territoriesConstrs = _territoriesConstrs + _flagObjects;
	};
} forEach (allMissionObjects "Exile_Construction_Flag_Static");

 

Share this post


Link to post
Share on other sites
Advertisement

there's apparently a function that you can call with a position as the parameter : ExileClient_util_world_IsInTerritory

But I get an error in NearObject... Maybe related to 1.54

Share this post


Link to post
Share on other sites

Yeah, that function looks like the one. It's possible, but seems doubtful that it's related to 1.54. What's your error?

Share this post


Link to post
Share on other sites
//check if coordinate is in safezone try 5 then abort.
_badLocation = false;
_maxRange = getNumber (missionConfigFile >> "CfgTerritories" >> "maximumRadius");

for "_i" from 1 to 5 do {
	//randomize spawn location
	_xOffset = floor ((random (HZMaxSpawnDistance-HZMinSpawnDistance))+HZMinSpawnDistance);
	_yOffset = floor ((random (HZMaxSpawnDistance-HZMinSpawnDistance))+HZMinSpawnDistance);
	_xOffset = [_xOffset,(-_xOffset)] call BIS_fnc_selectRandom;
	_yOffset = [_yOffset,(-_yOffset)] call BIS_fnc_selectRandom;
	_zombieSpawnPosition = [round((_playerPosition select 0) + _xOffset),round((_playerPosition select 1) + _yOffset)];
	//fetch flags around the spawn position
	_flags = _zombieSpawnPosition nearObjects ["Exile_Construction_Flag_Static", _maxRange];
	{
		_distance = (getPosATL _x) distance _zombieSpawnPosition;
		_radius = _x getVariable ["ExileTerritorySize", 0];
		if (_distance <= _radius) exitWith {_badLocation = true}; //if the tested spawn is inside a territory, exit the foreach loop.
		sleep 0.05;
	}forEach _flags;
	if !(_badLocation) exitWith {};	//if the previous spawn position was outside the limit of a territory, exit the loop and use the position.
	sleep 0.05;
};

I've moved it into the code and it's working now.

thanks for the hint about Exile_Construction_Flag_Static

Share this post


Link to post
Share on other sites

You're welcome, glad it works.

FYI, there's also a default Exile function that picks a random location within a specified radius you might find helpful in your script. Don't have my files handy or I'd give you the name.

Edited by Spartan

Share this post


Link to post
Share on other sites

Yeah the only thing is that mine as a min and max radius to avoid zombies spawning too close.

1 person likes this

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  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.