Jump to content
redarmy

Disabling High command 3D(not map) enemy icons

Recommended Posts

Is this possible? iv ripped apart the BIS WIKI High command and have managed to modify it to always show map markers,but my main goal is to disable the 3D enemy(not friendly) icons 

 

is it possible to even do this? i ask because i want to stop looking if its actually not doable,spent too many hours on this.

Share this post


Link to post
Share on other sites

If you are making a singlePlayer mission its in game difficulty setting you can adjust that in Settings > Game Options
more info here: https://community.bistudio.com/wiki/Arma_3:_Difficulty_Settings
If you are making a mission for a server just know that on the server you need to ajdust difficulty settings and apply it before playing a game.

 

Share this post


Link to post
Share on other sites
On 4/17/2023 at 12:17 AM, Stormmy1950 said:

If you are making a singlePlayer mission its in game difficulty setting you can adjust that in Settings > Game Options
more info here: https://community.bistudio.com/wiki/Arma_3:_Difficulty_Settings
If you are making a mission for a server just know that on the server you need to ajdust difficulty settings and apply it before playing a game.

 

That has nothing to do with High command icons. This is relating to map icons. Im trying to disable 3D enemy icons in High command.

Share this post


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

Is this possible? iv ripped apart the BIS WIKI High command and have managed to modify it to always show map markers,but my main goal is to disable the 3D enemy(not friendly) icons 

 

is it possible to even do this? i ask because i want to stop looking if its actually not doable,spent too many hours on this.

 

If you can live without the friendly 3D icons the scripting command is setGroupIconsVisible.

Share this post


Link to post
Share on other sites

Thanks man , i did see this already,was hoping it could just be enemy,as friendly icons are useful for me and others. Will fall back on this if need be though. Pity there doesnt seem to be a "side' paramater

Share this post


Link to post
Share on other sites

The MARTA system has some rules and variables for setting individual groups/faction/sides, but not sure about just for the 3D icons.

  • Like 2

Share this post


Link to post
Share on other sites

There's undocumented:

bis_marta_mainscope getvariable "enemygroups";

Which you can then:

{
	player setVariable ["MARTA_hide", [_x]];
}forEach (bis_marta_mainscope getvariable "enemygroups");

But it will hide on both map and 3D, but at least you keep friendlies.

 

Any way to track that variable change without a loop, @Larrow?

  • Like 1

Share this post


Link to post
Share on other sites
7 hours ago, RCA3 said:

There's undocumented:


bis_marta_mainscope getvariable "enemygroups";

Which you can then:


{
	player setVariable ["MARTA_hide", [_x]];
}forEach (bis_marta_mainscope getvariable "enemygroups");

But it will hide on both map and 3D, but at least you keep friendlies.

 

Any way to track that variable change without a loop, @Larrow?

Thanks Larrow. RCA3, cheers aswell. Can i ask,how  do you know this is checking on a loop and would that be bad for performance?

 

Bit off topic but i have a couple of sounds from base game running from my players init on a  loop. would this be in anyway dropping performance CPU side?

 

 

waitUntil {!isNull player};
_unit = _this select 0;

private ["_explosions"];

_explosions =

[

"BattlefieldExplosions1_3D",

"BattlefieldExplosions2_3D",

"BattlefieldExplosions5_3D"

];

private ["_fireFights"];

_fireFights =

[

"BattlefieldFirefight1_3D",

"BattlefieldFirefight2_3D"

];

{

[_forEachIndex, _explosions, _fireFights] spawn

{

private ["_index","_explosions", "_fireFights"];

_index = _this select 0;

scriptName format ["initAmbientSounds.sqf: random sound playing - [%1]", _index];

_explosions = _this select 1;

_fireFights = _this select 2;

while {true} do

{

sleep (1 + random 59);

private ["_sound"];

_sound = if (random 1 < 0.5) then

{

_explosions call BIS_fnc_selectRandom

}

else

{

_fireFights call BIS_fnc_selectRandom

};

playSound _sound;

};

};

}

forEach [0,1,2];

anytime i see the line .....

 

while {true} do

i get worried.

Share this post


Link to post
Share on other sites
7 hours ago, redarmy said:

Can i ask,how  do you know this is checking on a loop and would that be bad for performance?

It's not yet, that's what I asked Larrow for, an alternative for a loop precisely to ease on performance. It shouldn't be bad at all though:

private _hiddengroups = [];
while {sleep 1; true} do{
	{
		if !(_x in _hiddengroups) then{
			player setVariable ["MARTA_hide", [_x]];      	
			_hiddengroups pushBack _x;
		};
	}forEach (bis_marta_mainscope getvariable "enemygroups");
};

On your initPlayerLocal.sqf.

  • Thanks 1

Share this post


Link to post
Share on other sites

Awesome. Thanks so much. I wish BIS gave more functionality to High command either by default or through scripting. Trying to squeeze everything out of it i can

  • Like 1

Share this post


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

anytime i see the line .....


while {true} do

i get worried.

 

12 hours ago, redarmy said:

while {true} do { sleep (1 + random 59);

 

As I understand, any while loop with a sleep shouldn't be a problem. It gets sent to the Scheduler.

  • Like 1

Share this post


Link to post
Share on other sites

Iv had issues where "while true" froze my game alot so i did alot of reading up on it.

 

would  adding a "spawn" help keep it cleaner or not needed?

[] spawn {
	while {true} do {
		sleep 5;

 

Share this post


Link to post
Share on other sites
1 hour ago, redarmy said:

would  adding a "spawn" help keep it cleaner or not needed?

 

Spawn on initPlayerLocal.sqf would be useful e.g. to continue reading down the file if you had more code below that (I should've added it actually) but otherwise, if e.g that's at the end of your file, it wouldn't do any difference.

Spawn is used on unscheduled environment to start scheduled code. initPlayerLocal.sqf is already scheduled. Event_Scripts

  • Thanks 1

Share this post


Link to post
Share on other sites

What about changing the groupIconParams for all BIS_marta_mainScope enemyGroups when the map is open?

Something like...

Spoiler

TAG_handledMartaEnemyGroups = [];

//Have this started in some preInit function
//Hopefully would fire for mission placed groups needs testing( see below ) 
addMissionEventHandler[ "GroupCreated", {
	_this call TAG_fnc_isMartaEnemyGroup;
}];


TAG_fnc_isMartaEnemyGroup = {
	params[ "_grp" ];
	
	if ( _grp in TAG_handledMartaEnemyGroups ) exitWith {};
	
	TAG_handledMartaEnemyGroups pushBackUnique _grp;
	
	//Same condition that BIS_marta_mainScope evaluates enemyGroups by
	if ( playerSide getFriend _grp <= 0.6 ) then {
				
		[ _grp ] spawn {
			params[ "_grp" ];
			
			waitUntil{
				//Make sure Marta has started
				!isNil "BIS_marta_mainScope" &&
				//And Marta has picked up the group
				{ _grp in ( BIS_marta_mainScope getVariable[ "enemyGroups", [] ] ) }
			};
			
			//back up original icon params
			_grp setVariable[ "grpIconParams", getGroupIconParams _grp ];
			
			if ( shownMap ) then {
				//Show group if map is currently open
				[ _this ] call TAG_fnc_showMartaEnemyIcons;
			}else{
				//Hide group if map is currently closed
				[ _this ] call TAG_fnc_hideMartaEnemyIcons;
			};
		};
	};
};

TAG_fnc_hideMartaEnemyIcons = {
	params[ "_grps", bis_marta_mainscope getVariable[ "enemygroups", [] ] ];
	
	{
		//Set icon params as invisible
		_x setGroupIconParams[ [0,0,0,0], "", 0, false, false, [0,0,0,0] ];
	}forEach _grps;
};

TAG_fnc_showMartaEnemyicons = {
	params[ "_grps", bis_marta_mainscope getVariable[ "enemygroups", [] ] ];
	
	{
		//Get backup icon params
		_grpIconParams = _x getVariable "grpIconParams";
		//If there was a backup
		if !( isNil "_grpIconParams" ) then {
			//Set icon params to backup
			_x setGroupIconParams _grpIconParams;
		};
	}forEach _grps;
};


//Handle map open/closing
addMissionEventHandler[ "Map", {
	params[ "_isOpen", "_isForced" ];
	
	//Map is open
	if ( _isOpen ) then {
		[] call TAG_fnc_showMartaEnemyicons;
	}else{
		//Map closed
		[] call TAG_fnc_hideMartaEnemyIcons;
	};
}];


//Wait for mission to start
waitUntil{ time > 0 };

//Just incase the above group MEH does not capture( may not be needed ) 
{
	[ _x ] call TAG_fnc_isMartaEnemyGroup;
}forEach allGroups;

 

...untested, just thinking out loud.

  • Thanks 1

Share this post


Link to post
Share on other sites

Hey, Larrow, thanks for the code! That was exactly the type of input I was expecting from you.

I revised it and tested it, great idea, but MARTA takes over and redraws the 3D icons (and 2D probably).

Spoiler

TAG_handledMartaEnemyGroups = [];

//Have this started in some preInit function
//Hopefully would fire for mission placed groups needs testing( see below ) 
addMissionEventHandler[ "GroupCreated", {
	_this call TAG_fnc_isMartaEnemyGroup;
}];


TAG_fnc_isMartaEnemyGroup = {
	params[ "_grp" ];
	
	if ( _grp in TAG_handledMartaEnemyGroups ) exitWith {};
	
	TAG_handledMartaEnemyGroups pushBackUnique _grp;
	
	//Same condition that BIS_marta_mainScope evaluates enemyGroups by
	if ( playerSide getFriend side _grp <= 0.6 ) then {
				
		[ _grp ] spawn {
			params[ "_grp" ];
			
			waitUntil{
				//Make sure Marta has started
				!isNil "BIS_marta_mainScope" &&
				//And Marta has picked up the group
				{ _grp in ( BIS_marta_mainScope getVariable[ "enemyGroups", [] ] ) }
			};
			
			//back up original icon params
			_grp setVariable[ "grpIconParams", getGroupIconParams _grp ];
			
			if ( shownMap ) then {
				//Show group if map is currently open
				[ _this ] call TAG_fnc_showMartaEnemyIcons;
			}else{
				//Hide group if map is currently open
				[ _this ] call TAG_fnc_hideMartaEnemyIcons;
			};
		};
	};
};

TAG_fnc_hideMartaEnemyIcons = {
	params[ "_grps" ];
//, bis_marta_mainscope getVariable[ "enemygroups", [] ] 
	{
		//Set icon params as invisible
		_x setGroupIconParams[ [0,0,0,0], "", 0, false, false, [0,0,0,0] ];
	}forEach _grps;
};

TAG_fnc_showMartaEnemyicons = {
	params[ "_grps" ];
//, bis_marta_mainscope getVariable[ "enemygroups", [] ]
	{
		//Get backup icon params
		private _grpIconParams = _x getVariable "grpIconParams";
		//If there was a backup
		if !( isNil "_grpIconParams" ) then {
			//Set icon params to backup
			_x setGroupIconParams _grpIconParams;
		};
	}forEach _grps;
};


//Handle map open/closing
addMissionEventHandler[ "Map", {
	params[ "_isOpen", "_isForced" ];
	
	//Map is open
	if ( _isOpen ) then {
		[] call TAG_fnc_showMartaEnemyicons;
	}else{
		//Map closed
		[] call TAG_fnc_hideMartaEnemyIcons;
	};
}];


//Wait for mission to start
waitUntil{ time > 0 };

//Just incase the above group MEH does not capture( may not be needed ) 
{
	[ _x ] call TAG_fnc_isMartaEnemyGroup;
}forEach allGroups;

 

My version (for the no enemy icons at all) is also bugged because I'm hiding only one group, and I was rewriting with addMissionEventHandler ["CommandModeChanged", {}];  but I came across same major racing problem (I spent 2 hours on this and nothing 😑).

I increased sleep, decreased BIS_marta_mainscope setVariable ["delay", 0.1], and many other things...

I.e. some icons never disappear.

Spoiler

addMissionEventHandler ["CommandModeChanged", {
	params ["_isHighCommand", "_isForced"];

	if !(_isHighCommand) exitWith{};

	0 spawn{
		while{sleep 0.1; hcShownBar} do{
			private _enemygroups = BIS_MARTA_mainscope getvariable "enemygroups";
			if (_enemygroups findIf {!(isNull _x)} isNotEqualto -1) then{
				player setVariable ["MARTA_hide", (BIS_MARTA_mainscope getvariable "enemygroups")];
				hint str (player getVariable ["MARTA_hide", []]);
			};
		};
	};
}];

 

 

Edit: when we set player setVariable ["MARTA_hide", _ourgroups], BIS_MARTA_mainscope getvariable "enemygroups" gets cleared temporarily. That was my racing situation.

Share this post


Link to post
Share on other sites

It appears that BIS_MARTA_mainscope getvariable "enemygroups"; resets itself often (see edit above), so we can't plainly setvariable "MARTA_hide" a copy of it.

@redarmy, see if this suits you. Replace the previous script I gave you.

This was the best result I could find:

Spoiler

addMissionEventHandler ["CommandModeChanged", {
	params ["_isHighCommand", "_isForced"];
	if !(_isHighCommand) exitWith{};
	0 spawn{
		while{sleep 0.1; hcShownBar} do{
			private _enemygroups = BIS_MARTA_mainscope getvariable "enemygroups";
			if (_enemygroups findIf {!(isNull _x)} isNotEqualto -1) then{
				private _hiddengroups = player getVariable ["MARTA_hide", []];
				private _tohidegroups = [];
				{
					if !(_x in _hiddengroups) then{
						_tohidegroups pushBackUnique _x;
					};
				}forEach _enemygroups;
				_hiddengroups append _tohidegroups;
				player setVariable ["MARTA_hide", _hiddengroups];
				{
					_x setGroupIconParams[[0,0,0,0], "", 0, false, false, [0,0,0,0]];
				}forEach _hiddengroups;
			};
		};
	};
}];

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks alot , il give it a look asap!

Share this post


Link to post
Share on other sites

This works really well,the only real issue i saw was sometimes enemy icons appear on the 2D map momentarily,not even fast enough to see a symbol though,just a red flash. Il run a scenario with this happily,cheers!

  • Like 1

Share this post


Link to post
Share on other sites

@redarmy, @Larrow,

Using Larrow's structure I rebuilt it with cfgFunctions and description.ext as suggested.

There's no loops anymore, but on the downside, groups detected while High Command bar is showing don't auto hide, otherwise it runs like a charm 😁 i.e no 3D (once you open/close HC bar or map) and only on 2D. Cheers, Larrow!

(Redarmy, can you please unquote me from your posts above, it's extending the thread unnecessarily. Thank you).

 

Demo mission:

https://drive.google.com/file/d/1sqKJmFKQVl-7n7FM-K06-bkXXkNYUAPa/view?usp=share_link

  • Thanks 1

Share this post


Link to post
Share on other sites

Absolutely flawless. Thanks so much guys

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×