• 0
Mikeeeyy

"You are inside enemy territory!" Bug with fix

Question

In ExileClient_util_world_canBuildHere.sqf

		{
			_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 ((_x getVariable ["ExileTerritoryNumberOfConstructions", 0]) >= _numberOfConstructionsAllowed) then
					{
						throw 6; 
					};
					throw 0;
				};
			};
			throw 2;
		}
		//forEach (_position nearObjects ["Exile_Construction_Flag_Static", _minimumDistanceToOtherTerritories]); 
		forEach nearestObjects [_position, ["Exile_Construction_Flag_Static"], _minimumDistanceToOtherTerritories];

This needs changing to nearestObjects or change something with throw 2, if nearObjects gets the flag not closest to you first, it won't let you build as it throws after the first iteration of the loop.

File with changes and explanation here, easier to view and read: http://puu.sh/meeAX/158a7047d9.txt

Edited by Mikeeeyy
2 people like this

Share this post


Link to post
Share on other sites

9 answers to this question

  • 0

Checked, Agreed,Fixed. Thank you! :) 

Share this post


Link to post
Share on other sites
Advertisement
  • 0

I see this was supposedly fixed. Is there a patch out for this then? Much appreciated! 

Share this post


Link to post
Share on other sites
  • 0
3 minutes ago, da1geek said:

I see this was supposedly fixed. Is there a patch out for this then? Much appreciated! 

This fix will be included in the next Exile release, in the mean time use the file from the puush link.

Share this post


Link to post
Share on other sites
  • 0

Gotcha. Assuming I did it right - replaced the current  ExileClient_util_world_canBuildHere.sqf  with the linked one. Thanks again!

Share this post


Link to post
Share on other sites
  • 0

OK, sorry to ask a no0b question. Am I supposed to be adding this to my mission pbo and overwriting this in the config.cpp, or am I actually replacing it in the code folder? I assumed overwrite but that's not working. I also assume changing anything in the exileclient.pbo would cause a kick for invalid signature. Or maybe I'm just having a different issue all together. I have been putting a chernarus server together and the serverconfig.pbo I started with was missing loads of stuff to begin with. Originally I couldn't even place the flag.

Share this post


Link to post
Share on other sites
  • 0
3 minutes ago, oSoDirty said:

OK, sorry to ask a no0b question. Am I supposed to be adding this to my mission pbo and overwriting this in the config.cpp, or am I actually replacing it in the code folder? I assumed overwrite but that's not working. I also assume changing anything in the exileclient.pbo would cause a kick for invalid signature. Or maybe I'm just having a different issue all together. I have been putting a chernarus server together and the serverconfig.pbo I started with was missing loads of stuff to begin with. Originally I couldn't even place the flag.

Overwrite, if it's not working you're doing something wrong.

1 person likes this

Share this post


Link to post
Share on other sites
  • 0
Spoiler

class CfgExileCustomCode 
{
	ExileClient_gui_xm8_slide_apps_onOpen = "xm8Apps\ExileClient_gui_xm8_slide_apps_onOpen.sqf";
	ExileClient_object_player_event_onEnterSafezone = "ExileClient_object_player_event_onEnterSafezone.sqf";
	ExileClient_util_world_canBuildHere = "ExileClient_util_world_canBuildHere.sqf";
};

/**
 * 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","_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");
try 
{
	if ([_position, _minimumDistanceToTraderZones] call ExileClient_util_world_isTraderZoneInRange) then
	{
		throw 4;
	};
	if ([_position, _minimumDistanceToSpawnZones] call ExileClient_util_world_isSpawnZoneInRange) then
	{
		throw 5;
	};
	if !(_canBePlacedOnRoad) then
	{
		if (isOnRoad [_position select 0, _position select 1, 0]) then
		{
			throw 3;
		};
	};
	if (_constructionConfigName isEqualTo "Flag") then 
	{
		if ([_position, _minimumDistanceToOtherTerritories] call ExileClient_util_world_isTerritoryInRange) then
		{
			throw 2; 
		};
	}
	else 
	{
		{
			_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 ((_x getVariable ["ExileTerritoryNumberOfConstructions", 0]) >= _numberOfConstructionsAllowed) then
					{
						throw 6; 
					};
					throw 0;
				};
			};
			throw 2;
		}
		//forEach (_position nearObjects ["Exile_Construction_Flag_Static", _minimumDistanceToOtherTerritories]); 
		forEach nearestObjects [_position, ["Exile_Construction_Flag_Static"], _minimumDistanceToOtherTerritories];
		// This needs changing to nearestObjects or change something with throw 2, if nearObjects gets the flag not closest to you first, it won't let you build as it throws after the first iteration of the loop
		if (_requiresTerritory) then 
		{
			throw 1;	
		};
	};
}
catch 
{
	_result = _exception;
};
_result

 

My ExileClient_util_world_canBuildHere.sqf and the part in my config.cpp are above.  The other overwrites i have had to do before have never been an issue.

Share this post


Link to post
Share on other sites
  • 0

I'm an idiot, my plot is only 15m and since i was farther than 15 but less than 300 It wouldnt let me place it xD 

Thanks for a great fix, Dirty

Edited by oSoDirty

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.