Jump to content
Sign in to follow this  
csk222

How to set markers on vehicles - Best practice/method

Recommended Posts

Hello. I set the position of a marker on a helicopter in the init.sqf

Spoiler

		// Set up Markers On Vehicles
		[] spawn
		{
			while {TRUE} do
			{
				sleep 5; // 10 original setting
				
				if (alive uh80_alpha) then
				{
					"alpha_chopper" setMarkerPos position uh80_alpha;
				};
			};
		};

 

In the editor I have 2 triggers that change the marker color and text whether the helicopter is alive or dead

Spoiler

// Alive Trigger
// Trigger is repeatable
// Condition
alive uh80_alpha
// On Activation
"alpha_chopper" setMarkerColor "ColorBLUFOR"; "alpha_chopper" setMarkerText "Alpha Chopper"

// Dead Trigger
// Trigger is repeatable
// Condition
!alive uh80_alpha
// On Activation
"alpha_chopper" setMarkerColor "ColorRed"; "alpha_chopper" setMarkerText "Alpha Chopper Destroyed"

 

 I have been experimenting with deleting the 2 triggers (Alive/Dead) and adding the code to the init.sqf

Spoiler

		// Set up Markers On Vehicles
		[] spawn
		{
			while {TRUE} do
			{
				sleep 5; // 10 original setting
				
				if (alive uh80_alpha) then
				{
					"alpha_chopper" setMarkerPos position uh80_alpha;
					"alpha_chopper" setMarkerColor "ColorBLUFOR";
					"alpha_chopper" setMarkerText "Alpha Chopper";
				};
				if (!alive uh80_alpha) then				
				{
					"alpha_chopper" setMarkerColor "ColorRed";
					"alpha_chopper" setMarkerText "Alpha Chopper Destroyed";
				};
			};
		};

 

Is this a good idea? Is there a better method or more compact way of achieving this? Or should I stick with the trigger method in the editor?

 

Note (Not Necessary): I am also interested in making the marker (helicopter c_air) point in the direction the vehicle is traveling instead of it always pointing north on the map. How is that done (Out of curiosity)?

 

Thanks in advance.

Share this post


Link to post
Share on other sites

While alive uh80_alpha do

Sleep 5

Alpha_chopper setmarkerpos getposatl uh80_alpha

Alpha_chopper setmarkerdir getdir uh80_alpha

 

Try it

Share this post


Link to post
Share on other sites

if (!isServer) exitWith {};
while {true} do {

 

"mymarkerheliinitvariable" setMarkerPos getPos variablenamehelico;

variablenamehelicoeditor  addEventHandler ["respawn", {"mymarkerheliinitvariable" setmarkercolor "colorBLUE"}];

variablenamehelicoeditor  addEventHandler ["killed", {"mymarkerheliinitvariable" setmarkercolor "colorRED"}];

};

for marker color https://community.bistudio.com/wiki/setMarkerColor.

 

 

 

Share this post


Link to post
Share on other sites
7 minutes ago, M1ke_SK said:

This is executing every frame. Do you need it to be "that precise" ? Your FPS will suffer if more markers on map with this function.

 

i was wondering the same sicne one of the comments on the page says so. but i never tested and compared it. i guess i got a task for later today then :don11:

 

i'm just wondering, if that comment is solely based on the fact that it's an oneachframe thing or based on actual tests where several markers caused actual problems. because, sure anything added to the frame will cost something. question is how much.

either way. testing needed.

Share this post


Link to post
Share on other sites
2 hours ago, M1ke_SK said:

This is executing every frame. Do you need it to be "that precise" ? Your FPS will suffer if more markers on map with this function.

The engine is drawing the map, menus your cursor...etc. A few markers, or even a few dozen, shouldn't be that bad for performance and it looks better.

I don't know how badly is A3 optimized, though.

Share this post


Link to post
Share on other sites

Thanks @MrSanchez

9 hours ago, MrSanchez said:

Alpha_chopper setmarkerdir getdir uh80_alpha

 

I ended up using it like this for now, but am curious to know what you all find out about the drawicon example or any other applicable method.

Spoiler

		// Set up Markers On Vehicles
		[] spawn
		{
			while {TRUE} do
			{
				sleep 0.01;

				if (alive uh80_alpha) then
				{
					"alpha_chopper" setMarkerPos position uh80_alpha;
					"alpha_chopper" setMarkerColor "ColorBLUFOR";
					"alpha_chopper" setMarkerText "Alpha Chopper";
					"alpha_chopper" setmarkerdir getdir uh80_alpha;
				};
				if (!alive uh80_alpha) then
				{
					"alpha_chopper" setMarkerColor "ColorRed";
					"alpha_chopper" setMarkerText "Alpha Chopper Destroyed";
				};
			};
		};

 

video comparison of sleep 5; and sleep 0.01; ARMA 3 Vehicle Marker Sleep FPS Comparison

Share this post


Link to post
Share on other sites

you could also do setamrkerPos each frame to get the same fluid effect as drawIcon.

 

i think the real advantage of drawIcon is that you can use any picture. can't remember if you can rotate markers but that should also be possible with drawIcon. so you could have a rotation animation to get kind of a lock on effect.

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
Sign in to follow this  

×