Create function CreateMarker

This commit is contained in:
eraser1 2015-08-30 20:48:20 -05:00
parent cb7338c16a
commit b3a06808f9
3 changed files with 67 additions and 16 deletions

View File

@ -4,7 +4,6 @@
*/
/* compiles
DMS_CreateMarker = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_CreateMarker.sqf";
spawn_static = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\spawn_static.sqf";
heli_para = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\heli_para.sqf";
heli_patrol = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\heli_patrol.sqf";
@ -31,6 +30,7 @@ DMS_SpawnAISoldier = compileFinal preprocessFileLineNumbers "\x\addons\dms\s
DMS_OnKilled = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\OnKilled.sqf";
DMS_SetGroupBehavior = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SetGroupBehavior.sqf";
DMS_AddMissionToMonitor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\AddMissionToMonitor.sqf";
DMS_CreateMarker = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\CreateMarker.sqf";
//Load config
#include "config.sqf";

View File

@ -0,0 +1,66 @@
/*
DMS_CreateMarker
Created by Defent and eraser1
Usage:
[
_pos, // Array: Position of the markers
_text, // String: The text on the map marker that will appear on the map
_difficulty, // !!!OPTIONAL!!! String: "hardcore","difficult","moderate", "easy", OR custom color
] call DMS_CreateMarker;
Returns markers in format:
[
_markerDot,
_markerCircle
]
*/
private["_pos", "_text", "_difficulty", "_num", "_color", "_dot", "_circle"];
params
[
["_pos","ERROR",[[]],[2,3]],
["_text","ERROR",[""]],
["_difficulty","moderate",[""]]
];
if ((_pos isEqualTo "ERROR") || ("_text" isEqualTo "ERROR")) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_CreateMarker with invalid parameters: %1",_this];
[];
};
_num = DMS_MissionCount;
call
{
if(_difficulty == "easy") exitWith {_color = "ColorGreen"};
if(_difficulty == "moderate") exitWith {_color = "ColorYellow"};
if(_difficulty == "difficult") exitWith {_color = "ColorRed"};
if(_difficulty == "hardcore") exitWith {_color = "ColorBlack"};
_color = _difficulty;
};
_circle = createMarker [format ["DMS_MissionMarkerCircle%1",_num], _pos];
_circle setMarkerColor _color;
_circle setMarkerShape "ELLIPSE";
_circle setMarkerBrush "Grid";
_circle setMarkerSize [150,150];
_dot = createMarker [format ["DMS_MissionMarkerDot%1",_num], _pos];
_dot setMarkerColor "ColorBlack";
_dot setMarkerType "mil_dot";
_dot setMarkerText _text;
if (DMS_DEBUG) then
{
diag_log format ["Created markers |%1| at %2 with text |%3| colored %4",[_dot,_circle],_pos,_text,_color];
};
[_dot,_circle];

View File

@ -1,15 +0,0 @@
private["_mark","_name"];
DMS_Cords = _this select 0;
DMS_MainName = _this select 1;
_mark = createMarker ["DMS_MainMarker", DMS_Cords];
"DMS_MainMarker" setMarkerColor "ColorRed";
"DMS_MainMarker" setMarkerShape "ELLIPSE";
"DMS_MainMarker" setMarkerBrush "Grid";
"DMS_MainMarker" setMarkerSize [150,150];
_name = createMarker ["DMS_MainDot", DMS_Cords];
"DMS_MainDot" setMarkerColor "ColorBlack";
"DMS_MainDot" setMarkerType "mil_dot";
"DMS_MainDot" setMarkerText DMS_MainName;