Using gunstore warning for territory

Using gunstore warning for territory

« posted: Dec 31, 2018, 05:33 PM »
I'm looking for using "createGunStoreMarkers" function for territory. The idea is to indicate witch territory is under attack/capture.

Someone know where if it's possible and where is the better place to call this function?

Thanks!
  • Offline Animatek
  • SNET Admin
  • First Blood
  • ***
  • Posts: 50
  • Editor de Profesión - ArmA III Admin from Cuba

Re: Using gunstore warning for territory

« Reply #1 posted: Jan 01, 2019, 07:17 PM »
That would be cool. I'm interested in this topic
Soy administrador de ArmA III en una intranet en Cuba. No tengo experiencia en códigos ni programación, pero con ayuda he logrado un servicio eficiente y duradero, todo offline y sin internet.
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2512

Re: Using gunstore warning for territory

« Reply #2 posted: Jan 01, 2019, 10:05 PM »
It all depends on what you actually want to show on the map; the territory zone pattern and colors are very limited, and adding text is a different matter. You need to be more precise with your request.

Re: Using gunstore warning for territory

« Reply #3 posted: Jan 01, 2019, 10:32 PM »
The goal is to show when ennemy enter and start capturing a territory, with this warning each team can know who is capping and were and could be able to defend a previous caped territory.

In fact on the map:

Allies enter in territory and start to cap, the territory become yellow. If ennemy enter and contest the color become orange.
If blufor capture territory the area become blue, opfor red and indies green.

When territory is captured we can use plenty circle with transparency and when is under attack, capturing or contest we can use grid marker.

  • Offline Animatek
  • SNET Admin
  • First Blood
  • ***
  • Posts: 50
  • Editor de Profesión - ArmA III Admin from Cuba

Re: Using gunstore warning for territory

« Reply #4 posted: Jan 01, 2019, 10:39 PM »
I believe that he refers to receiving the same Under Attack notification (or similar) that is received when you are in the Gun Store, but applied to the territories that belong to you. For example, if a territory captured by me is being captured by the enemy, notify me before they complete the capture of the territory.

Without necessarily being within the territory
Soy administrador de ArmA III en una intranet en Cuba. No tengo experiencia en códigos ni programación, pero con ayuda he logrado un servicio eficiente y duradero, todo offline y sin internet.

Re: Using gunstore warning for territory

« Reply #5 posted: Jan 01, 2019, 10:42 PM »
Yep this is the idea

Re: Using gunstore warning for territory

« Reply #6 posted: Jan 04, 2019, 05:41 PM »
I will using "fake" gunstore for the moment, but if someone have knowledge to introduce a clean mecanism to improve capture system it could be nice ;)
  • Offline Animatek
  • SNET Admin
  • First Blood
  • ***
  • Posts: 50
  • Editor de Profesión - ArmA III Admin from Cuba

Re: Using gunstore warning for territory

« Reply #7 posted: Jan 04, 2019, 09:13 PM »
I will using "fake" gunstore for the moment, but if someone have knowledge to introduce a clean mecanism to improve capture system it could be nice ;)

Please, make public what you did.
I use the random single-territory system, it would be nice to have that kind of early warning.
Soy administrador de ArmA III en una intranet en Cuba. No tengo experiencia en códigos ni programación, pero con ayuda he logrado un servicio eficiente y duradero, todo offline y sin internet.

Re: Using gunstore warning for territory

« Reply #8 posted: Jan 05, 2019, 05:54 PM »
It's working if you place a gunstore npc with this in the init:

[this, 'GunStore', 100] execVM 'client\functions\createGunStoreMarkers.sqf'; this enableSimulation false;

And hide your npc on the floor.

Not clean method at all, but functionnal

At the top of the createGunStoreMarkers.sqf you can change the radius to fit with your territory.

The problem,with this you can choice only 1 radius, so it's problematic if your territories are not at the same radius.

I'm trying to create separate .sqf (like warning150m.sqf) and call this one instead of createGunStoreMarkers.sqf.

- I add A3W_warningterritories150 = 1;  in mainconfig

