SHARE
TWEET

DMS (fn_CreateMarker.sqf)

SDOT Jul 12th, 2016 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. private _color =
  49.     switch (_difficulty) do
  50.     {
  51.         case "easy":        {"ColorBlack";};
  52.         case "moderate":    {"ColorBlack";};
  53.         case "difficult":   {"ColorBlack";};
  54.         case "hardcore" :   {"ColorBlack";};
  55.         default             {_difficulty;};
  56.     };
  57.  
  58. private _marker =
  59.     switch (_difficulty) do
  60.     {
  61.         case "easy":        {"ExileMissionEasyIcon";};
  62.         case "moderate":    {"ExileMissionModerateIcon";};
  63.         case "difficult":   {"ExileMissionDifficultIcon";};
  64.         case "hardcore" :   {"ExileMissionHardcoreIcon";};
  65.         default             {_difficulty;};
  66.     };
  67.  
  68. /*
  69. // Don't think this is really needed
  70. if !((toLower _color) in DMS_A3_AllMarkerColors) then
  71. {
  72.     diag_log format ["DMS ERROR :: Color ""%1"" is not a valid marker color! Switching to ""ColorRed""",_color];
  73.     _color = "ColorRed";
  74. };
  75. */
  76.  
  77. private _circle = createMarker [format ["DMS_MissionMarkerCircle%1_%2",_num,round(time)], _pos];
  78. _circle setMarkerColor _color;
  79. _circle setMarkerShape "ELLIPSE";
  80. _circle setMarkerBrush "SolidBorder";
  81. _circle setMarkerSize [150,150];
  82.  
  83. private _dot = createMarker [format ["DMS_MissionMarkerDot%1_%2",_num,round(time)], _pos];
  84. _dot setMarkerType _marker;
  85. _dot setMarkerText _text;
  86.  
  87. missionNamespace setVariable [format ["%1_pos",_dot], _pos];
  88. missionNamespace setVariable [format ["%1_text",_dot], _text];
  89.  
  90. if (DMS_MarkerText_ShowMissionPrefix) then
  91. {
  92.     _dot setMarkerText (format ["%1 %2",DMS_MarkerText_MissionPrefix,_text]);
  93. };
  94.  
  95. if (_randomMarker) then
  96. {
  97.     private _dir = random 360;
  98.     private _dis = DMS_MarkerPosRandomRadius call DMS_fnc_SelectRandomVal;
  99.     private _npos = _pos getPos [_dis,_dir];
  100.  
  101.     _circle setMarkerPos _npos;
  102.     _dot setMarkerPos _npos;
  103.     _circle setMarkerBrush DMS_RandomMarkerBrush;
  104.  
  105.     if (DMS_DEBUG) then
  106.     {
  107.         (format ["CreateMarker :: Moving markers %1 from %2 to %3 (%4m away)",[_dot,_circle],_pos,_npos,_dis]) call DMS_fnc_DebugLog;
  108.     };
  109. };
  110.  
  111. if (DMS_DEBUG) then
  112. {
  113.     (format ["CreateMarker :: Created markers |%1| at %2 with text |%3| colored %4",[_dot,_circle],_pos,_text,_color]) call DMS_fnc_DebugLog;
  114. };
  115.  
  116.  
  117. [_dot,_circle];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top