Areas you cannot artillery strike

Areas you cannot artillery strike

« posted: Sep 17, 2019, 12:34 PM »
Hi All,
Trying to create two area on the Altis map that cannot receive an artillery strike. I want the areas quite large - approx 500m in diameter. Any suggestions?

Kind regards, Gopher_nz
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2581

Re: Areas you cannot artillery strike

« Reply #1 posted: Sep 17, 2019, 07:16 PM »
Create ellipse/rectangle markers for your areas in Eden, then add something like this right above ctrlMapAnimClear _mapCtrl; in client/items/artillery/artilleryMapClick.sqf

Code: [Select]
if (["FIRST_MARKER_NAME","SECOND_MARKER_NAME"] findIf {_pos inArea _x} != -1) then
{
_confirmBtn ctrlEnable false;
_labelCtrl ctrlSetStructuredText parseText "<t color='#FF0000'> Error: Protected area </t>";
A3W_artilleryMenu_drawEllipse = [_pos, _ellipseRadius, _ellipseRadius, 0, [1,1,1,1], "#(argb,8,8,3)color(1,0,0,0.5)"];
};

Re: Areas you cannot artillery strike

« Reply #2 posted: Sep 18, 2019, 10:27 AM »
I entered the marker details and made a minor change to the warning message as per below:

Code: [Select]
if (["marker_276","marker_277"] findIf {_pos inAreaArray _x} != -1) then
{
_confirmBtn ctrlEnable false;
_labelCtrl ctrlSetStructuredText parseText "<t color='#FF0000'> Warning: Naturally protected land </t>";
A3W_artilleryMenu_drawEllipse = [_pos, _ellipseRadius, _ellipseRadius, 0, [1,1,1,1], "#(argb,8,8,3)color(1,0,0,0.5)"];
}

... directly above ctrlMapAnimClear _mapCtrl;

... in client/items/artillery/artilleryMapClick.sqf

Not sure why but it did not work.I have checked the mission.sqm and the names are correct. The entire files code is below:

Code: [Select]
// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2018 A3Wasteland.com *
// ******************************************************************************************
// @file Name: artilleryMapClick.sqf
// @file Author: AgentRev

#include "artillery_defines.hpp"
#define GUNSTORE_RADIUS 70 // defined in client\functions\createGunStoreMarkers.sqf

params ["", "_pos", "", "_shift"];

_artiMenuDisp = [uiNamespace getVariable "A3W_artilleryMenu"] param [0,displayNull,[displayNull]];

if (isNull _artiMenuDisp) exitWith
{
A3W_artilleryMenu_MapSingleClick = nil;
removeMissionEventHandler ["MapSingleClick", _thisEventHandler];
};

if (_shift) exitWith {};

_mapCtrl = _artiMenuDisp displayCtrl A3W_artilleryMenu_Map_IDC;
_labelCtrl = _artiMenuDisp displayCtrl A3W_artilleryMenu_MapLabel_IDC;
_confirmBtn = _artiMenuDisp displayCtrl A3W_artilleryMenu_ConfirmButton_IDC;

_splashRange = getNumber (configFile >> "CfgAmmo" >> A3W_artilleryMenu_ammoClass >> "indirectHitRange");
_ellipseRadius = (A3W_artilleryMenu_strikeRadius + _splashRange - 5) max 5;
_storeDist = _ellipseRadius + GUNSTORE_RADIUS;
_tooClose = false;
_friendlies = false;

{
if (_x distance _pos < _storeDist && {!isPlayer _x && (vehicleVarName _x) select [0,8] == "GunStore"}) exitWith
{
_tooClose = true;
};
if (_x distance _pos < _ellipseRadius && {alive _x && [player, _x] call A3W_fnc_isFriendly}) then
{
_friendlies = true;
};
} forEach entities "CAManBase";

A3W_artilleryMenu_targetPos = _pos;

if (_tooClose) then
{
_confirmBtn ctrlEnable false;
_labelCtrl ctrlSetStructuredText parseText "<t color='#FF0000'> Error: Too close to store </t>";
A3W_artilleryMenu_drawEllipse = [_pos, _ellipseRadius, _ellipseRadius, 0, [1,1,1,1], "#(argb,8,8,3)color(1,0,0,0.5)"];
}
else
{
if (_friendlies) then
{
A3W_artilleryMenu_drawEllipse = [_pos, _ellipseRadius, _ellipseRadius, 0, [1,1,1,1], "#(argb,8,8,3)color(1,1,0,0.5)"];
_labelCtrl ctrlSetStructuredText parseText "<t color='#FFFF00'> Warning: Friendlies in area </t>";
}
else
{
A3W_artilleryMenu_drawEllipse = [_pos, _ellipseRadius, _ellipseRadius, 0, [1,1,1,1], "#(argb,8,8,3)color(0,1,0,0.5)"];
_labelCtrl ctrlSetStructuredText parseText "<t color='#00FF00'> Ready to fire </t>";
};

_confirmBtn ctrlEnable true;
};
if (["marker_276","marker_277"] findIf {_pos inAreaArray _x} != -1) then
{
_confirmBtn ctrlEnable false;
_labelCtrl ctrlSetStructuredText parseText "<t color='#FF0000'> Warning: Naturally protected land </t>";
A3W_artilleryMenu_drawEllipse = [_pos, _ellipseRadius, _ellipseRadius, 0, [1,1,1,1], "#(argb,8,8,3)color(1,0,0,0.5)"];
}
ctrlMapAnimClear _mapCtrl;
_mapCtrl ctrlMapAnimAdd [0.5, 0.025, _pos];
ctrlMapAnimCommit _mapCtrl;
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2581

Re: Areas you cannot artillery strike

« Reply #3 posted: Sep 20, 2019, 09:44 PM »
I fixed the code in my first post

Re: Areas you cannot artillery strike

« Reply #4 posted: Sep 21, 2019, 08:18 AM »
Yup thast did the trick - many thanks again Agent Rev