Jump to content

Recommended Posts

Hi. Anyone know how to make these animated/clickable markers on the map..? Like in arma 2 warfare for example where you select respawn location. I don't know where to start with it Never dealt with it before

 

400px-WF2M_RespawnMap.jpg 

Share this post


Link to post
Share on other sites

Code snippet which I did for someone on these forums a while back. Should get you started.

onMapSingleClick
{
	_MHQs = [MHQ1, MHQ2, MHQ3] select {(_pos distance2D getPos _x < 25)};
	if ((_MHQs isEqualTo [])) exitWith
	{
		hintSilent "Please select a MHQ to respawn at!";
	};
	selectedMHQ = _MHQs select 0;
	hintSilent format ["%1\n%2\n%3\n%4", selectedMHQ, (MHQ1 getVariable "teleportAvailable"), (MHQ2 getVariable "teleportAvailable"), (MHQ3 getVariable "teleportAvailable")];
	if ((!isNull (uiNamespace getVariable "MHQDialog"))) then
	{
		if ((selectedMHQ getVariable "teleportAvailable")) then
		{
			((uiNamespace getVariable "MHQDialog") displayCtrl 6666) ctrlEnable true;
		} else
		{
			((uiNamespace getVariable "MHQDialog") displayCtrl 6666) ctrlEnable false;
		};
	};
	hintSilent format ["Selected MHQ: %1", (((str selectedMHQ) splitString "MHQ") select 0)];
	ctrlMapAnimClear ((uiNamespace getVariable "MHQDialog") displayCtrl 6665);
	((uiNamespace getVariable "MHQDialog") displayCtrl 6665) ctrlMapAnimAdd [1, 0.05, (getPos selectedMHQ)];
	ctrlMapAnimCommit ((uiNamespace getVariable "MHQDialog") displayCtrl 6665);
	((uiNamespace getVariable "MHQDialog") displayCtrl 6666) ctrlAddEventHandler ["ButtonClick",
	{
		selectedMHQ spawn
		{
			if ((speed _this isEqualTo 0) && (alive _this)) then
			{
				closeDialog 0;
				cutText ["Teleporting...", "BLACK OUT"];
				sleep 5;
				player setPos [(getPos _this select 0), ((getPos _this select 1) - 8), (getPos _this select 2)];
				cutText [format ["You have respawned at MHQ #%1", (((str _this) splitString "MHQ") select 0)], "PLAIN"];
				onMapSingleClick "";
			} else
			{
				hintSilent "Teleport currently unavailable.";
			};
		};
	}];
};

 

EDIT: Example mission download and original thread.

https://hazjohnson.com/ArmA/RespawnMapMHQ.VR.zip

https://forums.bohemia.net/forums/topic/211803-map-teleport-guidialog/

 

EDIT 2: To open UI, put this in debug:

createDialog "MHQDialog";

As for the markers spinning, etc. Just add a loop which rotates them. UI was done by: @Moon_chilD

 

EDIT 3: Markers now rotate when the vehicle isn't moving, An "!" icon is shown in red (doesn't rotate) when the vehicle is moving. See code below for changes. Download version not updated.

[] spawn
{
	while {(true)} do
	{
		{
			_mkr = format ["%1mark", (str _x)];
			_mkr setMarkerPos (getPos _x);
			if ((!alive _x) || (speed _x > 0)) then
			{
				_mkr setMarkerColor "ColorRed";
				_mkr setMarkerType "mil_warning";
				_mkr setMarkerDir 0;
				_x setVariable ["teleportAvailable", false, true];
			} else
			{
				_mkr setMarkerColor "ColorGreen";
				_mkr setMarkerType "mil_flag";
				_x setVariable ["teleportAvailable", true, true];
				_mkr setMarkerDir (markerDir _mkr) + 90;
			};
		} forEach [MHQ1, MHQ2, MHQ3];
		sleep 0.5;
	};
};

@jts_2009

  • Like 4
  • Thanks 2

Share this post


Link to post
Share on other sites
On 31.07.2018 at 11:51 AM, HazJ said:

As for the markers spinning, etc. Just add a loop which rotates them

 

I doesn't they should rotate +90 every time. I mean like in warfare, smooth, like this:

 

 

Share this post


Link to post
Share on other sites

Doesn't what? Change it to your liking. It worked fine when I last tested if I recall correctly. Maybe change sleep 0.5 to 1 if too fast? This was part of some MHQ I did for someone else so yeah. Where are you stuck?

