MGTDB

Xm8/Territory show max constructions in territory detail

13 posts in this topic

Just a little tweak, so when your players are building, they can check their Xm8/territory app to see how many constructions they can build up to for that level, now shows map coordinates too!

nis6dzD.jpg

Grab ExileClient_gui_xm8_slide_territory_onOpen.sqf from client files and change the code to the following:-

Spoiler

/**
 * ExileClient_gui_xm8_slide_territory_onOpen
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 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["_territoryLevelConfigs","_territoryLevelConfig","_numberOfConstructionsAllowed","_display", "_territoryDropDown", "_playerUID", "_flag", "_buildRights", "_size", "_level", "_parts", "_index", "_kickButton", "_leaveButton", "_promoteButton", "_demoteButton", "_radiusButton"];
disableSerialization;
_display = uiNameSpace getVariable ["RscExileXM8", displayNull];
_territoryDropDown = _display displayCtrl 4132;
lbClear _territoryDropDown;
_playerUID = getPlayerUID player;
{
	_flag = _x;
	_buildRights = _flag getVariable ["ExileTerritoryBuildRights", []];
	if (_playerUID in _buildRights) then
	{
		_name = _flag getVariable ["ExileTerritoryName", ""];
		_size = _flag getVariable ["ExileTerritorySize", 0];
		_level = _flag getVariable ["ExileTerritoryLevel", 0];
		_parts = count (_flag nearObjects ["Exile_Construction_Abstract_Static", _size]);
		_territoryLevelConfigs = getArray (missionConfigFile >> "CfgTerritories" >> "prices");
		_territoryLevelConfig = _territoryLevelConfigs select ((_flag getVariable ["ExileTerritoryLevel", 0]) - 1);
		_numberOfConstructionsAllowed = _territoryLevelConfig select 2;
		_index = _territoryDropDown lbAdd (format ["%1 (Level: %2, Radius: %3m, Parts: %4/%5, Coords: %6)",_name, _level, _size, _parts,_numberOfConstructionsAllowed,mapGridPosition _flag]);
		_territoryDropDown lbSetData [_index, netId _flag]; 
	};
}
forEach (allMissionObjects "Exile_Construction_Flag_Static");
_kickButton = _display displayCtrl 4134;
_kickButton ctrlEnable false;
_leaveButton = _display displayCtrl 4135;
_leaveButton ctrlEnable false;
_promoteButton = _display displayCtrl 4136;
_promoteButton ctrlEnable false;
_demoteButton = _display displayCtrl 4137;
_demoteButton ctrlEnable false;
_radiusButton = _display displayCtrl 4138;
_radiusButton ctrlEnable false;
_territoryDropDown lbSetCurSel 0;
true

 


Then, place the file in your mission file and add the path to mission config/CfgExileCustomCode

class CfgExileCustomCode
{
	ExileClient_gui_xm8_slide_territory_onOpen = "myfixes\ExileClient_gui_xm8_slide_territory_onOpen.sqf";//change to your path!
};

Pack your mission and you're done!

Edit: Updated 23rd June 19, will now show coordinates of base

Edited by MGTDB
new feature!
  • Like 9
  • Thanks 7

Share this post


Link to post
Share on other sites
Advertisement

Thanks DB, works well.

@El Rabito The first time I copied the ExileClient_gui_xm8_slide_territory_onOpen.sqf code into notepad++ I noticed the word "true" at the end was in a different font. I deleted the word and typed it in by hand and it worked after that. 

 

_radiusButton ctrlEnable false;
_territoryDropDown lbSetCurSel 0;
true

Overtype true by hand ^^

  • Like 1

Share this post


Link to post
Share on other sites
12 hours ago, MrNeal said:

Thanks DB, works well.

@El Rabito The first time I copied the ExileClient_gui_xm8_slide_territory_onOpen.sqf code into notepad++ I noticed the word "true" at the end was in a different font. I deleted the word and typed it in by hand and it worked after that. 

 


_radiusButton ctrlEnable false;
_territoryDropDown lbSetCurSel 0;
true

Overtype true by hand ^^

Now it works :SNever had this problem before, but thx for the info 

Share this post


Link to post
Share on other sites

18:56:20 Could not load 'custom\ExileClient_gui_xm8_slide_territory_onOpen.sqf'. Extension not listed in allowedPreprocessFileExtensions
18:56:20 "ERROR: Override of ExileClient_gui_xm8_slide_territory_onOpen in CfgExileCustomCode points to a non-existent file: custom\ExileClient_gui_xm8_slide_territory_onOpen.sqf. Defaulting to vanilla Exile code!"
:(

can anyone upload a file? I have constant problems with copying from the forum, I have to rewrite everything by hand.

Edited by Peresvet81

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.