Advertisement
Irkutsk86

Untitled

Dec 12th, 2018
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.15 KB | None | 0 0
  1. /*
  2.     DMS_fnc_CreateMarker
  3.     Created by Defent and eraser1
  4.  
  5.     Usage:
  6.     [
  7.         _pos,                   // Array: Position of the markers
  8.         _text,                  // String: The text on the map marker that will appear on the map
  9.         _difficulty,            // (OPTIONAL) String: "hardcore","difficult","moderate", "easy", OR custom color
  10.         _randomMarker           // (OPTIONAL) Boolean: Whether or not to place the map marker on a random offset from mission, defined by DMS_MarkerPosRandomRadius
  11.     ] call DMS_fnc_CreateMarker;
  12.  
  13.     Returns markers in format:
  14.     [
  15.         _markerDot,
  16.         _markerCircle
  17.     ]
  18.  
  19. */
  20.  
  21. params
  22. [
  23.     ["_pos","ERROR",[[]],[2,3]],
  24.     ["_text","ERROR",[""]],
  25.     ["_difficulty","moderate",[""]]
  26. ];
  27.  
  28. if ((_pos isEqualTo "ERROR") || ("_text" isEqualTo "ERROR")) exitWith
  29. {
  30.     diag_log format ["DMS ERROR :: Calling DMS_CreateMarker with invalid parameters: %1",_this];
  31.  
  32.     [];
  33. };
  34.  
  35.  
  36. private _randomMarker =
  37.     if ((count _this)>3) then
  38.     {
  39.         _this select 3;
  40.     }
  41.     else
  42.     {
  43.         DMS_MarkerPosRandomization;
  44.     };
  45.  
  46. private _num = DMS_MissionCount;
  47.  
  48.  
  49. private _markerType = "mil_dot";
  50.  
  51. private _color =
  52.     switch (toLower _difficulty) do
  53.     {
  54.         case "easy":
  55.         {
  56.             _markerType = "ExileMissionEasyIcon";
  57.             "ColorGreen"
  58.         };
  59.         case "moderate":
  60.         {
  61.             _markerType = "ExileMissionModerateIcon";
  62.             "ColorYellow"
  63.         };
  64.         case "difficult":
  65.         {
  66.             _markerType = "ExileMissionDifficultIcon";
  67.             "ColorRed"
  68.         };
  69.         case "hardcore":
  70.         {
  71.             _markerType = "ExileMissionHardcoreIcon";
  72.             "ColorBlack"
  73.         };
  74.  
  75.         default
  76.         {
  77.             _difficulty
  78.         };
  79.     };
  80.  
  81. /*
  82. // Don't think this is really needed, ArmA gives you an error anyways.
  83. if !((toLower _color) in DMS_A3_AllMarkerColors) then
  84. {
  85.     diag_log format ["DMS ERROR :: Color ""%1"" is not a valid marker color! Switching to ""ColorRed""",_color];
  86.     _color = "ColorRed";
  87. };
  88. */
  89.  
  90. private _circle = createMarker [format ["DMS_MissionMarkerCircle%1_%2",_num,round(time)], _pos];
  91.  
  92. if (DMS_ShowMarkerCircle) then
  93. {
  94.     _circle setMarkerColor _color;
  95.     _circle setMarkerShape "ELLIPSE";
  96.     _circle setMarkerBrush "Solid";
  97.     _circle setMarkerSize [150,150];
  98. };
  99.  
  100. private _dot = createMarker [format ["DMS_MissionMarkerDot%1_%2",_num,round(time)], _pos];
  101. _dot setMarkerType _markerType;
  102. _dot setMarkerColor "ColorPink"; //or any color from https://community.bistudio.com/wiki/CfgMarkerColors_Arma_3
  103. _dot setMarkerText _text;
  104.  
  105. missionNamespace setVariable [format ["%1_pos",_dot], _pos];
  106. missionNamespace setVariable [format ["%1_text",_dot], _text];
  107.  
  108. if (DMS_MarkerText_ShowMissionPrefix) then
  109. {
  110.     _dot setMarkerText (format ["%1 %2",DMS_MarkerText_MissionPrefix,_text]);
  111. };
  112.  
  113. if (_randomMarker) then
  114. {
  115.     private _dis = DMS_MarkerPosRandomRadius call DMS_fnc_SelectRandomVal;
  116.     private _npos = _pos getPos [_dis,random 360];
  117.  
  118.     _circle setMarkerPos _npos;
  119.     _dot setMarkerPos _npos;
  120.     _circle setMarkerBrush DMS_RandomMarkerBrush;
  121.  
  122.     if (DMS_DEBUG) then
  123.     {
  124.         (format ["CreateMarker :: Moving markers %1 from %2 to %3 (%4m away)",[_dot,_circle],_pos,_npos,_dis]) call DMS_fnc_DebugLog;
  125.     };
  126. };
  127.  
  128. if (DMS_DEBUG) then
  129. {
  130.     (format ["CreateMarker :: Created markers |%1| at %2 with text |%3| colored %4",[_dot,_circle],_pos,_text,_color]) call DMS_fnc_DebugLog;
  131. };
  132.  
  133.  
  134. [_dot,_circle];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement