Jump to content
Sign in to follow this  
Brenner650

NoMo Trees by geekm0nkey

Recommended Posts

Quote from Official Exile forum:

 

"

Been a while... But here is a very simple addition. What this does is give the admins an easy way to remove trees/bushes etc from a players territory without having to modify an SQF file and upload their mission again, as it's all handled at the database level. All you have to do is edit the record for any territory and change the last field [notrees] (to be added below) to a number other than 0. Setting this number to 1, will clear all trees/bushes etc to the radius the territory is currently set for. Any number higher than 1, will clear all trees/bushes etc to that range in meters.  Easy..

Installation

 

1st - SQL additions to the territory table.
 

Quote


ALTER TABLE `territory`

ADD `notrees` tinyint NOT NULL DEFAULT '0';

 

 

2nd - Override/Overwrite [won't explain how that's done, hopefully you know how that works by now.]

 

ExileServer_system_territory_database_load.sqf

 

Spoiler

/**
 * ExileServer_system_territory_database_load
 *
 * 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["_territoryID", "_data", "_id", "_owner", "_position", "_radius", "_level", "_flagTexture", "_flagStolen", "_flagStolenBy", "_lastPayed", "_buildRights", "_moderators", "_nomotrees", "_flagObject"];
_territoryID = _this;
_data = format ["loadTerritory:%1", _territoryID] call ExileServer_system_database_query_selectSingle;
_id = _data select 0;
_owner = _data select 1;
_name = _data select 2;
_position =
[
    _data select 3,
    _data select 4,
    _data select 5
];
_radius = _data select 6;
_level = _data select 7;
_flagTexture = _data select 8;
_flagStolen = _data select 9;
_flagStolenBy = _data select 10;
_lastPayed = _data select 11;
_buildRights = _data select 12;
_moderators = _data select 13;
_nomotrees = _data select 16;
_flagObject = createVehicle ["Exile_Construction_Flag_Static",_position, [], 0, "CAN_COLLIDE"];
if (_flagStolen isEqualTo 0) then
{
    _flagObject setFlagTexture _flagTexture;
};
ExileLocations pushBack _flagObject;
_flagObject setVariable ["ExileTerritoryName", _name, true];
_flagObject setVariable ["ExileDatabaseID", _id];
_flagObject setVariable ["ExileOwnerUID", _owner, true];
_flagObject setVariable ["ExileTerritorySize", _radius, true];
_flagObject setVariable ["ExileTerritoryBuildRights", _buildRights, true];
_flagObject setVariable ["ExileTerritoryModerators", _moderators, true];
_flagObject setVariable ["ExileTerritoryLevel", _level, true];
_flagObject setVariable ["ExileTerritoryLastPayed", _lastPayed];
_flagObject call ExileServer_system_territory_maintenance_recalculateDueDate;
_flagObject setVariable ["ExileTerritoryNumberOfConstructions", _data select 15, true];
_flagObject setVariable ["ExileRadiusShown", false, true];
_flagObject setVariable ["ExileFlagStolen",_flagStolen,true];
_flagObject setVariable ["ExileFlagTexture",_flagTexture];
if (getNumber(missionConfigFile >> "CfgVirtualGarage" >> "enableVirtualGarage") isEqualTo 1) then
{
    _data = format["loadTerritoryVirtualGarage:%1", _territoryID] call ExileServer_system_database_query_selectFull;
    _flagObject setVariable ["ExileTerritoryStoredVehicles", _data, true];
};

if !(_nomotrees isEqualTo 0) then
{
    if (_nomotrees > 1) then
    {
        _terrainobjects = nearestTerrainObjects [_position, ["TREE", "SMALL TREE", "BUSH"], _nomotrees];
        {hideObjectGlobal _x} foreach _terrainobjects;
    }
    else
    {
        _terrainobjects = nearestTerrainObjects [_position, ["TREE", "SMALL TREE", "BUSH"], _radius];
        {hideObjectGlobal _x} foreach _terrainobjects;
    };
};
true

 

 

3rd - Exile.ini change. [Find the following section and replace it completely with one given below]

 

Spoiler

[loadTerritory]
SQL1_1 = SET @connector = ?;
SQL2_1 = SELECT id,owner_uid,name,position_x,position_y,position_z,radius,level,flag_texture,flag_stolen,flag_stolen_by_uid,last_paid_at,build_rights,moderators,deleted_at,(SELECT COUNT(*)FROM construction c WHERE c.territory_id = @connector),notrees FROM territory WHERE id = @connector
Number Of Inputs = 1
SQL1_INPUTS = 1
OUTPUT = 1,2-STRING,3-STRING,4,5,6,7,8,9-STRING,10,11-STRING,12-DateTime_ISO8601,13,14,15,16,17

 

That's all, by default the notrees will all be set to 0, if a player wants to clear out trees/bushes just set it to a number other than 0 as described above. A few benefits to doing things this way.. 1st, should a base be removed or deleted, the trees are put back automatically, 2nd, should you not want players to put flags inside of trees? just set the default value in the SQL to 2, and now no flags in trees."

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
Sign in to follow this  

×