- also [] execVM "client\functions\Warning150m.sqf"; just after [] execVM "client\functions\createGunStoreMarkers.sqf"; in client init

and at every files were createGunStoreMarkers.sqf is call


but I have this: 


Quote
if (["A3W_showGunStoreStatus"] call isConfigOn) then
{

_markerName = format>
17:48:51   Error position: <isConfigOn) then
{

_markerName = format>
17:48:51   Error Undefined variable in expression: isconfigon
17:48:51 File mpmissions\__cur_mp.Chernarus_Isles\client\functions\createGunStoreMarkers.sqf, line 23
17:48:51 Error in expression <x;

if (["A3W_showGunStoreStatus"] call isConfigOn) then
{

_markerName = format>
17:48:51   Error position: <isConfigOn) then
{

_markerName = format>
17:48:51   Error Undefined variable in expression: isconfigon
17:48:51 File mpmissions\__cur_mp.Chernarus_Isles\client\functions\createGunStoreMarkers.sqf, line 23
17:48:51 Error in expression <};

and

Quote
_markerName = format>
17:48:51   Error Undefined variable in expression: isconfigon
17:48:51 File mpmissions\__cur_mp.Chernarus_Isles\client\functions\Warning150m.sqf, line 23
17:48:51 Error in expression <
if (["A3W_warningterritories150"] call isConfigOn) then
{

_markerName = format>
17:48:51   Error position: <isConfigOn) then
{


It seems something is in conflict...

Re: Using gunstore warning for territory

« Reply #9 posted: Jan 06, 2019, 10:57 AM »
AgentRev, it's possible to change

Quote
_radius = 70;

at the top of createGunStoreMarkers.sqf  by something that will allow the radius of the marker in the editor?

Re: Using gunstore warning for territory

« Reply #10 posted: Jan 06, 2019, 11:29 AM »
NVM, I think it's not the good way to do this. The best things is to fit the system with territories markers.
  • Offline Animatek
  • SNET Admin
  • First Blood
  • ***
  • Posts: 50
  • Editor de Profesión - ArmA III Admin from Cuba

Re: Using gunstore warning for territory

« Reply #11 posted: Jan 06, 2019, 09:16 PM »
Look, I'm going to show you a bit of logic, and then try to solve the enigma of the code by yourself. I'm not a programmer, so do not expect much from me. I hope it serves as a guide.
In territory \ server \ monitorTerritories.sqf there is an alert system when the territory starts to be captured. In my case, for some reason it is disabled...

Code: [Select]
// Trigger for when a capture of a territory has started
_onCaptureStarted =
{
private ["_territoryDescriptiveName", "_ownerTeam", "_msg", "_sideObject", "_descriptiveTeamName"];

_territoryDescriptiveName = _this select 0;
_ownerTeam = _this select 1;

/*
if (_ownerTeam != "") then
{
_sideObject = [_ownerTeam] call _sideObjectForSideStr;
_descriptiveTeamName = [_ownerTeam] call _getTeamName;
_msg = format["Your territory at %1 is being captured by %2!", _territoryDescriptiveName, _descriptiveTeamName];
[[_msg], "A3W_fnc_territoryActivityHandler", _sideObject, false] call A3W_fnc_MP;
};
*/
This is where you must merge the code from createGunStoreMarkers.sqf



Code: [Select]
//Used to set the status of each store.
_setStatus =
{
if(_status select (_this select 0) == (_this select 1)) exitWith {};

_markerName = format ["marker_shop_desc_%1",_x];
_markerNameZone = format ["marker_shop_zone_%1", _gunStores select (_this select 0)];
_markerNameDescription = format ["marker_shop_desc_%1", _gunStores select (_this select 0)];
_npcPos = getPosATL _x;
switch(_this select 1) do {
case "EMPTY": {
_markerNameZone setmarkerColorLocal _col_empty;
_markerNameDescription setmarkerColorLocal _col_empty;
deleteMarkerLocal _markerName;
_marker = createMarkerLocal [_markerName, _npcPos];
_markerName setMarkerShapeLocal "ICON";
_markerName setMarkerTypeLocal "mil_dot";
_markerName setMarkerColorLocal _col_empty;
_markerName setMarkerSizeLocal [1,1];
};
case "ENEMY": {
_markerNameZone setmarkerColorLocal _col_enemy;
_markerNameDescription setmarkerColorLocal _col_enemy;
_markerNameDescription setMarkerTextLocal "GUN STORE (Enemies)";
};
case "FRIENDLY": {
_markerNameZone setmarkerColorLocal _col_friendly;
_markerNameDescription setmarkerColorLocal _col_friendly;
_markerNameDescription setMarkerTextLocal "GUN STORE (Allies)";
};
case "MIXED": {
_markerNameZone setmarkerColorLocal _col_mixed;
_markerNameDescription setmarkerColorLocal _col_mixed;
_markerNameDescription setMarkerTextLocal "GUN STORE (Enemies and Allies)";
};
};

if (["A3W_gunStoreIntruderWarning"] call isConfigOn) then
{
if((_this select 2) && ((_this select 1) in ["ENEMY", "MIXED"])) then {
hintSilent parseText format ["<t size='2' color='#ff0000'>%1</t><br/><br/>%2.","¡AVISO!","¡Enemigos en el área!"];
};
};

_status set [_this select 0, _this select 1];
};

if (["A3W_showGunStoreStatus"] call isConfigOn) then
{
//Check each store to see if their state has changed and then calls the update function to make the display the correct state.
showmarkers = true;
while {showmarkers} do
{
{
_npc = _x;
_friendlyCount = 0;
_enemyCount = 0;

{
if (isPlayer _x && alive _x && _x distance _npc < _radius) then
{
if ([_x, player] call A3W_fnc_isFriendly) then
{
_friendlyCount = _friendlyCount + 1;
}
else
{
_enemyCount = _enemyCount + 1;
};
};
} forEach playableUnits;

if (player distance _npc < _radius) then
{
if(_enemyCount > 0) then
{
if (_friendlyCount > 0) then
{
[_forEachIndex, "MIXED", true] call _setStatus;
}
else
{
[_forEachIndex, "ENEMY", true] call _setStatus;
};
}
else
{
[_forEachIndex, "FRIENDLY", true] call _setStatus;
};
}
else
{
if (_enemyCount > 0) then
{
if (_friendlyCount > 0) then
{
[_forEachIndex, "MIXED", false] call _setStatus;
}
else
{
[_forEachIndex, "ENEMY", false] call _setStatus;
};
}
else
{
if (_friendlyCount > 0) then
{
[_forEachIndex, "FRIENDLY", false] call _setStatus;
}
else
{
[_forEachIndex, "EMPTY", false] call _setStatus;
};
};
};
} forEach _gunStores;

sleep 1;
};
};



This says what conditions are met for each represented color (defined above, at the beginning of the original .SQF). You must change the format of
Code: [Select]
_markerName
_markerNameZone
_markerNameDescription
and etc.
by the definition of the territory in question. (I hope my idea is not diluted in the translation)

Basically it is to add only the part of the colors and those conditions to the first scrip that I showed you, the one that is commented, evidently changing your deficiones and adapting them to those of the territories. Got it?
Soy administrador de ArmA III en una intranet en Cuba. No tengo experiencia en códigos ni programación, pero con ayuda he logrado un servicio eficiente y duradero, todo offline y sin internet.

Re: Using gunstore warning for territory

« Reply #12 posted: Jan 06, 2019, 09:37 PM »
OK thank you!

I will try it tomorow!!

Thanks a lot!
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2512

Re: Using gunstore warning for territory

« Reply #13 posted: Jan 10, 2019, 06:26 PM »
Would displaying an orange exclamation territories where enemies are present be a better alternative?

https://i.imgur.com/MFtA2um.jpg
Using gunstore warning for territory
  • Offline night
  • First Blood
  • ***
  • Posts: 98

Re: Using gunstore warning for territory

« Reply #14 posted: Jan 10, 2019, 06:29 PM »
Maybe an ingame notification also.