marcheur

[REQUEST] Set different number of territories for a particular UID

2 posts in this topic

Hey there,

Actually, max numbers of territories that anyone can own is set to 2. But for some RP things on my server, I would need that for a certain UID, this one can have like 5 territories.

Does anyone have an idea on how I can implement this condition ? The idea is that everyone can have 2 max territory, but one UID can have up to 5 max territories...

Any hand would be very welcome :)

Share this post


Link to post
Share on other sites

Try overwriting ExileClient_util_world_canBuildHere.sqf with this:

Spoiler

 


/**
 * ExileClient_util_world_canBuildHere
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_constructionConfigName","_position","_playerUID","_result","_requiresTerritory","_canBePlacedOnRoad","_minimumDistanceToTraderZones","_minimumDistanceToSpawnZones","_minimumDistanceToOtherTerritories","_maximumTerritoryRadius","_positionObject","_nearestFlags","_radius","_buildRights","_territoryLevelConfigs","_territoryLevelConfig","_numberOfConstructionsAllowed"];
_constructionConfigName = _this select 0;
_position = _this select 1;
_playerUID = _this select 2;
_result = 0;
_requiresTerritory = getNumber (configFile >> "CfgConstruction" >> _constructionConfigName >> "requiresTerritory") isEqualTo 1;
_canBePlacedOnRoad = getNumber (configFile >> "CfgConstruction" >> _constructionConfigName >> "canBePlacedOnRoad") isEqualTo 1;
_minimumDistanceToTraderZones = getNumber (missionConfigFile >> "CfgTerritories" >> "minimumDistanceToTraderZones");
_minimumDistanceToSpawnZones = getNumber (missionConfigFile >> "CfgTerritories" >> "minimumDistanceToSpawnZones");
_minimumDistanceToOtherTerritories = getNumber (missionConfigFile >> "CfgTerritories" >> "minimumDistanceToOtherTerritories");
_maximumTerritoryRadius = getNumber (missionConfigFile >> "CfgTerritories" >> "maximumRadius");
try 
{
	if ([_position, _minimumDistanceToTraderZones] call ExileClient_util_world_isTraderZoneInRange) then
	{
		throw 4;
	};
	if ([_position, _minimumDistanceToSpawnZones] call ExileClient_util_world_isSpawnZoneInRange) then
	{
		throw 5;
	};
	if ((AGLtoASL _position) call ExileClient_util_world_isInRadiatedZone) then
	{
		throw 8;
	};
	if !(_canBePlacedOnRoad) then
	{
		if (isOnRoad [_position select 0, _position select 1, 0]) then
		{
			throw 3;
		};
	};
	{
		_positionObject = (ASLtoAGL (getPosASL _x));
		if (_position isEqualTo _positionObject) then
		{
			throw 7;
		};
	} forEach (_position nearObjects ["Exile_Construction_Abstract_Static", 3]);
	if (_constructionConfigName isEqualTo "Flag") then 
	{
		if ([_position, _minimumDistanceToOtherTerritories] call ExileClient_util_world_isTerritoryInRange) then
		{
			throw 2; 
		};
	}
	else 
	{
		_nearestFlags = (nearestObjects [_position, ["Exile_Construction_Flag_Static"], _maximumTerritoryRadius]);
		if !(_nearestFlags isEqualTo []) then
		{
			{
				_radius = _x getVariable ["ExileTerritorySize", -1];
				if (((AGLtoASL _position) distance (getPosASL _x)) < _radius) then
				{
					_buildRights = _x getVariable ["ExileTerritoryBuildRights", []];
					if (_playerUID in _buildRights) then
					{
						_territoryLevelConfigs = getArray (missionConfigFile >> "CfgTerritories" >> "prices");
						_territoryLevelConfig = _territoryLevelConfigs select ((_x getVariable ["ExileTerritoryLevel", 0]) - 1);
						_numberOfConstructionsAllowed = _territoryLevelConfig select 2;
						if ((getPlayerUID player) in ["UID1","UID2","UID3","UID4"]) then {								// place uids in this array.
							_numberOfConstructionsAllowed = 5;
						};
						if ((_x getVariable ["ExileTerritoryNumberOfConstructions", 0]) >= _numberOfConstructionsAllowed) then
						{
							throw 6; 
						};
						throw 0;
					};
				};
				throw 2;
			}
			forEach _nearestFlags; 
		};
		if (_requiresTerritory) then 
		{
			throw 1;	
		};
	};
}
catch 
{
	_result = _exception;
};
_result

 

Add UIDs to line 73 and config how many territories on line 74.   This is not tested and may not work. On my way out the door for work, so if this doesn't work I can try again later possibly.

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

  • Recently Browsing   0 members

    No registered users viewing this page.