Jump to content

Recommended Posts

Hi everyone,
Need help with this script.
I create a marker who spawn on tanks placed in Zeus on the map call T1, T2 etc...
This marker could be dynamic. I mean its move with the tanks and show on the map, with a bliking effect only when the player will be at a defined distance.
So I try this, but the marker don't move with the tank. I try to use setPos getPos player,  to attach markers to tanks but nothing.
The Marker will be create correctly, could see on the map, but didn't move with de tank...

_tank = ["T1", "T2", "T3", "T4", "T5"];
while {((!alive _tank) && (player distance _tank < 1000))} do  
{ 
(_marker1 = createMarker ["mark1", _tank]; 
_marker1 setMarkerShape "Ellypse"; 
_marker1 setMarkersize [500, 500]; 
_marker1 setMarkerColor "ColorRed"; 
mark1 attachTo [_tank]; 
["mark1", 3, 50] spawn BIS_fnc_blinkMarker; 
};

Somebody could help me?

Share this post


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

 


_tank = ["T1", "T2", "T3", "T4", "T5"];
while {((!alive _tank) && (player distance _tank < 1000))} do  
{ 
(_marker1 = createMarker ["mark1", _tank]; 
_marker1 setMarkerShape "Ellypse"; 
_marker1 setMarkersize [500, 500]; 
_marker1 setMarkerColor "ColorRed"; 
mark1 attachTo [_tank]; 
["mark1", 3, 50] spawn BIS_fnc_blinkMarker; 
};

Somebody could help me?

I don't even know where to start...

Firstly _tank is an array, hence !alive _tank will fail since alive requires an object, even so, the !alive _tank makes no sense, since it will prevent the loop from running with an alive tank on the map (assuming you got the syntax right).

Then you open a single parenthesis without ever closing it again.

Also it's Ellipse, not "Ellypse" in the setMarkerShape line.

 

Not quite sure about your variable naming, since naming an array _tank, or at least _tanks, implies it's holding objects, but yours is holding strings, so I assume it's pre placed markers? Hard to tell, since _tank is never correctly used anywhere else.

Then you got an object called mark1? Or is it a marker? Not sure here either.

Always try to be as concise and specific as possible when naming variables, also get some text editor with syntax highlighting.

 

Map markers following objects has been discussed plentiful already, with quite a few working solutions out there, like this:

 

Cheers

Share this post


Link to post
Share on other sites

Hello guys.

On 1/16/2020 at 11:00 PM, beno_83au said:

Thanks.

 

On 1/17/2020 at 11:12 AM, Grumpy Old Man said:

I don't even know where to start...

...

Thanks a lot.


Thank you for your answers and your feedback.


I apologize for the first post and the code I had rewritten and not copy / paste. So I left with what you told me and the links. I redid my code and here it is:

createMarker ["marker_attached", getPos T1];
"marker_attached" setMarkerShape "ELLIPSE";
"marker_attached" setMarkerSize [500, 500];
"marker_attached" setMarkerColor "ColorRed";
"marker_attached" setMarkerBrush "DIAGGRID";
["marker_attached", 0.5, 1000] spawn BIS_fnc_blinkMarker;

if (isServer) then
	{
		0 = [] spawn {
			while {not isNull T1} do
				{
					"marker_attached" setMarkerPos getPos T1;
					sleep 0.5;
				};
		};
};

 

  • Like 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

×