Jump to content
Taylor1984

Hide and reveal markers

Recommended Posts

Hi!

 

I'm making an RTS style mission in which I want a map marker to appear on the position of an enemy unit when any of my units knows about that enemy unit. When my unit is killed or looses track of the enemy unit I want the enemy marker to disappear again.

Blufor is the enemy and I've tried using "east knowsAbout" removing the marker when no friendly Opfor (east) units knowsabout the Bluefor one and vice versa and this works intitially for hiding the marker but once the marker has been revealed it won't disappear again, even though no Opfor units knowsabout the Bluefor unit.  I guess I could use detection triggers somehow but there's gotta be an easier way of doing this? I'm not that good of a scripter actually so help would be much appreciated.

 

Thanks

Share this post


Link to post
Share on other sites

Thanks, but my problem is really to find a way to have the marker disappear when all friendly units stop knowing about the enemy unit that the marker belongs to.

Share this post


Link to post
Share on other sites

You can maybe use speed command?

https://community.bistudio.com/wiki/speed

while {true} do
{
	if (speed player > 0) then
	{
		// hide marker using alpha or whatever you need
	} else
	{
		// show marker using alpha or whatever you need
	};
	sleep 1;
};

Not tested, was just done quickly to give you a rough idea. There are other ways of doing this obviously. Another method would be check position and update if moved at all or X distance, etc...

Share this post


Link to post
Share on other sites
4 hours ago, Taylor1984 said:

 

Blufor is the enemy and I've tried using "east knowsAbout" removing the marker when no friendly Opfor (east) units knowsabout the Bluefor one and vice versa and this works intitially for hiding the marker but once the marker has been revealed it won't disappear again, even though no Opfor units knowsabout the Bluefor unit.

 

Let's start with sharing how you are accomplishing this, then move forward from there.

Share this post


Link to post
Share on other sites

Ah. I misunderstood I think. Share your code so we can see what you are doing.

Share this post


Link to post
Share on other sites
_group = _this select 0

#loop1

"germg1mark" setmarkerpos (getpos leader _group);"germg1mark" setMarkerDir (getdir leader _group)

? {alive _X} count units _group == 0 : "germg1mark" setMarkerAlpha 0;exit

~0.3

? east knowsAbout leader germg1grp == 0 : "germg1mark" setMarkerAlpha 0;goto "loop1"

"germg1mark" setMarkerAlpha 1

goto "loop1"

I can't use sqf so I use sqs... I'm sorry about that but it shouldn't affect the outcome of the script I guess?
They way the script works now is that it reveals the enemy unit on the map when any of my units discover it.. but it will never get hidden after that, no matter what I do.

Share this post


Link to post
Share on other sites

:hang:SQS

while {true} do
{
	if (opfor knowsAbout player <= 1) then // Return Value: Number in the range of 0 - 4, where 4 is max knowledge
	{
		// hide marker using alpha or whatever you need
	} else
	{
		// show marker using alpha or whatever you need
	};
	sleep 1;
};

Not sure how fast enemy forget about targets, or at what distance. Charges alert enemy anywhere on the map, unless this was fixed. You could use the following to manually forget though when X distance but not really a great solution for long-range snipers over viewing:

https://community.bistudio.com/wiki/forgetTarget

  • Like 1

Share this post


Link to post
Share on other sites

It takes quite some time for knowsAbout values to decay. 3-4 min of no contact if I remember correctly. With your current setup the marker tracks the enemy's position even though you have lost sight cause knowsAbout stays >0 during this extended time. 

A better approach would be to use targetKnowledge and check for last seen. 

Share this post


Link to post
Share on other sites

knowsAbout is simpler and you can directly set the markerAlpha on it. But that takes a looong time to decrease this value :

0 = [] spawn {

  While {true} do {

     "germg1mark" setMarkerAlpha (WEST knowsAbout player)/4;

     sleep 2;
  };

};

Share this post


Link to post
Share on other sites

Thanks


Knowsabout doens't seem like the ideal choice then. I'll give targetKnowledge a try and let you know if it works for me.

 

Cheers

Share this post


Link to post
Share on other sites

Isn't there a Game Option already built into the game?

I believe you can turn it on/off in the difficulty settings.

Share this post


Link to post
Share on other sites

Maybe, but I wanna use arrows because I think they look nice and I can see which way the unit is facing. I'm recreating Close Combat 3 in Arma.

Share this post


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

Maybe, but I wanna use arrows because I think they look nice and I can see which way the unit is facing. I'm recreating Close Combat 3 in Arma.

So, if I'm right, it's more a question of Line Of Sight (LOS) instead of targeting knowledge. Use checkVisibility

Share this post


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

So, if I'm right, it's more a question of Line Of Sight (LOS) instead of targeting knowledge. Use checkVisibility

Would deffo give you more control and perf impact is pretty low nowadays. 

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

×