Share this post


Link to post
Share on other sites
On 31/07/2018 at 6:51 AM, HazJ said:

EDIT: Example mission download and original thread.

https://hazjohnson.com/ArmA/RespawnMapMHQ.VR.zip

Hello. The download link is broken, could you share it again? I would like to take a look at this example to learn more about this subject. thankful

Share this post


Link to post
Share on other sites

Check now. Re-uploaded.

 

I don't own the dialog btw. I did the code orignally for @Moon_chilD's dialog so yeah. You'll need his permission for that part.

Share this post


Link to post
Share on other sites
5 hours ago, HazJ said:

Check now. Re-uploaded.

 

I don't own the dialog btw. I did the code orignally for @Moon_chilD's dialog so yeah. You'll need his permission for that part.

Thank you friend. I just want to take a look at how a map is generated, for example: I would like to make a helicopter transport with a dialog box and that contains the map to select the extraction site. But I ate looking at the GUI editor a few days ago and some things are still confusing for me. As I do not have much experience in sqf and am curious, I'm running behind. Thank you again.

Share this post


Link to post
Share on other sites

RscMapControl - Use latest base defines provided by @Larrow here:

 

  • Thanks 1

Share this post


Link to post
Share on other sites

I knew this code reminds me of something.
Use it to your liking! xD

(Most of it is done by @HazJ anyway! :down:)

  • Like 1

Share this post


Link to post
Share on other sites

I think they just understood me wrong. I needed only a rotation of a marker. Just the 'rotation', technical example. Later I just opened warfare mission. Just wanted to know how it's done. It was made through crutches :grinning:

 

Here is the script. Needed part is in that while loop

 

Private ["_additionalErase","_direction","_expand","_markerColor","_markerMax","_markerMin","_markerName","_markerPosition","_markerSize","_markerType"];
_markerName = _this select 0;
_markerPosition = _this select 1;
_markerType = _this select 2;
_markerSize = _this select 3;
_markerColor = _this select 4;
_markerMin = _this select 5;
_markerMax = _this select 6;
_additionalErase = "";
if (count _this > 7) then {_additionalErase = _this select 7};

deleteMarkerLocal _markerName;
CreateMarkerLocal [_markerName,_markerPosition];
_markerName setMarkerTypeLocal _markerType;
_markerName setMarkerColorLocal _markerColor;
_markerName setMarkerSizeLocal [_markerSize,_markerSize];

_difference = (_markerMax - _markerMin)/10;
_direction = 0;
_expand = true;
activeAnimMarker = true;

if (_additionalErase != "") then {
	Private ["_pr"];
	_pr = 'WFBE_PATROLRANGE' Call GetNamespace;
	createMarkerLocal [_additionalErase,_markerPosition];
	_additionalErase setMarkerShapeLocal "Ellipse";
	_additionalErase setMarkerColorLocal _markerColor;
	_additionalErase setMarkerSizeLocal [_pr,_pr];
};

while {activeAnimMarker} do {
	sleep 0.03;

	_direction = (_direction + 1) % 360;
	_markerName setMarkerDirLocal _direction;
	_markerName setMarkerSizeLocal [_markerSize,_markerSize];

	if (_markerSize > _markerMax) then {_expand = false};
	if (_markerSize < _markerMin) then {_expand = true};
	if (_expand) then {_markerSize = _markerSize + _difference} else {_markerSize = _markerSize - _difference};
};

deleteMarkerLocal _markerName;
if (_additionalErase != "") then {deleteMarkerLocal _additionalErase};

 

The only things were needed here for me:

 

_markerName setMarkerDirLocal _direction;

 

and delay of sleep, to have smooth rotation. But, actually, I need it for a picture rotation. ST_PICTURE. If you want test it, create a control in map display (12) with type 48 (ST_PICTURE). Maybe add eventhandler to make it only rotating if map is opened:

_angle = 0;

_angle spawn
{
	_map = (finddisplay 12) displayCtrl NUMBER;

	while {visibleMap} do
	{
		if (_this > 359) then {_this = 0}; 
		_map ctrlSetAngle [_this, 0.5, 0.5]; 
		_this = _this + 2;
		sleep 0.03
	};
};

 

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

  • Like 1

Share this post


Link to post
Share on other sites

Your question was not provided clearly. You asked for animated/clickable markers which is what you got. I sadly can't read.

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

×