Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 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. private ["_markerDot","_markerZone","_markerCircle"];
  21.  
  22. params
  23. [
  24. ["_pos","ERROR",[[]],[2,3]],
  25. ["_text","ERROR",[""]],
  26. ["_difficulty","moderate",[""]]
  27. ];
  28.  
  29. if ((_pos isEqualTo "ERROR") || ("_text" isEqualTo "ERROR")) exitWith
  30. {
  31. diag_log format ["DMS ERROR :: Calling DMS_CreateMarker with invalid parameters: %1",_this];
  32.  
  33. [];
  34. };
  35.  
  36.  
  37. private _randomMarker =
  38. if ((count _this)>3) then
  39. {
  40. _this select 3;
  41. }
  42. else
  43. {
  44. DMS_MarkerPosRandomization;
  45. };
  46.  
  47. private _num = DMS_MissionCount;
  48.  
  49.  
  50. private _markerType = "mil_dot";
  51.  
  52. private _color =
  53. switch (toLower _difficulty) do
  54. {
  55. case "easy":
  56. {
  57. _markerType = "ExileMissionEasyIcon";
  58. "ColorGreen"
  59. };
  60. case "moderate":
  61. {
  62. _markerType = "ExileMissionModerateIcon";
  63. "ColorYellow"
  64. };
  65. case "difficult":
  66. {
  67. _markerType = "ExileMissionDifficultIcon";
  68. "ColorRed"
  69. };
  70. case "hardcore":
  71. {
  72. _markerType = "ExileMissionHardcoreIcon";
  73. "ColorBlack"
  74. };
  75. case "radiation":
  76. {
  77. // RADIATION TEST
  78. _markerZone = createMarker ["markerZone",_pos];
  79. _markerZone setMarkerShape "ELLIPSE";
  80. _markerZone setMarkerType "ExileContaminatedZone";
  81. _markerZone setMarkerSize [175,175];
  82. _markerZone setMarkerColor "colorBlack";
  83. _markerZone setMarkerAlpha 0.8;
  84.  
  85. _markerIcon2 = createMarker ["markerIcon2",_pos];
  86. _markerIcon2 setMarkerShape "icon";
  87. _markerIcon2 setMarkerType "ExileMissionHardcoreIcon";
  88.  
  89.  
  90. // missionNamespace setVariable [format ["%1_pos",_markerZone], _pos];
  91.  
  92. //
  93. _markerType = "ExileContaminatedZone";
  94. "ColorBlack"
  95. };
  96.  
  97. default
  98. {
  99. _difficulty
  100. };
  101. };
  102.  
  103. /*
  104. // Don't think this is really needed, ArmA gives you an error anyways.
  105. if !((toLower _color) in DMS_A3_AllMarkerColors) then
  106. {
  107. diag_log format ["DMS ERROR :: Color ""%1"" is not a valid marker color! Switching to ""ColorRed""",_color];
  108. _color = "ColorRed";
  109. };
  110. */
  111.  
  112. private _circle = createMarker [format ["DMS_MissionMarkerCircle%1_%2",_num,round(time)], _pos];
  113.  
  114. if (DMS_ShowMarkerCircle) then
  115. {
  116. _circle setMarkerColor _color;
  117. _circle setMarkerShape "ELLIPSE";
  118. _circle setMarkerBrush "Solid";
  119. _circle setMarkerSize [150,150];
  120. };
  121.  
  122. private _dot = createMarker [format ["DMS_MissionMarkerDot%1_%2",_num,round(time)], _pos];
  123. _dot setMarkerType _markerType;
  124. _dot setMarkerText _text;
  125.  
  126.  
  127. missionNamespace setVariable [format ["%1_pos",_dot], _pos];
  128. missionNamespace setVariable [format ["%1_text",_dot], _text];
  129.  
  130. if (DMS_MarkerText_ShowMissionPrefix) then
  131. {
  132. _dot setMarkerText (format ["%1 %2",DMS_MarkerText_MissionPrefix,_text]);
  133. };
  134.  
  135. if (_randomMarker) then
  136. {
  137. private _dis = DMS_MarkerPosRandomRadius call DMS_fnc_SelectRandomVal;
  138. private _npos = _pos getPos [_dis,random 360];
  139.  
  140. _circle setMarkerPos _npos;
  141. _dot setMarkerPos _npos;
  142. _circle setMarkerBrush DMS_RandomMarkerBrush;
  143.  
  144. if (DMS_DEBUG) then
  145. {
  146. (format ["CreateMarker :: Moving markers %1 from %2 to %3 (%4m away)",[_dot,_circle],_pos,_npos,_dis]) call DMS_fnc_DebugLog;
  147. };
  148. };
  149.  
  150. if (DMS_DEBUG) then
  151. {
  152. (format ["CreateMarker :: Created markers |%1| at %2 with text |%3| colored %4",[_dot,_circle],_pos,_text,_color]) call DMS_fnc_DebugLog;
  153. };
  154.  
  155.  
  156. [_dot];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement