Jump to content

Recommended Posts

Hello. 

What would be the process for adding  the blue hexagon over friendly ai on screen like you see in apex protocol to an ai in a custom mission?

Share this post


Link to post
Share on other sites

look for BIS_fnc_EXP_camp_IFF. here's a much simplified version of it. you can change what units will have an icon.

 

icon_units = {allunits select {side _x isEqualTo side player}};
addMissionEventHandler ["Draw3D",
{
	{
		drawIcon3D 
		[
			"a3\ui_f\data\igui\cfg\cursors\select_ca.paa",
			[0,125,255,0.5],
			_x modelToWorld (_x selectionPosition "Spine3"),
			1,
			1,
			0
		];	
	} foreach call icon_units;
}];

 

  • Thanks 1

Share this post


Link to post
Share on other sites
3 hours ago, bad benson said:

look for BIS_fnc_EXP_camp_IFF. here's a much simplified version of it. you can change what units will have an icon.

 


icon_units = {allunits select {side _x isEqualTo side player}};
addMissionEventHandler ["Draw3D",
{
	{
		drawIcon3D 
		[
			"a3\ui_f\data\igui\cfg\cursors\select_ca.paa",
			[0,125,255,0.5],
			_x modelToWorld (_x selectionPosition "Spine3"),
			1,
			1,
			0
		];	
	} foreach call icon_units;
}];

 

You're the greatest, thank you!

Share this post


Link to post
Share on other sites
3 hours ago, bad benson said:

look for BIS_fnc_EXP_camp_IFF. here's a much simplified version of it. you can change what units will have an icon.

 


icon_units = {allunits select {side _x isEqualTo side player}};
addMissionEventHandler ["Draw3D",
{
	{
		drawIcon3D 
		[
			"a3\ui_f\data\igui\cfg\cursors\select_ca.paa",
			[0,125,255,0.5],
			_x modelToWorld (_x selectionPosition "Spine3"),
			1,
			1,
			0
		];	
	} foreach call icon_units;
}];

 

Real quick, how do I select what units I want it to apply to?

 

Share this post


Link to post
Share on other sites

be aware that this isn't optimised. you might want to update the icon_units array only every 10 seconds only or something. i'm sure someone will have an idea.

 

Quote

Real quick, how do I select what units I want it to apply to?

 

look at the first line. this is set up for an array of units that changes over time. you can easily make it a static thing by removing the {} in the first line and the "call" in the line above the last one.

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, AeroPostal said:

Real quick, how do I select what units I want it to apply to?

 

Well currently. Like you had specified in the post and as bad benson replied with an answer: you wanted all of the friendly players. So it'll match the icons to whatever side is currently assigned to the player.

so if you wanted to do east instead of whatever the player side is manually: 

icon_units = {allUnits select {side  _x isEqualTo east}};

etc

Share this post


Link to post
Share on other sites
2 minutes ago, bad benson said:

be aware that this isn't optimised. you might want to update the icon_units array only every 10 seconds only or something. i'm sure someone will have an idea.

sleep it, or put it into a function.

 

Share this post


Link to post
Share on other sites

Thankfully it's only applied to one unit, so the icon itself stutters a little but not to the point where it's annoying. 

and thank you.

Again, new to scripting any information helps aha.

Share this post


Link to post
Share on other sites

try replacing "modelToWorld" with "modelToWorldVisual".

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, AeroPostal said:

Thankfully it's only applied to one unit, so the icon itself stutters a little but not to the point where it's annoying. 

and thank you.

Again, new to scripting any information helps aha.

Shouldn't be any stuttering? Maybe you might want to do this on a need-to-know basis rather than all the time.

maybe even just onEachFrame it and sleep it. Obviously  sleep would be your update time.

Share this post


Link to post
Share on other sites
Just now, Midnighters said:

Shouldn't be any stuttering? Maybe you might want to do this on a need-to-know basis rather than all the time.

maybe even just onEachFrame it and sleep it. Obviously  sleep would be your update time.

Yeah it's weird, I'm curious to how BI did it in apex. At any rate, how would I add in a sleep line, furthermore, if I want to apply this to one unit only, not including the player and the HQ unit on the map. What would I need to change?

Share this post


Link to post
Share on other sites
1 minute ago, AeroPostal said:

Yeah it's weird, I'm curious to how BI did it in apex. At any rate, how would I add in a sleep line, furthermore, if I want to apply this to one unit only, not including the player and the HQ unit on the map. What would I need to change?

go ahead and follow through with what bad benson had suggested. 

 

5 minutes ago, bad benson said:

try replacing "modelToWorld" with "modelToWorldVisual".

 

sleep needs to be at the end of the scope, otherwise it becomes delayed at the time of planned execution:

 

icon_units = {allunits select {side _x isEqualTo side player}};
addMissionEventHandler ["Draw3D",
{
	{
		drawIcon3D 
		[
			"a3\ui_f\data\igui\cfg\cursors\select_ca.paa",
			[0,125,255,0.5],
			_x modelToWorld (_x selectionPosition "Spine3"),
			1,
			1,
			0
		];	
			sleep 0.25; //your delay here?
	} foreach call icon_units;
}];

I don't have the ability to test this, and it may be incorrect but take a stab at it 

Share this post


Link to post
Share on other sites
6 minutes ago, bad benson said:

try replacing "modelToWorld" with "modelToWorldVisual".

Ha! That did it! works smoothly now thanks for that.

  • Like 1

Share this post


Link to post
Share on other sites

Is there  a way to hide the icons from select units of the player's side? I have an HQ unit on the map and the icon shows up on screen a mile away and looks pretty stupid.

Share this post


Link to post
Share on other sites

I discover this post. I'm using this mission EH for my personal icons also. It's" on each framed" or  so you don't need a loop. You can't never ever add suspension (sleep) in this direct environment.

And as Bad Benson said, the flickering disappear with modelToWorldVisual.

Then, I apply some conditions to filter units along with them (difficulty, type of asset, enemies in sight only, friendly as net broadcasting within distances, fading with distances ...).

Here for a simple distance, referring to the player:

icon_units = {allunits select {side _x isEqualTo playerSide && _x distanceSqr player < 250000}};

Have a look at playerSide and distanceSqr (faster than distance). Be curious, follow BIKI before writing.

 

  • Like 2

Share this post


Link to post
Share on other sites
43 minutes ago, pierremgi said:

I discover this post. I'm using this mission EH for my personal icons also. It's" on each framed" or  so you don't need a loop. You can't never ever add suspension (sleep) in this direct environment.

And as Bad Benson said, the flickering disappear with modelToWorldVisual.

Then, I apply some conditions to filter units along with them (difficulty, type of asset, enemies in sight only, friendly as net broadcasting within distances, fading with distances ...).

Here for a simple distance, referring to the player:


icon_units = {allunits select {side _x isEqualTo playerSide && _x distanceSqr player < 250000}};

Have a look at playerSide and distanceSqr (faster than distance). Be curious, follow BIKI before writing.

 

Oh god, what was i thinking?

Correct sleep cannot be added in this environment. Thanks for that.

 

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

×