jts_2009 96 Posted July 31, 2018 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 Share this post Link to post Share on other sites
HazJ 1289 Posted July 31, 2018 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 5 2 Share this post Link to post Share on other sites
jts_2009 96 Posted October 4, 2018 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
HazJ 1289 Posted October 4, 2018 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
Djavu 9 Posted January 2, 2019 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
HazJ 1289 Posted January 2, 2019 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
Djavu 9 Posted January 3, 2019 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
HazJ 1289 Posted January 3, 2019 RscMapControl - Use latest base defines provided by @Larrow here: 1 Share this post Link to post Share on other sites
Moon_chilD 200 Posted January 11, 2019 I knew this code reminds me of something. Use it to your liking! xD (Most of it is done by @HazJ anyway! ) 1 Share this post Link to post Share on other sites
pierremgi 4853 Posted January 11, 2019 A little BIS function here. 4 Share this post Link to post Share on other sites
jts_2009 96 Posted January 11, 2019 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 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 1 Share this post Link to post Share on other sites
HazJ 1289 Posted January 11, 2019 Your question was not provided clearly. You asked for animated/clickable markers which is what you got. I sadly can't mind read. 1 1 Share this post Link to post Share on other sites
linkinpunk 12 Posted September 5, 2020 init.sqf: Spoiler ALTMAP_Markers = ["Marker_0","Marker_1"]; ALTMAP_ShowMarkerIfNear = { Params ["_control", "_xPos", "_yPos"]; private _MarkerDir = uiNamespace getVariable ["ALTMAP_MarkerDir", 0]; private _MarkerAdd = uiNamespace getVariable ["ALTMAP_MarkerAdd", +1]; private _MarkerSize = uiNamespace getVariable ["ALTMAP_MarkerSize", 2.0]; private _MarkerResz = uiNamespace getVariable ["ALTMAP_MarkerResize", -0.02]; private _posMarkers = []; {_posMarkers set [count _posMarkers, getMarkerPos _x];} forEach ALTMAP_Markers; if (_MarkerDir < 2) then {_MarkerAdd = +1;}; if (_MarkerDir > 358) then {_MarkerAdd = -1;}; if (_MarkerSize < 1.2) then {_MarkerResz = +0.02;}; if (_MarkerSize > 1.8) then {_MarkerResz = -0.02;}; _MarkerDir = _MarkerDir + _MarkerAdd; _MarkerSize = _MarkerSize + _MarkerResz; uiNamespace setVariable ["ALTMAP_MarkerDir", _MarkerDir]; uiNamespace setVariable ["ALTMAP_MarkerAdd", _MarkerAdd]; uiNamespace setVariable ["ALTMAP_MarkerSize", _MarkerSize]; uiNamespace setVariable ["ALTMAP_MarkerResize", _MarkerResz]; private _tmpScreenToWorld = _control ctrlMapScreenToWorld [_xPos, _yPos]; private _nearestMarkerPos = [_posMarkers,_tmpScreenToWorld] call BIS_fnc_nearestPosition; private _tmpMarker = "ALTMAP_PathTo"; if ((_nearestMarkerPos distance _tmpScreenToWorld)<25) then { if ((str (getMarkerPos _tmpMarker)) == "[0,0,0]") then { _tmpMarker = createMarkerLocal ["ALTMAP_PathTo", _nearestMarkerPos]; playSound "Click"; }; _tmpMarker = "ALTMAP_PathTo"; _tmpMarker setMarkerPosLocal _nearestMarkerPos; _tmpMarker setMarkerTypeLocal "selector_selectedMission"; _tmpMarker setMarkerColorLocal "ColorYellow"; _tmpMarker setMarkerTextLocal format ["Jump here!"]; _tmpMarker setMarkerSizeLocal [_MarkerSize,_MarkerSize]; _tmpMarker setMarkerDirLocal _MarkerDir; } else { if (not ((str (getMarkerPos _tmpMarker)) == "[0,0,0]"))then { deleteMarkerLocal _tmpMarker; }; }; true; }; ALTMAP_Click = { Params ["_control", "_button", "_xPos", "_yPos", "_shift", "_ctrl", "_alt"]; private _tmpScreenToWorld = _control ctrlMapScreenToWorld [_xPos, _yPos]; private _posMarkers = []; {_posMarkers set [count _posMarkers, getMarkerPos _x];} forEach ALTMAP_Markers; private _nearestMarkerPos = [_posMarkers,_tmpScreenToWorld] call BIS_fnc_nearestPosition; if ((_nearestMarkerPos distance _tmpScreenToWorld)<25) then { player setPos _tmpScreenToWorld; }; }; ALTMAP_CloseDisplay = { Params ["_control"]; _display = ctrlParent _control; _display CloseDisplay 2; }; OpenAltMAP = { _ATLMAP_Display = findDisplay 46 createDisplay "RscDisplayEmpty"; _ALTMAP_Background = _ATLMAP_Display ctrlCreate["RscText", 8001]; _ALTMAP_Background ctrlSetPosition [safezoneXAbs + 0.01, safezoneY + 0.1, safezoneWAbs - 0.02, safezoneH - 0.2]; _ALTMAP_Background ctrlSetBackgroundColor [0.03,0.03,0.09,0.345]; _ALTMAP_Background ctrlSetTextColor [0.99,0.99,0.99,1]; _ALTMAP_Background ctrlCommit 0; uiNamespace setVariable ["_ALTMAP_Background",_ALTMAP_Background]; _ALTMAP_CloseButton = _ATLMAP_Display ctrlCreate["RscButton", 8002]; _ALTMAP_CloseButton ctrlSetPosition [safezoneWAbs - abs(safezoneXAbs) - 0.01 - 0.01 - 0.04, safezoneY + 0.12, 0.04, 0.04]; // X1: left border 0.01 + right border 0.01 + button width 0.04 + abs(safezoneWAbs), because safezoneWAbs can be negative value!1 _ALTMAP_CloseButton ctrlSetBackgroundColor [0.9,0.1,0.1,0]; _ALTMAP_CloseButton ctrlSetTextColor [0.99,0.99,0.99,1]; _ALTMAP_CloseButton ctrlSetText " < "; _ALTMAP_CloseButton ctrlAddEventHandler ["MouseButtonClick", "_this call ALTMAP_CloseDisplay"]; _ALTMAP_CloseButton ctrlCommit 0; uiNamespace setVariable ["_ALTMAP_CloseButton",_ALTMAP_CloseButton]; _ALTMAP_MAP = _ATLMAP_Display ctrlCreate ["RscMapControl", 8003]; _ALTMAP_MAP ctrlSetPosition [safezoneXAbs + 0.02, safezoneY + 0.18, safezoneWAbs - 0.04, safezoneH - 0.42]; // Y1:0.1 + 0.04 (button height) + 0.2 (button top) + 0.2 (space); W:0.02 + 0.02 left/right border; H:0.18 from start + 0.2 Display bottom + 0.02 top space + 0.02 space bottom space _ALTMAP_MAP ctrlSetBackgroundColor [0.1,0.1,0.1,1]; _ALTMAP_MAP ctrlSetTextColor [0.99,0.99,0.99,1]; _ALTMAP_MAP ctrlCommit 0; uiNamespace setVariable ["_ALTMAP_MAP",_ALTMAP_MAP]; _ALTMAP_MAP ctrlMapAnimAdd [0.75, 0.045, player]; ctrlMapAnimCommit _ALTMAP_MAP; waitUntil {mapAnimDone}; _ALTMAP_MAP ctrlAddEventHandler ["MouseMoving", "_this call ALTMAP_ShowMarkerIfNear"]; _ALTMAP_MAP ctrlAddEventHandler ["MouseHolding", "_this call ALTMAP_ShowMarkerIfNear"]; _ALTMAP_MAP ctrlAddEventHandler ["MouseButtonClick", "_this call ALTMAP_Click"]; }; player AddAction ["Open Map with animate markers", "_this call OpenAltMAP"]; Example mission: https://yadi.sk/d/kM5vcZIuUzi8Cg Share this post Link to post Share on other sites
linkinpunk 12 Posted September 5, 2020 But, i have next question: how to change map layer with use RscMapControl ? https://yadi.sk/i/INEt7iza49VnkA https://yadi.sk/i/VwPD1o3xNpeSog https://yadi.sk/i/4IhGWABO1uNXsw Share this post Link to post Share on other sites