• 0
Sign in to follow this  

Disabled building near military and roads - can't build a fire


This is a script I'm using to prevent building near certain definable structures (mainly military) and near roads.  The problem I'm having is now I can not build a campfire and I would like to make that the exception to these rules.  Could some help me by writing an exception and tell me where in this I need to place it?  I'm a complete noob when it comes to coding and scripting.  Thank you



 * ExileClient_object_item_construct
 * 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/.
_itemClassName = _this select 0;
if !(_itemClassName in (magazines player)) exitWith {false};
if( isClass(configFile >> "CfgMagazines" >> _itemClassName >> "Interactions" >> "Constructing") ) then
    if (findDisplay 602 != displayNull) then
        (findDisplay 602) closeDisplay 2; 
        if !((vehicle player) isEqualTo player) then
            throw "You cannot build while in a vehicle.";  
        _minimumDistanceToTraderZones = getNumber (missionConfigFile >> "CfgTerritories" >> "minimumDistanceToTraderZones");
        if ([player, _minimumDistanceToTraderZones] call ExileClient_util_world_isTraderZoneInRange) then
            throw "No building within a radius of 1200m around the Headquarter!";
        if (player call ExileClient_util_world_isInNonConstructionZone) then 
            throw "You can't build in this restricted military area!";
        if (player call ExileClient_util_world_isInConcreteMixerZone) then 
            throw "You are too close to a concrete mixer zone!";
        _minimumDistanceToSpawnZones = getNumber (missionConfigFile >> "CfgTerritories" >> "minimumDistanceToSpawnZones");
        if ([player, _minimumDistanceToSpawnZones] call ExileClient_util_world_isSpawnZoneInRange) then
            throw "No building within a radius of 500m around spawn zones!";

        _cantBuildNear = [
            //Namalsk Buildings
            // Cherno IFA3
        _NearRoad = (position player) nearRoads 20;
        _TooNearRoads = _NearRoad select 0;
        if (!isNil "_TooNearRoads") then { throw "ROAD"; };        
        _AIBasepos = [10729, 5320,0]; 
        _MinRange = 250; // Min distance to AI Base
        _cantBuildDist = 200; // Min distance to military buildings
        _maxSafes = 3;         
        _nearAIBase = (getPosATL player) distance _AIBasepos;
        if (_nearAIBase < _MinRange) then { throw "AIBASE"; };     
        if ({typeOf _x in _cantBuildNear} count nearestObjects[player, _cantBuildNear, _cantBuildDist] > 0) then { throw "MILITARY"; };
        if(_itemClassName isEqualTo "Exile_Item_SafeKit") then
            //Check if _maxSafes safes in range already
            _nearSafes = count (player nearObjects ["Exile_Container_Safe", 150]);
            if (_nearSafes >= _maxSafes) then { throw "MAXSAFES";  };          
        if(_itemClassName isEqualTo "Exile_Item_Flag") then 
            _maximumNumberOfTerritoriesPerPlayer = getNumber (missionConfigFile >> "CfgTerritories" >> "maximumNumberOfTerritoriesPerPlayer");
            _numberOfTerritories = player call ExileClient_util_territory_getNumberOfTerritories;
            if (_numberOfTerritories >= _maximumNumberOfTerritoriesPerPlayer) then
                throw "You have reached the maximum number of territories you can own.";
            call ExileClient_gui_setupTerritoryDialog_show;
            [_itemClassName] call ExileClient_construction_beginNewObject;
        switch (_exception) do
            case "MILITARY":
                ["ErrorTitleAndText", ["You can't build in this restricted military area!"]] call ExileClient_gui_toaster_addTemplateToast;
            case "ROAD":
                ["ErrorTitleAndText", ["You can't build too close to roads!"]] call ExileClient_gui_toaster_addTemplateToast;
            case "AIBASE":
                ["ErrorTitleAndText", ["The Lumberjack won't let you build within 250m around his lumber camp!"]] call ExileClient_gui_toaster_addTemplateToast;
            case "MAXSAFES":
                ["ErrorTitleAndText", ["You're not allowed to have more than 3 safes!"]] call ExileClient_gui_toaster_addTemplateToast;
                ["ErrorTitleAndText", ["Construction aborted, soldier!", _exception]] call ExileClient_gui_toaster_addTemplateToast;


Share this post

Link to post
Share on other sites

0 answers to this question

There have been no answers to this question yet


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  

  • Recently Browsing   0 members

    No registered users viewing this page.