Jump to content
zagor64bz

[SOLVED] Scripted Strategic map zoom help needed.

Recommended Posts

Hi, I have a script that open the strategic map with an addAction. Works great, it open and everything, BUT on Altis is zoomed in too much., not allowing the player to see all the mission available in the island.

 I follow THE INSTRUCTIONS IN THIS POST and modify the  "fn_strategicMapOpen.sqf" extracted from the game files. 

How do I call this script "fn_IMPROVEDstrategicMapOpen.sqf" in this

Spoiler

disableserialization;

_parentDisplay 	= [] call bis_fnc_displayMission;
_mapCenter 	= getmarkerpos "mrk_mapCentre";
_ORBAT 		= [];
_markers 	= [];
_images 	= [];
_overcast 	= overcast;
_isNight 	= !((dayTime > 6) && (dayTime < 20));
_scale		= 1.5;
_simul		= false;


[
findDisplay 46,
_mapCenter,
_missionsData,
_ORBAT,
_markers,
_images,
_overcast,
_isNight,
_scale,
_simul
] call Bis_fnc_strategicMapOpen;

 

???????

 

Thank you.

 

EDIT: Or there's any other way to zoom out the strategic map on opening?

 

EDIT 2: For anyone coming here for help, this is how I got it working.

in "init.sqf":

call compile preprocessFile "Scripts\MyFunctions.sqf";

MyFunctions.sqf

 

Spoiler

zag_fnc_mapZoom = { /*
	Author: Karel Moricky

	Description:
	Open strategic map.

	Parameter(s):
		0: DISPLAY - parent display. When empty, mission display is used.
		1: ARRAY - default view position in format [x,y,y] or [x,y]
		2: ARRAY - list of missions in format:
			0: ARRAY - mission position in format [x,y,y] or [x,y]
			1: CODE - expression executed when user clicks on mission icon
			2: STRING - mission name
			3: STRING - short description
			4: STRING - name of mission's player
			5: STRING - path to overview image
			6: NUMBER - size multiplier, 1 means default size
			7: ARRAY - parameters for the -on click- code; referenced from the script as (_this select 9)
		3: ARRAY - list of ORBAT groups in format:
			0: ARRAY - group position in format [x,y,y] or [x,y]
			1: CONFIG - preview CfgORBAT group
			2: CONFIG - topmost displayed CfgORBAT group
			3: ARRAY - list of allowed tags
			4: NUMBER - maximum number of displayed tiers
		4: ARRAY - list of markers revealed in strategic map (will be hidden when map is closed)
		5: ARRAY - list of custom images in format:
			0: STRING - texture path
			1: ARRAY - color in format [R,G,B,A]
			2: ARRAY - image position
			3: NUMBER - image width (in metres)
			4: NUMBER - image height (in metres)
			5: NUMBER - image angle (in degrees)
			6: STRING - text displayed next to the image
			7: BOOL - true to display shadow
		6: NUMBER - value in range <0-1> defining weather on strategic map (i.e. density of clouds)
		7: BOOL - true for night version of strategic map (darker with blue tone)
		8: NUMBER - default map scale coeficient (1 is automatic scale)
		9: BOOL - true to enable simulation while the map is opened (default: false)
	       10: STRING - bottom bar action label text (default: "Select a mission")
	       11: BOOL - true to show icon label as a mission name (default: true)
	       12: STRING - path to mission icon texture (default: "\A3\Ui_f\data\Map\GroupIcons\badge_rotate_%1_gs.paa")
	       		%1 - animation frame from 0-6 (optional)
	       		%2 - index from 1-9 (optional)

	Returns:
	DISPLAY - RscDisplayStrategicMap
*/
private ["_parentDisplayDefault","_parentDisplay","_mapCenter","_missions","_ORBAT","_markers","_images","_overcast","_scale","_defaultScale","_simulationEnabled","_displayClass","_display","_playerIcon","_playerColor","_cloudTextures","_cloudsGrid","_cloudsMax","_cloudsSize","_map","_fade","_actionText","_missionIcon","_showIconText"];
disableserialization;

_parentDisplayDefault = switch false do {
	case isnull (finddisplay 37): {finddisplay 37}; //--- GetReady
	case isnull (finddisplay 52): {finddisplay 52}; //--- ServerGetReady
	case isnull (finddisplay 53): {finddisplay 53}; //--- ClientGetReady
	default {[] call bis_fnc_displayMission}; //--- Mission
};
_parentDisplay = _this param [0,_parentDisplayDefault,[displaynull]];
_mapCenter = _this param [1,position player];
_mapCenter = _mapCenter call bis_fnc_position;
_missions = _this param [2,[],[[]]];
_ORBAT = _this param [3,[],[[]]];
_markers = _this param [4,[],[[]]];
_images = _this param [5,[],[[]]];
_overcast = (_this param [6,overcast,[0]]) max 0 min 1;
_isNight = _this param [7,false,[false]];
_defaultScale = _this param [8,1,[0]];
_simulationEnabled = _this param [9,false,[false]];
_actionText = _this param [10,localize "str_a3_rscdisplaystrategicmap_missions",[""]];
_showIconText = _this param [11,true,[true]];
_missionIcon = _this param [12,"\A3\Ui_f\data\Map\GroupIcons\badge_rotate_%1_gs.paa",[""]];

BIS_fnc_strategicMapOpen_showIconText = _showIconText;
BIS_fnc_strategicMapOpen_missionIcon = _missionIcon;

//--- Calculate terrain size and outside color
_mapSize = worldSize;
BIS_fnc_strategicMapOpen_mapSize = _mapSize;
BIS_fnc_strategicMapOpen_isNight = _isNight;

_scale = 3500 / _mapSize / safezoneH;
_scale = _scale * (_defaultScale max 0 min 1);
_maxSatelliteAlpha = if (_isNight) then {0.75} else {1};

_colorOutside = configfile >> "CfgWorlds" >> worldname >> "OutsideTerrain" >> "colorOutside";
_colorOutside = if (isarray _colorOutside) then {
	_colorOutside call bis_fnc_colorCOnfigToRGBA;
} else {
	["colorOutside param is mission in ""CfgWorlds"" >> ""%1"" >> ""OutsideTerrain""",worldname] call bis_fnc_error;
	[0,0,0,1]
};

with uinamespace do {
	RscDisplayStrategicMap_scaleMin = 0;
	RscDisplayStrategicMap_scaleMax = 1;
	RscDisplayStrategicMap_scaleDefault = _scale;
	RscDisplayStrategicMap_maxSatelliteAlpha = _maxSatelliteAlpha;

	RscDisplayStrategicMap_colorOutside_R = _colorOutside select 0;
	RscDisplayStrategicMap_colorOutside_G = _colorOutside select 1;
	RscDisplayStrategicMap_colorOutside_B = _colorOutside select 2;
};

//--- Create the viewer
_displayClass = if (_simulationEnabled) then {"RscDisplayStrategicMapSimulation"} else {"RscDisplayStrategicMap"};
_parentDisplay createdisplay _displayClass;
_display = finddisplay 506;
if (isnull _display) exitwith {"Unable to create 'RscDisplayStrategicMap' display." call (uinamespace getvariable "bis_fnc_error"); displaynull};

//--- Life, calculations and everything
startloadingscreen ["","RscDisplayLoadingBlack"];

BIS_fnc_strategicMapOpen_player = player;
//selectnoplayer;

//--- Process ORBAT
BIS_fnc_strategicMapOpen_ORBAT = [];
_onClick = [];
{
	private ["_pos","_class","_parent","_tags","_tiers","_classParams","_text","_texture","_size","_color","_sizeLocal","_sizeParams","_sizeTexture"];
	_pos = _x param [0,player];
	_pos = _pos call bis_fnc_position;

	_class = _x param [1,configfile >> "CfgORBAT",[configfile]];
	_parent = _x param [2,_class,[configfile]];
	_tags = _x param [3,[],[[]]];
	_tiers = _x param [4,-1,[0]];

	_classParams = _class call bis_fnc_ORBATGetGroupParams;
	_text = _classParams select ("text" call bis_fnc_ORBATGetGroupParams);
	_texture = _classParams select ("texture" call bis_fnc_ORBATGetGroupParams);
	_size = _classParams select ("size" call bis_fnc_ORBATGetGroupParams);
	_color = _classParams select ("color" call bis_fnc_ORBATGetGroupParams);

	_iconSize = sqrt (_size + 1) * 32;

	//--- Group size
	//_sizeLocal = _size max 0 min (count (BIS_fnc_ORBATGetGroupParams_sizes) - 1);
	//_sizeParams = BIS_fnc_ORBATGetGroupParams_sizes select _sizeLocal;
	//_sizeTexture = _sizeParams select 0;

	BIS_fnc_strategicMapOpen_ORBAT set [
		count BIS_fnc_strategicMapOpen_ORBAT,
		[
			_class,
			[_parent,_tags,_tiers],
			[
				_texture,
				_color,
				_pos,
				_iconSize,
				_iconSize,
				0,
				"",
				false
			],
			_classParams
		]
	];

	//--- Create shortcut from ORBAT viewer
	_onClick set [count _onClick,_class];
	_onClick set [count _onClick,{[_this select 0,1] spawn bis_fnc_strategicMapAnimate; true}];
} foreach _ORBAT;
BIS_fnc_strategicMapOpen_ORBATonClick = _onClick;

//--- Process Missions
BIS_fnc_strategicMapOpen_missions = [];
if (count _missions > 0) then {
	_playerIcon = gettext (configfile >> "CfgInGameUI" >> "IslandMap" >> "iconPlayer");
	_playerColor = (getarray (configfile >> "cfgingameui" >> "islandmap" >> "colorMe")) call BIS_fnc_colorRGBAtoHTML;

	_ctrlBackground = _display displayctrl 1000;
	_ctrlBackground ctrlshow false;

	_ctrlMissions = _display displayctrl 1500;
	_lbadd = _ctrlMissions lbadd _actionText;
	_ctrlMissions lbsetvalue [_lbadd,-1];
	_ctrlMissions lbsetcolor [_lbadd,[1,1,1,0.5]];
	{
		private ["_pos","_code","_title","_description","_player","_picture","_iconSize","_infoText","_codeParams"];
		_pos = _x param [0,player];
		_pos = _pos call bis_fnc_position;

		_code = _x param [1,{},[{}]];
		_title = _x param [2,"ERROR: MISSING TITLE",[""]];
		_description = _x param [3,"",[""]];
		_player = _x param [4,"",[""]];
		_picture = _x param [5,"",[""]];
		_iconSize = _x param [6,1,[1]];
		_codeParams = _x param [7,[],[[]]];

		_infoText = _title;
		if (_player != "") then {_infoText = _infoText + format ["<br /><t size='0.2' color='#00000000'>-<br /></t><img size='1' image='%2' color='%3'/><t size='0.8'> %1</t>",_player,_playerIcon,_playerColor];};
		if (_description != "") then {_infoText = _infoText + format ["<br /><t size='0.5' color='#00000000'>-<br /></t><t size='0.8'>%1</t>",_description];};
		//if (_picture != "") then {_infoText = _infoText + format ["<br /><img size='5.55' image='%1' />",_picture];};

		BIS_fnc_strategicMapOpen_missions set [
			count BIS_fnc_strategicMapOpen_missions,
			[
				_pos,
				_code,
				_title,
				_iconSize,
				_picture,
				0,
				0,
				0,
				_infoText,
				_codeParams
			]
		];

		_lbadd = _ctrlMissions lbadd format ["%1 (%2/%3)",_title,_foreachindex + 1,count _missions];
		_ctrlMissions lbsetvalue [_lbAdd,_foreachindex];

	} foreach _missions;

	_ctrlMissions lbsetcursel 0;
	_ctrlMissions ctrladdeventhandler [
		"lbselchanged",
		"
			_ctrlMissions = _this select 0;
			_cursel = _this select 1;
			if ((_ctrlMissions lbvalue 0) < 0) exitwith {_ctrlMissions lbdelete 0; _ctrlMissions lbsetcursel 0;};
			_mission = BIS_fnc_strategicMapOpen_missions select (_ctrlMissions lbvalue _cursel);
			[_mission select 0,1] spawn bis_fnc_strategicmapanimate;
		"
	];
};

//--- Process Images
BIS_fnc_strategicMapOpen_images = [];
{
	private ["_texture","_color","_pos","_w","_h","_dir","_text","_shadow"];
	_texture = _x param [0,"#(argb,8,8,3)color(0,0,0,0)",[""]];
	_color = _x param [1,[1,1,1,1],[[]]];
	_pos = _x param [2,position player];
	_w = _x param [3,0,[0]];
	_h = _x param [4,0,[0]];
	_dir = _x param [5,0,[0]];
	_text = _x param [6,"",[""]];
	_shadow = _x param [7,false,[false]];

	_pos = _pos call bis_fnc_position;
	_color = _color call bis_fnc_colorConfigToRGBA;
	_coef = (0.182 * safezoneH); //--- Magic constant to make kilometer a kilometer
	_w = _w * _coef;
	_h = _h * _coef;

	BIS_fnc_strategicMapOpen_images set [
		count BIS_fnc_strategicMapOpen_images,
		[_texture,_color,_pos,_w,_h,_dir,_text,_shadow]
	];
} foreach _images;

//--- Random clouds
_cloudTextures = [
	"\A3\data_f\mrak_01_ca.paa",
	"\A3\data_f\mrak_02_ca.paa",
	"\A3\data_f\mrak_03_ca.paa",
	"\A3\data_f\mrak_04_ca.paa"
];
_cloudsGrid = 500;
_cloudsMax = (_mapSize / _cloudsGrid) * _overcast;
_cloudsSize = (_cloudsGrid / 2) + (_cloudsGrid * _overcast);
BIS_fnc_strategicMapOpen_overcast = _overcast;
BIS_fnc_strategicMapOpen_clouds = [];

for "_i" from 1 to (_cloudsMax) do {
	BIS_fnc_strategicMapOpen_clouds set [
		count BIS_fnc_strategicMapOpen_clouds,
		[
			_cloudTextures call bis_fnc_selectrandom,
			(random _mapSize),
			((_mapSize / _cloudsMax) * _i),
			random 360,
			_cloudsSize + (_cloudsSize * _overcast),
			[1,1,1,0.25]
		]
	];
};


BIS_fnc_strategicMapOpen_indexSizeTexture =	("sizeTexture" call bis_fnc_ORBATGetGroupParams);
BIS_fnc_strategicMapOpen_indexTextureSize =	("textureSize" call bis_fnc_ORBATGetGroupParams);

BIS_fnc_strategicMapOpen_draw = {
	scriptname "bis_fnc_strategicMapOpen - Draw";
	_map = _this select 0;
	_mapSize = BIS_fnc_strategicMapOpen_mapSize / 2;
	_display = ctrlparent _map;
	_time = diag_ticktime;

	//_tooltip = (ctrlparent _map) displayctrl 2350;
	//_tooltip ctrlsetfade 1;
	//_tooltip ctrlcommit 0;

	_mousePos = _map ctrlmapscreentoworld BIS_fnc_strategicMapOpen_mousePos;
	//_mouseLimit = BIS_fnc_strategicMapOpen_mapSize / 3400;
	_mouseLimit = 2.5 / safezoneh;
	_selected = [];

	//--- Cross grid
	_map drawRectangle [
		[_mapSize,_mapSize,0],
		_mapSize,
		_mapSize,
		0,
		[1,1,1,0.42],
		"\A3\Ui_f\data\GUI\Rsc\RscDisplayStrategicMap\cross_ca.paa"
	];

	//--- Images
	{
		_map drawicon _x;
	} foreach BIS_fnc_strategicMapOpen_images;

	//--- ORBAT groups
	{
		_class = _x select 0;
		_iconParams = +(_x select 2);
		_classParams = +(_x select 3);

		_pos = _iconParams select 2;
		_iconSize = _iconParams select 3;

		if (((_iconParams select 2) distance _mousePos) < (_mouseLimit * _iconSize)) then {
			_iconParams set [3,(_iconParams select 3) * 1.2];
			_iconParams set [4,(_iconParams select 4) * 1.2];
			_selected = _x;
		};

		_textureSize = _classParams select BIS_fnc_strategicMapOpen_indexTextureSize;
		_iconSizeParams = +_iconParams;
		_iconParams set [3,(_iconParams select 3) * _textureSize];
		_iconParams set [4,(_iconParams select 4) * _textureSize];

		_map drawIcon _iconParams;

		//--- Draw size texture
		_size = _classParams select 5;
		if (_size >= 0) then {
			_sizeTexture = _classParams select BIS_fnc_strategicMapOpen_indexSizeTexture;
			_iconSizeParams set [0,_sizeTexture];
			_map drawIcon _iconSizeParams;
		};

	} foreach BIS_fnc_strategicMapOpen_ORBAT;

	//--- Clouds
	_cloudSpeed = sin _time * (1138 + 2000 * BIS_fnc_strategicMapOpen_overcast);
	{
		_texture = _x select 0;
		_posX = _x select 1;
		_posY = _x select 2;
		_dir = _x select 3;
		_size = _x select 4;
		_color = _x select 5;

		_map drawIcon [
			_texture,
			_color,
			[
				_posX + _cloudSpeed,
				_posY
			],
			_size,
			_size,
			_dir + (_time * _foreachindex) / (count BIS_fnc_strategicMapOpen_clouds * 3),
			"",
			false
		];
	} foreach BIS_fnc_strategicMapOpen_clouds;

	//--- Missions
	_textureAnimPhase = abs(6 - floor (_time * 16) % 12);
	{
		_pos = _x select 0;
		_title = _x select 2;
		_size = (_x select 3) * 32;
		_dir = 0;
		_alpha = 0.75;
		_texture = format [BIS_fnc_strategicMapOpen_missionIcon,_textureAnimPhase,_foreachindex + 1];

		//--- Icon is under cursor
		if ((_pos distance _mousePos) < (_mouseLimit * _size)) then {
			_size = _size * 1.2;
			_alpha = 1;
			_selected = _x;
		};

		//--- Outside of the screen area
		_mappos = _map ctrlmapworldtoscreen _pos;
		_mapposX = _mappos select 0;
		_mapposY = _mappos select 1;

		_borderLeft = safezoneX;
		_borderRight = safezoneX + safezoneW;
		_borderTop = safezoneY;
		_borderBottom = safezoneY + safezoneH;

		if (
			_mapposX < _borderLeft || _mapposX > _borderRight
			||
			_mapposY < _borderTop || _mapposY > _borderBottom
		) then {
			_texture = gettext (configfile >> "CfgInGameUI" >> "Cursor" >> "outArrow");
			_mapposX = _mapposX max safezoneX min (safezoneX + safezoneW);
			_mapposY = _mapposY max safezoneY min (safezoneY + safezoneH);
			_title = "";

			_offset = (_size / 1200);
			_offsetDefX = _offset;
			_offsetDefY = _offset * 4/3;
			_offsetX = 0;
			_offsetY = 0;
			_dir = -([[0.5,0.5],_mappos] call bis_fnc_dirto) - 90;

			switch (true) do {
				case (_mapposX <= _borderLeft): {
					_offsetX = +_offsetDefX;
					_mapposY = _mapposY min (_borderBottom - _offsetDefY) max (_borderTop + _offsetDefY);
				};
				case (_mapposX >= _borderRight): {
					_offsetX = -_offsetDefX;
					_mapposY = _mapposY min (_borderBottom - _offsetDefY) max (_borderTop + _offsetDefY);
				};
				case (_mapposY <= _borderTop): {
					_offsetY = +_offsetDefY;
					_mapposX = _mapposX min (_borderRight - _offsetDefX) max (_borderLeft + _offsetDefX);
				};
				case (_mapposY >= _borderBottom): {
					_offsetY = -_offsetDefY;
					_mapposX = _mapposX min (_borderRight - _offsetDefX) max (_borderLeft + _offsetDefX);
				};
			};

			_pos = _map ctrlmapscreentoworld [
				_mapposX + _offsetX,
				_mapposY + _offsetY
			];
		};

		_map drawIcon [
			_texture,
			[1,1,1,_alpha],
			_pos,
			_size,
			_size,
			_dir,
			if (BIS_fnc_strategicMapOpen_showIconText) then {" " + _title} else {""},
			2,
			0.08,
			"PuristaBold"
		];
	} foreach BIS_fnc_strategicMapOpen_missions;

	//--- Night
	if (BIS_fnc_strategicMapOpen_isNight) then {
		_map drawRectangle [
			[_mapSize,_mapSize,0],
			99999,
			99999,
			0,
			[0,0.05,0.2,0.42],
			"#(argb,8,8,3)color(1,1,1,1)"
		];
	};

	//--- Tooltip
	if (count _selected > 0 && !BIS_fnc_strategicMapOpen_mouseClickDisable) then {
		switch (count _selected) do {

			//--- ORBAT
			case 4: {
				_class = _selected select 0;
				_classParams = _selected select 3;

				[_classParams,_display,BIS_fnc_strategicMapOpen_mousePos] call bis_fnc_ORBATTooltip;
			};

			//--- Mission
			case 10;
			case 9: {
				[_selected,_display,BIS_fnc_strategicMapOpen_mousePos] call bis_fnc_ORBATTooltip;
			};
		};
	} else {
		[[],_display] call bis_fnc_ORBATTooltip;
	};
	_info ctrlcommit 0;
	BIS_fnc_strategicMapOpen_selected = _selected;
};

//--- Mouse click on icon
BIS_fnc_strategicMapOpen_mouseClickDisable = false;
BIS_fnc_strategicMapOpen_selected = [];
BIS_fnc_strategicMapOpen_mousePos = [0,0];
BIS_fnc_strategicMapOpen_mouse = {
	BIS_fnc_strategicMapOpen_mousePos = [_this select 1,_this select 2];
};

#define DIK_H               0x23
#define DIK_NUMPAD5         0x4C

BIS_fnc_strategicMapOpen_keyDown = {
	_display = _this select 0;
	_key = _this select 1;

	//--- H
	switch _key do {
		case DIK_H: {
			_fade = ceil ctrlfade (_display displayctrl 2);
			_fade = (_fade + 1) % 2;
			{
				(_display displayctrl _x) ctrlsetfade _fade;
				(_display displayctrl _x) ctrlcommit 0.3;
			} foreach [2,1000,1500,2350,2301];
		};
		case DIK_NUMPAD5: {
			[BIS_fnc_strategicMapOpen_mapCenter,1] spawn bis_fnc_strategicMapAnimate;
		};
	};
	false
};


_map = _display displayctrl 51;
_map ctrlmapanimadd [0,_scale,_mapCenter];
ctrlmapanimcommit _map;
BIS_fnc_strategicMapOpen_mapCenter = _mapCenter;

_map ctrladdeventhandler ["draw","_this call BIS_fnc_strategicMapOpen_draw;"];
_map ctrladdeventhandler ["mousemoving","_this call BIS_fnc_strategicMapOpen_mouse;"];
_map ctrladdeventhandler ["mouseholding","_this call BIS_fnc_strategicMapOpen_mouse;"];
_map ctrladdeventhandler ["mousebuttonclick","[nil,_this] spawn BIS_fnc_strategicMapMouseButtonClick;"];
_display displayaddeventhandler ["keydown","_this call BIS_fnc_strategicMapOpen_keyDown"];

if (_isNight) then {
	_map ctrlsetbackgroundcolor [0,0,0,1];
	_map ctrlcommit 0;
};

//--- Measure
[_display] spawn {
	disableserialization;
	_display = _this select 0;
	_showMiles = false;

	_map = _display displayctrl 51;
	waituntil {ctrlmapanimdone _map};

	_xStart = (_map ctrlmapworldtoscreen [0,0,0]) select 0;
	_xEnd = (_map ctrlmapworldtoscreen [1000,0,0]) select 0;
	_w1km = abs (_xstart - _xEnd);
	_w1m = _w1km * 1.60934;
	if !(_showMiles) then {_w1m = 0.01};
	_h = 0.01;

	_measure = _display displayctrl 2301;
	_measure ctrlsetposition [
		safezoneX + 0.02125,
		safezoneY + safezoneH - 3.5 * 0.04,
		1,
		_h * 5
	];
	//_measure ctrlsetfade 0.25;
	_measure ctrlcommit 0;
	_measure ctrlenable false;

	_colors = ["#(argb,8,8,3)color(0,0,0,1)","\A3\Ui_f\data\GUI\Rsc\RscDisplayStrategicMap\measure_ca.paa"];
	_kmSegment = _w1km / 5;
	for "_i" from 0 to 4 do {
		_km = _display displayctrl (1200 + _i);
		_km ctrlsettext (_colors select (_i % 2));
		_km ctrlsetposition [
			_w1m + _kmSegment * _i,
			_h,
			_kmSegment,
			_h
		];
		_km ctrlcommit 0;
	};

	_text_0 = _display displayctrl 1002;
	_text_0 ctrlsetposition [
		_w1m - _w1km,
		_h * 3,
		2 * _w1km,
		_h * 2
	];
	_text_0 ctrlcommit 0;
	_text_km = _display displayctrl 1004;
	_text_km ctrlsetposition [
		_w1m - _w1km + (safezoneH / 30),
		_h * 3,
		2 * _w1km,
		_h * 2
	];
	_text_km ctrlcommit 0;

	if (_showMiles) then {
		_m0 = _display displayctrl 1205;
		_m0 ctrlsettext "#(argb,8,8,3)color(1,1,1,1)";
		_m0 ctrlsetposition [
			0,
			_h,
			_w1m,
			_h
		];
		_m0 ctrlcommit 0;
		_text_m = _display displayctrl 1003;
		_text_m ctrlsetposition [
			0,
			_h * 3,
			2 * _w1m,
			_h * 2
		];
		_text_m ctrlcommit 0;
	};
};

//--- Show markers
{
	_x setmarkeralpha 1;
} foreach _markers;
BIS_fnc_strategicMapOpen_markers = _markers;

//--- Fade in
_fade = _display displayctrl 1099;
_fade ctrlsetfade 1;
_fade ctrlcommit 2;

//--- Create upward looking camera (increases FPS, as no scene is drawn)
BIS_fnc_strategicMapOpen_camera = if (count allmissionobjects "Camera" == 0) then {
	_camera = "camera" camcreate position player;
	_camera cameraeffect ["internal","back"];
	_camera campreparepos [position player select 0,position player select 1,(position player select 2) + 10];
	_camera campreparetarget [position player select 0,(position player select 1) + 1,(position player select 2) + 1000];
	_camera campreparefov 0.1;
	_camera camcommitprepared 0;
	_camera
} else {
	objnull
};

//--- Garbage collector
_display displayaddeventhandler [
	"unload",
	"
		{
			_x setmarkeralpha 0;
		} foreach BIS_fnc_strategicMapOpen_markers;

		BIS_fnc_strategicMapOpen_camera cameraeffect ['terminate','back'];
		camdestroy BIS_fnc_strategicMapOpen_camera;

		BIS_fnc_strategicMapOpen_camera = nil;
		BIS_fnc_strategicMapOpen_player = nil;
		BIS_fnc_strategicMapOpen_mapSize = nil;
		BIS_fnc_strategicMapOpen_mapCenter = nil;
		BIS_fnc_strategicMapOpen_isNight = nil;
		BIS_fnc_strategicMapOpen_ORBAT = nil;
		BIS_fnc_strategicMapOpen_ORBATOverlay = nil;
		BIS_fnc_strategicMapOpen_missions = nil;
		BIS_fnc_strategicMapOpen_markers = nil;
		BIS_fnc_strategicMapOpen_images = nil;
		BIS_fnc_strategicMapOpen_draw = nil;
		BIS_fnc_strategicMapOpen_clouds = nil;
		BIS_fnc_strategicMapOpen_mousePos = nil;
		BIS_fnc_strategicMapOpen_mouseClickDisable = nil;
		BIS_fnc_strategicMapOpen_selected = nil;
		BIS_fnc_strategicMapOpen_indexSizeTexture = nil;
		BIS_fnc_strategicMapOpen_indexTextureSize = nil;
		with uinamespace do {
			RscDisplayStrategicMap_scaleMin = nil;
			RscDisplayStrategicMap_scaleMax = nil;
			RscDisplayStrategicMap_scaleDefault = nil;

			RscDisplayStrategicMap_colorOutside_R = nil;
			RscDisplayStrategicMap_colorOutside_G = nil;
			RscDisplayStrategicMap_colorOutside_B = nil;
		};
	"
];

cuttext ["","black in"];
endloadingscreen;

_display
};

 

 

 

On a object, I call the opening of the strategic map with an addaction:

 

this addAction ["<t size='1.5' shadow='2' color='#ff9900'>SCUBA INSERTION</t>", "scripts\osm.sqf", [], 6, true, true, "", "_target distance player < 5"];

osm.sqf:

 

Spoiler

startScuba1 =
{
[0, 0] spawn BIS_fnc_cinemaBorder;
sleep 1;																																				// launch music
TitleText ["","BLACK FADED"];
[s01, [missionNamespace, "inventory_var1"]] call BIS_fnc_saveInventory;
[s02, [missionNamespace, "inventory_var2"]] call BIS_fnc_saveInventory;
[s03, [missionNamespace, "inventory_var3"]] call BIS_fnc_saveInventory;
[s04, [missionNamespace, "inventory_var4"]] call BIS_fnc_saveInventory;
[s05, [missionNamespace, "inventory_var5"]] call BIS_fnc_saveInventory;
[s06, [missionNamespace, "inventory_var6"]] call BIS_fnc_saveInventory;
[s07, [missionNamespace, "inventory_var7"]] call BIS_fnc_saveInventory;
[s08, [missionNamespace, "inventory_var8"]] call BIS_fnc_saveInventory;
[s09, [missionNamespace, "inventory_var9"]] call BIS_fnc_saveInventory;
[s10, [missionNamespace, "inventory_var10"]] call BIS_fnc_saveInventory;
[s11, [missionNamespace, "inventory_var11"]] call BIS_fnc_saveInventory;
[s12, [missionNamespace, "inventory_var12"]] call BIS_fnc_saveInventory;
[s13, [missionNamespace, "inventory_var13"]] call BIS_fnc_saveInventory;
var_start = true;
var_startScuba1 = true;
playMusic "zip";
{removeAllWeapons _x} forEach Units player; 
{removeAllItems _x} forEach Units player;
{removeAllAssignedItems _x} forEach Units player;
{removeUniform _x} forEach Units player;
{removeVest _x} forEach Units player;
{removeBackpack _x} forEach Units player;
{removeHeadgear _x} forEach Units player;
{removeGoggles _x} forEach Units player;

{_x forceAddUniform "U_B_Wetsuit"} forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "FirstAidKit"; } } forEach Units player;
{ for "_i" from 1 to 3 do { _x addItemToUniform "11Rnd_45ACP_Mag"; } } forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "HandGrenade"; } } forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "MiniGrenade"; } } forEach Units player;
{ for "_i" from 1 to 1 do { _x addItemToUniform "SmokeShellGreen"; } } forEach Units player;
{ for "_i" from 1 to 1 do { _x addItemToUniform "Laserbatteries"; } } forEach Units player; 
{_x addVest "V_RebreatherB"} forEach Units player;
{_x addBackpack "B_AssaultPack_blk"} forEach Units player;
{ for "_i" from 1 to 10 do { _x addItemToBackpack "30Rnd_65x39_caseless_mag_Tracer"; } } forEach Units player;
{ for "_i" from 1 to 3 do { _x addItemToBackpack "DemoCharge_Remote_Mag"; } } forEach Units player;
{_x addGoggles "G_B_Diving"} forEach Units player;

{_x addWeapon "arifle_MXC_Black_F"} forEach Units player;
{_x addPrimaryWeaponItem "muzzle_snds_65_TI_blk_F"} forEach Units player;
{_x addPrimaryWeaponItem "acc_pointer_IR"} forEach Units player;
{_x addPrimaryWeaponItem "optic_ERCO_blk_F"} forEach Units player;
{_x addWeapon "hgun_Pistol_heavy_01_F"} forEach Units player;
{_x addHandgunItem "muzzle_snds_acp"} forEach Units player;
{_x addHandgunItem "acc_flashlight_pistol"} forEach Units player;
{_x addHandgunItem "optic_MRD"} forEach Units player;
s01 addWeapon "Laserdesignator_03";

{_x linkItem "ItemMap"} forEach Units player;
{_x linkItem "ItemCompass"} forEach Units player;
{_x linkItem "ItemWatch"} forEach Units player;
{_x linkItem "ItemRadio"} forEach Units player;
{_x linkItem "ItemGPS"} forEach Units player;
{_x linkItem "NVGogglesB_blk_F"} forEach Units player;

"insertion" setMarkerSize [1,1];
{_x setpos (getmarkerpos "insertion")} foreach Units player;
cutText ["","BLACK IN",3,True];
[1, 1] spawn BIS_fnc_cinemaBorder;

if (isTouchingGround player) then {execVM "Scripts\gear.sqf";};

};


startScuba2 =
{
[0, 0] spawn BIS_fnc_cinemaBorder;
sleep 1;																																				// launch music
TitleText ["","BLACK FADED"];
[s01, [missionNamespace, "inventory_var1"]] call BIS_fnc_saveInventory;
[s02, [missionNamespace, "inventory_var2"]] call BIS_fnc_saveInventory;
[s03, [missionNamespace, "inventory_var3"]] call BIS_fnc_saveInventory;
[s04, [missionNamespace, "inventory_var4"]] call BIS_fnc_saveInventory;
[s05, [missionNamespace, "inventory_var5"]] call BIS_fnc_saveInventory;
[s06, [missionNamespace, "inventory_var6"]] call BIS_fnc_saveInventory;
[s07, [missionNamespace, "inventory_var7"]] call BIS_fnc_saveInventory;
[s08, [missionNamespace, "inventory_var8"]] call BIS_fnc_saveInventory;
[s09, [missionNamespace, "inventory_var9"]] call BIS_fnc_saveInventory;
[s10, [missionNamespace, "inventory_var10"]] call BIS_fnc_saveInventory;
[s11, [missionNamespace, "inventory_var11"]] call BIS_fnc_saveInventory;
[s12, [missionNamespace, "inventory_var12"]] call BIS_fnc_saveInventory;
[s13, [missionNamespace, "inventory_var13"]] call BIS_fnc_saveInventory;
var_start = true;
var_startScuba2 = true;
//[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;
playMusic "zip";
{removeAllWeapons _x} forEach Units player; 
{removeAllItems _x} forEach Units player;
{removeAllAssignedItems _x} forEach Units player;
{removeUniform _x} forEach Units player;
{removeVest _x} forEach Units player;
{removeBackpack _x} forEach Units player;
{removeHeadgear _x} forEach Units player;
{removeGoggles _x} forEach Units player;

{_x forceAddUniform "U_B_Wetsuit"} forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "FirstAidKit"; } } forEach Units player;
{ for "_i" from 1 to 3 do { _x addItemToUniform "11Rnd_45ACP_Mag"; } } forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "HandGrenade"; } } forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "MiniGrenade"; } } forEach Units player;
{ for "_i" from 1 to 1 do { _x addItemToUniform "SmokeShellGreen"; } } forEach Units player;
{ for "_i" from 1 to 1 do { _x addItemToUniform "Laserbatteries"; } } forEach Units player; 
{_x addVest "V_RebreatherB"} forEach Units player;
{_x addBackpack "B_AssaultPack_blk"} forEach Units player;
{ for "_i" from 1 to 10 do { _x addItemToBackpack "30Rnd_65x39_caseless_mag_Tracer"; } } forEach Units player;
{ for "_i" from 1 to 3 do { _x addItemToBackpack "DemoCharge_Remote_Mag"; } } forEach Units player;
{_x addGoggles "G_B_Diving"} forEach Units player;

{_x addWeapon "arifle_MXC_Black_F"} forEach Units player;
{_x addPrimaryWeaponItem "muzzle_snds_65_TI_blk_F"} forEach Units player;
{_x addPrimaryWeaponItem "acc_pointer_IR"} forEach Units player;
{_x addPrimaryWeaponItem "optic_ERCO_blk_F"} forEach Units player;
{_x addWeapon "hgun_Pistol_heavy_01_F"} forEach Units player;
{_x addHandgunItem "muzzle_snds_acp"} forEach Units player;
{_x addHandgunItem "acc_flashlight_pistol"} forEach Units player;
{_x addHandgunItem "optic_MRD"} forEach Units player;
s01 addWeapon "Laserdesignator_03";

{_x linkItem "ItemMap"} forEach Units player;
{_x linkItem "ItemCompass"} forEach Units player;
{_x linkItem "ItemWatch"} forEach Units player;
{_x linkItem "ItemRadio"} forEach Units player;
{_x linkItem "ItemGPS"} forEach Units player;
{_x linkItem "NVGogglesB_blk_F"} forEach Units player;

"insertion_1" setMarkerSize [1,1];
{_x setpos (getmarkerpos "insertion_1")} foreach Units player;
cutText ["","BLACK IN",3,True];
[1, 1] spawn BIS_fnc_cinemaBorder;

};

startScuba3 =
{
[0, 0] spawn BIS_fnc_cinemaBorder;
sleep 1;																																				// launch music
TitleText ["","BLACK FADED"];
[s01, [missionNamespace, "inventory_var1"]] call BIS_fnc_saveInventory;
[s02, [missionNamespace, "inventory_var2"]] call BIS_fnc_saveInventory;
[s03, [missionNamespace, "inventory_var3"]] call BIS_fnc_saveInventory;
[s04, [missionNamespace, "inventory_var4"]] call BIS_fnc_saveInventory;
[s05, [missionNamespace, "inventory_var5"]] call BIS_fnc_saveInventory;
[s06, [missionNamespace, "inventory_var6"]] call BIS_fnc_saveInventory;
[s07, [missionNamespace, "inventory_var7"]] call BIS_fnc_saveInventory;
[s08, [missionNamespace, "inventory_var8"]] call BIS_fnc_saveInventory;
[s09, [missionNamespace, "inventory_var9"]] call BIS_fnc_saveInventory;
[s10, [missionNamespace, "inventory_var10"]] call BIS_fnc_saveInventory;
[s11, [missionNamespace, "inventory_var11"]] call BIS_fnc_saveInventory;
[s12, [missionNamespace, "inventory_var12"]] call BIS_fnc_saveInventory;
[s13, [missionNamespace, "inventory_var13"]] call BIS_fnc_saveInventory;
var_start = true;
var_startScuba3 = true;
//[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;
playMusic "zip";
{removeAllWeapons _x} forEach Units player; 
{removeAllItems _x} forEach Units player;
{removeAllAssignedItems _x} forEach Units player;
{removeUniform _x} forEach Units player;
{removeVest _x} forEach Units player;
{removeBackpack _x} forEach Units player;
{removeHeadgear _x} forEach Units player;
{removeGoggles _x} forEach Units player;

{_x forceAddUniform "U_B_Wetsuit"} forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "FirstAidKit"; } } forEach Units player;
{ for "_i" from 1 to 3 do { _x addItemToUniform "11Rnd_45ACP_Mag"; } } forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "HandGrenade"; } } forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "MiniGrenade"; } } forEach Units player;
{ for "_i" from 1 to 1 do { _x addItemToUniform "SmokeShellGreen"; } } forEach Units player;
{ for "_i" from 1 to 1 do { _x addItemToUniform "Laserbatteries"; } } forEach Units player; 
{_x addVest "V_RebreatherB"} forEach Units player;
{_x addBackpack "B_AssaultPack_blk"} forEach Units player;
{ for "_i" from 1 to 10 do { _x addItemToBackpack "30Rnd_65x39_caseless_mag_Tracer"; } } forEach Units player;
{ for "_i" from 1 to 3 do { _x addItemToBackpack "DemoCharge_Remote_Mag"; } } forEach Units player;
{_x addGoggles "G_B_Diving"} forEach Units player;

{_x addWeapon "arifle_MXC_Black_F"} forEach Units player;
{_x addPrimaryWeaponItem "muzzle_snds_65_TI_blk_F"} forEach Units player;
{_x addPrimaryWeaponItem "acc_pointer_IR"} forEach Units player;
{_x addPrimaryWeaponItem "optic_ERCO_blk_F"} forEach Units player;
{_x addWeapon "hgun_Pistol_heavy_01_F"} forEach Units player;
{_x addHandgunItem "muzzle_snds_acp"} forEach Units player;
{_x addHandgunItem "acc_flashlight_pistol"} forEach Units player;
{_x addHandgunItem "optic_MRD"} forEach Units player;
s01 addWeapon "Laserdesignator_03";

{_x linkItem "ItemMap"} forEach Units player;
{_x linkItem "ItemCompass"} forEach Units player;
{_x linkItem "ItemWatch"} forEach Units player;
{_x linkItem "ItemRadio"} forEach Units player;
{_x linkItem "ItemGPS"} forEach Units player;
{_x linkItem "NVGogglesB_blk_F"} forEach Units player;

"insertion_2" setMarkerSize [1,1];
{_x setpos (getmarkerpos "insertion_2")} foreach Units player;
cutText ["","BLACK IN",3,True];
[1, 1] spawn BIS_fnc_cinemaBorder;

};

startScuba4 =
{
[0, 0] spawn BIS_fnc_cinemaBorder;
sleep 1;																																				// launch music
TitleText ["","BLACK FADED"];
[s01, [missionNamespace, "inventory_var1"]] call BIS_fnc_saveInventory;
[s02, [missionNamespace, "inventory_var2"]] call BIS_fnc_saveInventory;
[s03, [missionNamespace, "inventory_var3"]] call BIS_fnc_saveInventory;
[s04, [missionNamespace, "inventory_var4"]] call BIS_fnc_saveInventory;
[s05, [missionNamespace, "inventory_var5"]] call BIS_fnc_saveInventory;
[s06, [missionNamespace, "inventory_var6"]] call BIS_fnc_saveInventory;
[s07, [missionNamespace, "inventory_var7"]] call BIS_fnc_saveInventory;
[s08, [missionNamespace, "inventory_var8"]] call BIS_fnc_saveInventory;
[s09, [missionNamespace, "inventory_var9"]] call BIS_fnc_saveInventory;
[s10, [missionNamespace, "inventory_var10"]] call BIS_fnc_saveInventory;
[s11, [missionNamespace, "inventory_var11"]] call BIS_fnc_saveInventory;
[s12, [missionNamespace, "inventory_var12"]] call BIS_fnc_saveInventory;
[s13, [missionNamespace, "inventory_var13"]] call BIS_fnc_saveInventory;
var_start = true;
var_startScuba4 = true;
//[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;
playMusic "zip";
{removeAllWeapons _x} forEach Units player; 
{removeAllItems _x} forEach Units player;
{removeAllAssignedItems _x} forEach Units player;
{removeUniform _x} forEach Units player;
{removeVest _x} forEach Units player;
{removeBackpack _x} forEach Units player;
{removeHeadgear _x} forEach Units player;
{removeGoggles _x} forEach Units player;

{_x forceAddUniform "U_B_Wetsuit"} forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "FirstAidKit"; } } forEach Units player;
{ for "_i" from 1 to 3 do { _x addItemToUniform "11Rnd_45ACP_Mag"; } } forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "HandGrenade"; } } forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "MiniGrenade"; } } forEach Units player;
{ for "_i" from 1 to 1 do { _x addItemToUniform "SmokeShellGreen"; } } forEach Units player;
{ for "_i" from 1 to 1 do { _x addItemToUniform "Laserbatteries"; } } forEach Units player; 
{_x addVest "V_RebreatherB"} forEach Units player;
{_x addBackpack "B_AssaultPack_blk"} forEach Units player;
{ for "_i" from 1 to 10 do { _x addItemToBackpack "30Rnd_65x39_caseless_mag_Tracer"; } } forEach Units player;
{ for "_i" from 1 to 3 do { _x addItemToBackpack "DemoCharge_Remote_Mag"; } } forEach Units player;
{_x addGoggles "G_B_Diving"} forEach Units player;

{_x addWeapon "arifle_MXC_Black_F"} forEach Units player;
{_x addPrimaryWeaponItem "muzzle_snds_65_TI_blk_F"} forEach Units player;
{_x addPrimaryWeaponItem "acc_pointer_IR"} forEach Units player;
{_x addPrimaryWeaponItem "optic_ERCO_blk_F"} forEach Units player;
{_x addWeapon "hgun_Pistol_heavy_01_F"} forEach Units player;
{_x addHandgunItem "muzzle_snds_acp"} forEach Units player;
{_x addHandgunItem "acc_flashlight_pistol"} forEach Units player;
{_x addHandgunItem "optic_MRD"} forEach Units player;
s01 addWeapon "Laserdesignator_03";

{_x linkItem "ItemMap"} forEach Units player;
{_x linkItem "ItemCompass"} forEach Units player;
{_x linkItem "ItemWatch"} forEach Units player;
{_x linkItem "ItemRadio"} forEach Units player;
{_x linkItem "ItemGPS"} forEach Units player;
{_x linkItem "NVGogglesB_blk_F"} forEach Units player;

"insertion_3" setMarkerSize [1,1];
{_x setpos (getmarkerpos "insertion_3")} foreach Units player;
cutText ["","BLACK IN",3,True];
[1, 1] spawn BIS_fnc_cinemaBorder;

};

startScuba5 =
{
[0, 0] spawn BIS_fnc_cinemaBorder;
sleep 1;																																				// launch music
TitleText ["","BLACK FADED"];
[s01, [missionNamespace, "inventory_var1"]] call BIS_fnc_saveInventory;
[s02, [missionNamespace, "inventory_var2"]] call BIS_fnc_saveInventory;
[s03, [missionNamespace, "inventory_var3"]] call BIS_fnc_saveInventory;
[s04, [missionNamespace, "inventory_var4"]] call BIS_fnc_saveInventory;
[s05, [missionNamespace, "inventory_var5"]] call BIS_fnc_saveInventory;
[s06, [missionNamespace, "inventory_var6"]] call BIS_fnc_saveInventory;
[s07, [missionNamespace, "inventory_var7"]] call BIS_fnc_saveInventory;
[s08, [missionNamespace, "inventory_var8"]] call BIS_fnc_saveInventory;
[s09, [missionNamespace, "inventory_var9"]] call BIS_fnc_saveInventory;
[s10, [missionNamespace, "inventory_var10"]] call BIS_fnc_saveInventory;
[s11, [missionNamespace, "inventory_var11"]] call BIS_fnc_saveInventory;
[s12, [missionNamespace, "inventory_var12"]] call BIS_fnc_saveInventory;
[s13, [missionNamespace, "inventory_var13"]] call BIS_fnc_saveInventory;
var_start = true;
var_startScuba5 = true;
//[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;
playMusic "zip";
{removeAllWeapons _x} forEach Units player; 
{removeAllItems _x} forEach Units player;
{removeAllAssignedItems _x} forEach Units player;
{removeUniform _x} forEach Units player;
{removeVest _x} forEach Units player;
{removeBackpack _x} forEach Units player;
{removeHeadgear _x} forEach Units player;
{removeGoggles _x} forEach Units player;

{_x forceAddUniform "U_B_Wetsuit"} forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "FirstAidKit"; } } forEach Units player;
{ for "_i" from 1 to 3 do { _x addItemToUniform "11Rnd_45ACP_Mag"; } } forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "HandGrenade"; } } forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "MiniGrenade"; } } forEach Units player;
{ for "_i" from 1 to 1 do { _x addItemToUniform "SmokeShellGreen"; } } forEach Units player;
{ for "_i" from 1 to 1 do { _x addItemToUniform "Laserbatteries"; } } forEach Units player; 
{_x addVest "V_RebreatherB"} forEach Units player;
{_x addBackpack "B_AssaultPack_blk"} forEach Units player;
{ for "_i" from 1 to 10 do { _x addItemToBackpack "30Rnd_65x39_caseless_mag_Tracer"; } } forEach Units player;
{ for "_i" from 1 to 3 do { _x addItemToBackpack "DemoCharge_Remote_Mag"; } } forEach Units player;
{_x addGoggles "G_B_Diving"} forEach Units player;

{_x addWeapon "arifle_MXC_Black_F"} forEach Units player;
{_x addPrimaryWeaponItem "muzzle_snds_65_TI_blk_F"} forEach Units player;
{_x addPrimaryWeaponItem "acc_pointer_IR"} forEach Units player;
{_x addPrimaryWeaponItem "optic_ERCO_blk_F"} forEach Units player;
{_x addWeapon "hgun_Pistol_heavy_01_F"} forEach Units player;
{_x addHandgunItem "muzzle_snds_acp"} forEach Units player;
{_x addHandgunItem "acc_flashlight_pistol"} forEach Units player;
{_x addHandgunItem "optic_MRD"} forEach Units player;
s01 addWeapon "Laserdesignator_03";

{_x linkItem "ItemMap"} forEach Units player;
{_x linkItem "ItemCompass"} forEach Units player;
{_x linkItem "ItemWatch"} forEach Units player;
{_x linkItem "ItemRadio"} forEach Units player;
{_x linkItem "ItemGPS"} forEach Units player;
{_x linkItem "NVGogglesB_blk_F"} forEach Units player;

"insertion_4" setMarkerSize [1,1];
{_x setpos (getmarkerpos "insertion_4")} foreach Units player;
cutText ["","BLACK IN",3,True];
[1, 1] spawn BIS_fnc_cinemaBorder;

};

startScuba6 =
{
[0, 0] spawn BIS_fnc_cinemaBorder;
sleep 1;																																				// launch music
TitleText ["","BLACK FADED"];
[s01, [missionNamespace, "inventory_var1"]] call BIS_fnc_saveInventory;
[s02, [missionNamespace, "inventory_var2"]] call BIS_fnc_saveInventory;
[s03, [missionNamespace, "inventory_var3"]] call BIS_fnc_saveInventory;
[s04, [missionNamespace, "inventory_var4"]] call BIS_fnc_saveInventory;
[s05, [missionNamespace, "inventory_var5"]] call BIS_fnc_saveInventory;
[s06, [missionNamespace, "inventory_var6"]] call BIS_fnc_saveInventory;
[s07, [missionNamespace, "inventory_var7"]] call BIS_fnc_saveInventory;
[s08, [missionNamespace, "inventory_var8"]] call BIS_fnc_saveInventory;
[s09, [missionNamespace, "inventory_var9"]] call BIS_fnc_saveInventory;
[s10, [missionNamespace, "inventory_var10"]] call BIS_fnc_saveInventory;
[s11, [missionNamespace, "inventory_var11"]] call BIS_fnc_saveInventory;
[s12, [missionNamespace, "inventory_var12"]] call BIS_fnc_saveInventory;
[s13, [missionNamespace, "inventory_var13"]] call BIS_fnc_saveInventory;
var_start = true;
var_startScuba6 = true;
//[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;
playMusic "zip";
{removeAllWeapons _x} forEach Units player; 
{removeAllItems _x} forEach Units player;
{removeAllAssignedItems _x} forEach Units player;
{removeUniform _x} forEach Units player;
{removeVest _x} forEach Units player;
{removeBackpack _x} forEach Units player;
{removeHeadgear _x} forEach Units player;
{removeGoggles _x} forEach Units player;

{_x forceAddUniform "U_B_Wetsuit"} forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "FirstAidKit"; } } forEach Units player;
{ for "_i" from 1 to 3 do { _x addItemToUniform "11Rnd_45ACP_Mag"; } } forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "HandGrenade"; } } forEach Units player;
{ for "_i" from 1 to 2 do { _x addItemToUniform "MiniGrenade"; } } forEach Units player;
{ for "_i" from 1 to 1 do { _x addItemToUniform "SmokeShellGreen"; } } forEach Units player;
{ for "_i" from 1 to 1 do { _x addItemToUniform "Laserbatteries"; } } forEach Units player; 
{_x addVest "V_RebreatherB"} forEach Units player;
{_x addBackpack "B_AssaultPack_blk"} forEach Units player;
{ for "_i" from 1 to 10 do { _x addItemToBackpack "30Rnd_65x39_caseless_mag_Tracer"; } } forEach Units player;
{ for "_i" from 1 to 3 do { _x addItemToBackpack "DemoCharge_Remote_Mag"; } } forEach Units player;
{_x addGoggles "G_B_Diving"} forEach Units player;

{_x addWeapon "arifle_MXC_Black_F"} forEach Units player;
{_x addPrimaryWeaponItem "muzzle_snds_65_TI_blk_F"} forEach Units player;
{_x addPrimaryWeaponItem "acc_pointer_IR"} forEach Units player;
{_x addPrimaryWeaponItem "optic_ERCO_blk_F"} forEach Units player;
{_x addWeapon "hgun_Pistol_heavy_01_F"} forEach Units player;
{_x addHandgunItem "muzzle_snds_acp"} forEach Units player;
{_x addHandgunItem "acc_flashlight_pistol"} forEach Units player;
{_x addHandgunItem "optic_MRD"} forEach Units player;
s01 addWeapon "Laserdesignator_03";

{_x linkItem "ItemMap"} forEach Units player;
{_x linkItem "ItemCompass"} forEach Units player;
{_x linkItem "ItemWatch"} forEach Units player;
{_x linkItem "ItemRadio"} forEach Units player;
{_x linkItem "ItemGPS"} forEach Units player;
{_x linkItem "NVGogglesB_blk_F"} forEach Units player;

"insertion_5" setMarkerSize [1,1];
{_x setpos (getmarkerpos "insertion_6")} foreach Units player;
cutText ["","BLACK IN",3,True];
[1, 1] spawn BIS_fnc_cinemaBorder;

};

//////////////////////////////////////////

_missionsData 	= [
	[getmarkerpos "insertion",startScuba1,"SCUBA INSERTION","","","",1,[]],
	[getmarkerpos "insertion_1",startScuba2,"SCUBA INSERTION","","","",1,[]],
	[getmarkerpos "insertion_2",startScuba3,"SCUBA INSERTION","","","",1,[]],
	[getmarkerpos "insertion_3",startScuba4,"SCUBA INSERTION","","","",1,[]],
	[getmarkerpos "insertion_4",startScuba5,"SCUBA INSERTION","","","",1,[]],
	[getmarkerpos "insertion_5",startScuba6,"SCUBA INSERTION","","","",1,[]]
];

//////////////////////////////////////////

disableserialization;

_parentDisplay 	= [] call bis_fnc_displayMission;
_mapCenter 	= getmarkerpos "mrk_mapCentre";
_ORBAT 		= [];
_markers 	= [];
_images 	= [];
_overcast 	= overcast;
_isNight 	= true;
_scale		= 1.5;
_simul		= false;


[
findDisplay 46,
_mapCenter,
_missionsData,
_ORBAT,
_markers,
_images,
_overcast,
_isNight,
_scale,
_simul
] call zag_fnc_mapZoom;

 

 

as you can see, I use the strategic map to teleport player&AI teammates at pre-placed markers, and give them new gear and saving the old inventory.

"MyFunctions.sqf" is the part you need for the "zoom" effect.

 

Hope it help!

 

Zagor out!

 

 

  • Like 1

Share this post


Link to post
Share on other sites

couldn't you set up your adjusted script as a function and then call it that way?

 

i.e.

zag_fnc_mapstuff = { contents of "fn_IMPROVEDstrategicMapOpen.sqf" in here};

 

then:

Quote

[ findDisplay 46, _mapCenter, _missionsData, _ORBAT, _markers, _images, _overcast, _isNight, _scale, _simul ] call zag_fnc_mapstuff;

 

hope that helps :D

  • Thanks 1

Share this post


Link to post
Share on other sites

It probably will help..as soon that I understand how to apply that to my mission.

 

Ok... this is the script used to open the strategic map and give tasks, called with an addAction on a object:

Spoiler

startLAZARAT =
{
cutText ["","BLACK FADED",0,True];
"mrk_startLAZARAT" setMarkerSize [1,1];
var_start = true;
var_startLAZARAT = true;
cutText ["","BLACK IN",3,True];
sleep 3;
["task2","kill"] call BIS_fnc_taskSetType;
[West,"task2",["KILL HVT","KILL HVT","KILL HVT"],"mrk_LAZARAT",True] call BIS_fnc_taskCreate;
savegame;
waitUntil {!alive HVT};
sleep 3;
	["task2", "SUCCEEDED", true] call BIS_fnc_taskSetState;
sleep 5;	
savegame;
};

startArty =
{
cutText ["","BLACK FADED",0,True];
"mrk_startArty" setMarkerSize [1,1];
var_start = true;
var_startArty = true;
cutText ["","BLACK IN",3,True];
sleep 3;
["task1","destroy"] call BIS_fnc_taskSetType;
[West,"task1",["Destroy Artillery","DESTROY ARTILLERY","DESTROY ARTILLERY"],"mrk_Arty",True] call BIS_fnc_taskCreate;
savegame;
waitUntil {!alive arty};
sleep 3;
	["task1", "SUCCEEDED", true] call BIS_fnc_taskSetState;
sleep 5;	
savegame;
deleteMarker "mrk_Arty";
	
};

startHelo =
{
cutText ["","BLACK FADED",0,True];
player enableSimulation false;
"mrk_startHelo" setMarkerSize [1,1];
player setpos getmarkerpos "mrk_startHelo";
{_x setpos getmarkerpos "mrk_startHelo";_x enableAI "ANIM";_x switchMove ""} forEach [a2,a3,a4,a5];
a2 joinAsSilent [group player, 2];
a3 joinAsSilent [group player, 3];
a4 joinAsSilent [group player, 4];
a5 joinAsSilent [group player, 5];
group player setBehaviour "STEALTH";
player setdir 57;
var_start = true;
var_startHelo = true;
player say ["start_Helo",500];
sleep 5;	
player enableSimulation true;
cutText ["","BLACK IN",5,True];
sleep 8;
savegame;
};

//////////////////////////////////////////

_missionsData 	= [
	[getmarkerpos "mrk_LAZARAT",startLAZARAT,"LAZARAT Family AO","Primary Objective: Disrupt any operation of the LAZARAT narcos family.","","pictures\LAZARAT_GANG3.jpg",1,[]],
	[getmarkerpos "mrk_Arty",startArty,"Artillery Emplacement","The primary objective is the destruction of the Aktinarki artillery battery.","","pictures\ARTY_PIC3.jpg",1,[]],
	[getmarkerpos "mrk_Helo",startHelo,"Attack Helicopter","Secondary Objective: A CSAT attack helicopter operates out of this position and represents a threat to the mission.","","images\img_Helo.jpg",1,[]]
];

//////////////////////////////////////////

disableserialization;

_parentDisplay 	= [] call bis_fnc_displayMission;
_mapCenter 	= getmarkerpos "mrk_mapCentre";
_ORBAT 		= [];
_markers 	= [];
_images 	= [];
_overcast 	= overcast;
_isNight 	= !((dayTime > 6) && (dayTime < 20));
_scale		= 1.5;
_simul		= false;


[
findDisplay 46,
_mapCenter,
_missionsData,
_ORBAT,
_markers,
_images,
_overcast,
_isNight,
_scale,
_simul
] call Bis_fnc_strategicMapOpen;

 

 

how exactly can make it a function like you mention

i.e.

zag_fnc_mapstuff = { contents of "fn_IMPROVEDstrategicMapOpen.sqf" in here};

and where do I put this in my mission folder?

Sorry, but I don't know shait about functions....

 

Share this post


Link to post
Share on other sites

stick all functions you need for mission in one .sqf

"AllMyLovelyFunctions.sqf":

Quote

Zag_fnc_thisFunc = { blah blah blah};

 

Zag_fnc_thatFunc = {bluh bluh bluh};

 

and load them from init with

 

Quote

call compile preprocessFile "allMyLovelyFunctions.sqf";

 

this way they're all loaded on mission start and can be called in mission without engine having to read them every time

 

  • Thanks 1

Share this post


Link to post
Share on other sites

OK...let's see if I got this right:

 

I create a .sqf file named "MyFunctions.sqf"  with,in this case, this:

zag_fnc_mapstuff = { contents of "fn_IMPROVEDstrategicMapOpen.sqf" in here};

then in the init

call compile preprocessFile "MyFunctions.sqf";

then in the script above

disableserialization;

_parentDisplay 	= [] call bis_fnc_displayMission;
_mapCenter 	= getmarkerpos "mrk_mapCentre";
_ORBAT 		= [];
_markers 	= [];
_images 	= [];
_overcast 	= overcast;
_isNight 	= !((dayTime > 6) && (dayTime < 20));
_scale		= 1.5;
_simul		= false;


[
findDisplay 46,
_mapCenter,
_missionsData,
_ORBAT,
_markers,
_images,
_overcast,
_isNight,
_scale,
_simul
] call call zag_fnc_mapstuff;

Right?

  • Thanks 1

Share this post


Link to post
Share on other sites

yeah that looks right, should work fine :D

  • Thanks 1

Share this post


Link to post
Share on other sites

Nope...it doesn't open the map...

Here is the error report:

Spoiler

18:40:10  Mission id: 2a31fb47f5ff52b198c9ce74d572c9430ee9dc5c
18:40:10 No speaker given for 
18:40:10 No speaker given for 
18:40:10 No speaker given for 
18:40:12 No speaker given for 
18:40:13 No speaker given for 
18:40:13 No speaker given for 
18:40:24 Error in expression <ercast,
_isNight,
_scale,
_simul
] call zag_fnc_mapsZoom;>
18:40:24   Error position: <zag_fnc_mapsZoom;>
18:40:24   Error Undefined variable in expression: zag_fnc_mapszoom
18:40:24 File C:\Users\Claudio\Documents\Arma 3 - Other Profiles\ZAGOR64BZ\missions\1_GHOST_RECON.Altis\scripts\osm.sqf, line 96

 

 

and here is the MyFunctions.sqf file

Spoiler

zag_fnc_mapZoom = { /*
	Author: Karel Moricky

	Description:
	Open strategic map.

	Parameter(s):
		0: DISPLAY - parent display. When empty, mission display is used.
		1: ARRAY - default view position in format [x,y,y] or [x,y]
		2: ARRAY - list of missions in format:
			0: ARRAY - mission position in format [x,y,y] or [x,y]
			1: CODE - expression executed when user clicks on mission icon
			2: STRING - mission name
			3: STRING - short description
			4: STRING - name of mission's player
			5: STRING - path to overview image
			6: NUMBER - size multiplier, 1 means default size
			7: ARRAY - parameters for the -on click- code; referenced from the script as (_this select 9)
		3: ARRAY - list of ORBAT groups in format:
			0: ARRAY - group position in format [x,y,y] or [x,y]
			1: CONFIG - preview CfgORBAT group
			2: CONFIG - topmost displayed CfgORBAT group
			3: ARRAY - list of allowed tags
			4: NUMBER - maximum number of displayed tiers
		4: ARRAY - list of markers revealed in strategic map (will be hidden when map is closed)
		5: ARRAY - list of custom images in format:
			0: STRING - texture path
			1: ARRAY - color in format [R,G,B,A]
			2: ARRAY - image position
			3: NUMBER - image width (in metres)
			4: NUMBER - image height (in metres)
			5: NUMBER - image angle (in degrees)
			6: STRING - text displayed next to the image
			7: BOOL - true to display shadow
		6: NUMBER - value in range <0-1> defining weather on strategic map (i.e. density of clouds)
		7: BOOL - true for night version of strategic map (darker with blue tone)
		8: NUMBER - default map scale coeficient (1 is automatic scale)
		9: BOOL - true to enable simulation while the map is opened (default: false)
	       10: STRING - bottom bar action label text (default: "Select a mission")
	       11: BOOL - true to show icon label as a mission name (default: true)
	       12: STRING - path to mission icon texture (default: "\A3\Ui_f\data\Map\GroupIcons\badge_rotate_%1_gs.paa")
	       		%1 - animation frame from 0-6 (optional)
	       		%2 - index from 1-9 (optional)

	Returns:
	DISPLAY - RscDisplayStrategicMap
*/
private ["_parentDisplayDefault","_parentDisplay","_mapCenter","_missions","_ORBAT","_markers","_images","_overcast","_scale","_defaultScale","_simulationEnabled","_displayClass","_display","_playerIcon","_playerColor","_cloudTextures","_cloudsGrid","_cloudsMax","_cloudsSize","_map","_fade","_actionText","_missionIcon","_showIconText"];
disableserialization;

_parentDisplayDefault = switch false do {
	case isnull (finddisplay 37): {finddisplay 37}; //--- GetReady
	case isnull (finddisplay 52): {finddisplay 52}; //--- ServerGetReady
	case isnull (finddisplay 53): {finddisplay 53}; //--- ClientGetReady
	default {[] call bis_fnc_displayMission}; //--- Mission
};
_parentDisplay = _this param [0,_parentDisplayDefault,[displaynull]];
_mapCenter = _this param [1,position player];
_mapCenter = _mapCenter call bis_fnc_position;
_missions = _this param [2,[],[[]]];
_ORBAT = _this param [3,[],[[]]];
_markers = _this param [4,[],[[]]];
_images = _this param [5,[],[[]]];
_overcast = (_this param [6,overcast,[0]]) max 0 min 1;
_isNight = _this param [7,false,[false]];
_defaultScale = _this param [8,1,[0]];
_simulationEnabled = _this param [9,false,[false]];
_actionText = _this param [10,localize "str_a3_rscdisplaystrategicmap_missions",[""]];
_showIconText = _this param [11,true,[true]];
_missionIcon = _this param [12,"\A3\Ui_f\data\Map\GroupIcons\badge_rotate_%1_gs.paa",[""]];

BIS_fnc_strategicMapOpen_showIconText = _showIconText;
BIS_fnc_strategicMapOpen_missionIcon = _missionIcon;

//--- Calculate terrain size and outside color
_mapSize = worldSize;
BIS_fnc_strategicMapOpen_mapSize = _mapSize;
BIS_fnc_strategicMapOpen_isNight = _isNight;

_scale = 3500 / _mapSize / safezoneH;
_scale = _scale * (_defaultScale max 0 min 1);
_maxSatelliteAlpha = if (_isNight) then {0.75} else {1};

_colorOutside = configfile >> "CfgWorlds" >> worldname >> "OutsideTerrain" >> "colorOutside";
_colorOutside = if (isarray _colorOutside) then {
	_colorOutside call bis_fnc_colorCOnfigToRGBA;
} else {
	["colorOutside param is mission in ""CfgWorlds"" >> ""%1"" >> ""OutsideTerrain""",worldname] call bis_fnc_error;
	[0,0,0,1]
};

with uinamespace do {
	RscDisplayStrategicMap_scaleMin = 0;
	RscDisplayStrategicMap_scaleMax = 1;
	RscDisplayStrategicMap_scaleDefault = _scale;
	RscDisplayStrategicMap_maxSatelliteAlpha = _maxSatelliteAlpha;

	RscDisplayStrategicMap_colorOutside_R = _colorOutside select 0;
	RscDisplayStrategicMap_colorOutside_G = _colorOutside select 1;
	RscDisplayStrategicMap_colorOutside_B = _colorOutside select 2;
};

//--- Create the viewer
_displayClass = if (_simulationEnabled) then {"RscDisplayStrategicMapSimulation"} else {"RscDisplayStrategicMap"};
_parentDisplay createdisplay _displayClass;
_display = finddisplay 506;
if (isnull _display) exitwith {"Unable to create 'RscDisplayStrategicMap' display." call (uinamespace getvariable "bis_fnc_error"); displaynull};

//--- Life, calculations and everything
startloadingscreen ["","RscDisplayLoadingBlack"];

BIS_fnc_strategicMapOpen_player = player;
//selectnoplayer;

//--- Process ORBAT
BIS_fnc_strategicMapOpen_ORBAT = [];
_onClick = [];
{
	private ["_pos","_class","_parent","_tags","_tiers","_classParams","_text","_texture","_size","_color","_sizeLocal","_sizeParams","_sizeTexture"];
	_pos = _x param [0,player];
	_pos = _pos call bis_fnc_position;

	_class = _x param [1,configfile >> "CfgORBAT",[configfile]];
	_parent = _x param [2,_class,[configfile]];
	_tags = _x param [3,[],[[]]];
	_tiers = _x param [4,-1,[0]];

	_classParams = _class call bis_fnc_ORBATGetGroupParams;
	_text = _classParams select ("text" call bis_fnc_ORBATGetGroupParams);
	_texture = _classParams select ("texture" call bis_fnc_ORBATGetGroupParams);
	_size = _classParams select ("size" call bis_fnc_ORBATGetGroupParams);
	_color = _classParams select ("color" call bis_fnc_ORBATGetGroupParams);

	_iconSize = sqrt (_size + 1) * 32;

	//--- Group size
	//_sizeLocal = _size max 0 min (count (BIS_fnc_ORBATGetGroupParams_sizes) - 1);
	//_sizeParams = BIS_fnc_ORBATGetGroupParams_sizes select _sizeLocal;
	//_sizeTexture = _sizeParams select 0;

	BIS_fnc_strategicMapOpen_ORBAT set [
		count BIS_fnc_strategicMapOpen_ORBAT,
		[
			_class,
			[_parent,_tags,_tiers],
			[
				_texture,
				_color,
				_pos,
				_iconSize,
				_iconSize,
				0,
				"",
				false
			],
			_classParams
		]
	];

	//--- Create shortcut from ORBAT viewer
	_onClick set [count _onClick,_class];
	_onClick set [count _onClick,{[_this select 0,1] spawn bis_fnc_strategicMapAnimate; true}];
} foreach _ORBAT;
BIS_fnc_strategicMapOpen_ORBATonClick = _onClick;

//--- Process Missions
BIS_fnc_strategicMapOpen_missions = [];
if (count _missions > 0) then {
	_playerIcon = gettext (configfile >> "CfgInGameUI" >> "IslandMap" >> "iconPlayer");
	_playerColor = (getarray (configfile >> "cfgingameui" >> "islandmap" >> "colorMe")) call BIS_fnc_colorRGBAtoHTML;

	_ctrlBackground = _display displayctrl 1000;
	_ctrlBackground ctrlshow false;

	_ctrlMissions = _display displayctrl 1500;
	_lbadd = _ctrlMissions lbadd _actionText;
	_ctrlMissions lbsetvalue [_lbadd,-1];
	_ctrlMissions lbsetcolor [_lbadd,[1,1,1,0.5]];
	{
		private ["_pos","_code","_title","_description","_player","_picture","_iconSize","_infoText","_codeParams"];
		_pos = _x param [0,player];
		_pos = _pos call bis_fnc_position;

		_code = _x param [1,{},[{}]];
		_title = _x param [2,"ERROR: MISSING TITLE",[""]];
		_description = _x param [3,"",[""]];
		_player = _x param [4,"",[""]];
		_picture = _x param [5,"",[""]];
		_iconSize = _x param [6,1,[1]];
		_codeParams = _x param [7,[],[[]]];

		_infoText = _title;
		if (_player != "") then {_infoText = _infoText + format ["<br /><t size='0.2' color='#00000000'>-<br /></t><img size='1' image='%2' color='%3'/><t size='0.8'> %1</t>",_player,_playerIcon,_playerColor];};
		if (_description != "") then {_infoText = _infoText + format ["<br /><t size='0.5' color='#00000000'>-<br /></t><t size='0.8'>%1</t>",_description];};
		//if (_picture != "") then {_infoText = _infoText + format ["<br /><img size='5.55' image='%1' />",_picture];};

		BIS_fnc_strategicMapOpen_missions set [
			count BIS_fnc_strategicMapOpen_missions,
			[
				_pos,
				_code,
				_title,
				_iconSize,
				_picture,
				0,
				0,
				0,
				_infoText,
				_codeParams
			]
		];

		_lbadd = _ctrlMissions lbadd format ["%1 (%2/%3)",_title,_foreachindex + 1,count _missions];
		_ctrlMissions lbsetvalue [_lbAdd,_foreachindex];

	} foreach _missions;

	_ctrlMissions lbsetcursel 0;
	_ctrlMissions ctrladdeventhandler [
		"lbselchanged",
		"
			_ctrlMissions = _this select 0;
			_cursel = _this select 1;
			if ((_ctrlMissions lbvalue 0) < 0) exitwith {_ctrlMissions lbdelete 0; _ctrlMissions lbsetcursel 0;};
			_mission = BIS_fnc_strategicMapOpen_missions select (_ctrlMissions lbvalue _cursel);
			[_mission select 0,1] spawn bis_fnc_strategicmapanimate;
		"
	];
};

//--- Process Images
BIS_fnc_strategicMapOpen_images = [];
{
	private ["_texture","_color","_pos","_w","_h","_dir","_text","_shadow"];
	_texture = _x param [0,"#(argb,8,8,3)color(0,0,0,0)",[""]];
	_color = _x param [1,[1,1,1,1],[[]]];
	_pos = _x param [2,position player];
	_w = _x param [3,0,[0]];
	_h = _x param [4,0,[0]];
	_dir = _x param [5,0,[0]];
	_text = _x param [6,"",[""]];
	_shadow = _x param [7,false,[false]];

	_pos = _pos call bis_fnc_position;
	_color = _color call bis_fnc_colorConfigToRGBA;
	_coef = (0.182 * safezoneH); //--- Magic constant to make kilometer a kilometer
	_w = _w * _coef;
	_h = _h * _coef;

	BIS_fnc_strategicMapOpen_images set [
		count BIS_fnc_strategicMapOpen_images,
		[_texture,_color,_pos,_w,_h,_dir,_text,_shadow]
	];
} foreach _images;

//--- Random clouds
_cloudTextures = [
	"\A3\data_f\mrak_01_ca.paa",
	"\A3\data_f\mrak_02_ca.paa",
	"\A3\data_f\mrak_03_ca.paa",
	"\A3\data_f\mrak_04_ca.paa"
];
_cloudsGrid = 500;
_cloudsMax = (_mapSize / _cloudsGrid) * _overcast;
_cloudsSize = (_cloudsGrid / 2) + (_cloudsGrid * _overcast);
BIS_fnc_strategicMapOpen_overcast = _overcast;
BIS_fnc_strategicMapOpen_clouds = [];

for "_i" from 1 to (_cloudsMax) do {
	BIS_fnc_strategicMapOpen_clouds set [
		count BIS_fnc_strategicMapOpen_clouds,
		[
			_cloudTextures call bis_fnc_selectrandom,
			(random _mapSize),
			((_mapSize / _cloudsMax) * _i),
			random 360,
			_cloudsSize + (_cloudsSize * _overcast),
			[1,1,1,0.25]
		]
	];
};


BIS_fnc_strategicMapOpen_indexSizeTexture =	("sizeTexture" call bis_fnc_ORBATGetGroupParams);
BIS_fnc_strategicMapOpen_indexTextureSize =	("textureSize" call bis_fnc_ORBATGetGroupParams);

BIS_fnc_strategicMapOpen_draw = {
	scriptname "bis_fnc_strategicMapOpen - Draw";
	_map = _this select 0;
	_mapSize = BIS_fnc_strategicMapOpen_mapSize / 2;
	_display = ctrlparent _map;
	_time = diag_ticktime;

	//_tooltip = (ctrlparent _map) displayctrl 2350;
	//_tooltip ctrlsetfade 1;
	//_tooltip ctrlcommit 0;

	_mousePos = _map ctrlmapscreentoworld BIS_fnc_strategicMapOpen_mousePos;
	//_mouseLimit = BIS_fnc_strategicMapOpen_mapSize / 3400;
	_mouseLimit = 2.5 / safezoneh;
	_selected = [];

	//--- Cross grid
	_map drawRectangle [
		[_mapSize,_mapSize,0],
		_mapSize,
		_mapSize,
		0,
		[1,1,1,0.42],
		"\A3\Ui_f\data\GUI\Rsc\RscDisplayStrategicMap\cross_ca.paa"
	];

	//--- Images
	{
		_map drawicon _x;
	} foreach BIS_fnc_strategicMapOpen_images;

	//--- ORBAT groups
	{
		_class = _x select 0;
		_iconParams = +(_x select 2);
		_classParams = +(_x select 3);

		_pos = _iconParams select 2;
		_iconSize = _iconParams select 3;

		if (((_iconParams select 2) distance _mousePos) < (_mouseLimit * _iconSize)) then {
			_iconParams set [3,(_iconParams select 3) * 1.2];
			_iconParams set [4,(_iconParams select 4) * 1.2];
			_selected = _x;
		};

		_textureSize = _classParams select BIS_fnc_strategicMapOpen_indexTextureSize;
		_iconSizeParams = +_iconParams;
		_iconParams set [3,(_iconParams select 3) * _textureSize];
		_iconParams set [4,(_iconParams select 4) * _textureSize];

		_map drawIcon _iconParams;

		//--- Draw size texture
		_size = _classParams select 5;
		if (_size >= 0) then {
			_sizeTexture = _classParams select BIS_fnc_strategicMapOpen_indexSizeTexture;
			_iconSizeParams set [0,_sizeTexture];
			_map drawIcon _iconSizeParams;
		};

	} foreach BIS_fnc_strategicMapOpen_ORBAT;

	//--- Clouds
	_cloudSpeed = sin _time * (1138 + 2000 * BIS_fnc_strategicMapOpen_overcast);
	{
		_texture = _x select 0;
		_posX = _x select 1;
		_posY = _x select 2;
		_dir = _x select 3;
		_size = _x select 4;
		_color = _x select 5;

		_map drawIcon [
			_texture,
			_color,
			[
				_posX + _cloudSpeed,
				_posY
			],
			_size,
			_size,
			_dir + (_time * _foreachindex) / (count BIS_fnc_strategicMapOpen_clouds * 3),
			"",
			false
		];
	} foreach BIS_fnc_strategicMapOpen_clouds;

	//--- Missions
	_textureAnimPhase = abs(6 - floor (_time * 16) % 12);
	{
		_pos = _x select 0;
		_title = _x select 2;
		_size = (_x select 3) * 32;
		_dir = 0;
		_alpha = 0.75;
		_texture = format [BIS_fnc_strategicMapOpen_missionIcon,_textureAnimPhase,_foreachindex + 1];

		//--- Icon is under cursor
		if ((_pos distance _mousePos) < (_mouseLimit * _size)) then {
			_size = _size * 1.2;
			_alpha = 1;
			_selected = _x;
		};

		//--- Outside of the screen area
		_mappos = _map ctrlmapworldtoscreen _pos;
		_mapposX = _mappos select 0;
		_mapposY = _mappos select 1;

		_borderLeft = safezoneX;
		_borderRight = safezoneX + safezoneW;
		_borderTop = safezoneY;
		_borderBottom = safezoneY + safezoneH;

		if (
			_mapposX < _borderLeft || _mapposX > _borderRight
			||
			_mapposY < _borderTop || _mapposY > _borderBottom
		) then {
			_texture = gettext (configfile >> "CfgInGameUI" >> "Cursor" >> "outArrow");
			_mapposX = _mapposX max safezoneX min (safezoneX + safezoneW);
			_mapposY = _mapposY max safezoneY min (safezoneY + safezoneH);
			_title = "";

			_offset = (_size / 1200);
			_offsetDefX = _offset;
			_offsetDefY = _offset * 4/3;
			_offsetX = 0;
			_offsetY = 0;
			_dir = -([[0.5,0.5],_mappos] call bis_fnc_dirto) - 90;

			switch (true) do {
				case (_mapposX <= _borderLeft): {
					_offsetX = +_offsetDefX;
					_mapposY = _mapposY min (_borderBottom - _offsetDefY) max (_borderTop + _offsetDefY);
				};
				case (_mapposX >= _borderRight): {
					_offsetX = -_offsetDefX;
					_mapposY = _mapposY min (_borderBottom - _offsetDefY) max (_borderTop + _offsetDefY);
				};
				case (_mapposY <= _borderTop): {
					_offsetY = +_offsetDefY;
					_mapposX = _mapposX min (_borderRight - _offsetDefX) max (_borderLeft + _offsetDefX);
				};
				case (_mapposY >= _borderBottom): {
					_offsetY = -_offsetDefY;
					_mapposX = _mapposX min (_borderRight - _offsetDefX) max (_borderLeft + _offsetDefX);
				};
			};

			_pos = _map ctrlmapscreentoworld [
				_mapposX + _offsetX,
				_mapposY + _offsetY
			];
		};

		_map drawIcon [
			_texture,
			[1,1,1,_alpha],
			_pos,
			_size,
			_size,
			_dir,
			if (BIS_fnc_strategicMapOpen_showIconText) then {" " + _title} else {""},
			2,
			0.08,
			"PuristaBold"
		];
	} foreach BIS_fnc_strategicMapOpen_missions;

	//--- Night
	if (BIS_fnc_strategicMapOpen_isNight) then {
		_map drawRectangle [
			[_mapSize,_mapSize,0],
			99999,
			99999,
			0,
			[0,0.05,0.2,0.42],
			"#(argb,8,8,3)color(1,1,1,1)"
		];
	};

	//--- Tooltip
	if (count _selected > 0 && !BIS_fnc_strategicMapOpen_mouseClickDisable) then {
		switch (count _selected) do {

			//--- ORBAT
			case 4: {
				_class = _selected select 0;
				_classParams = _selected select 3;

				[_classParams,_display,BIS_fnc_strategicMapOpen_mousePos] call bis_fnc_ORBATTooltip;
			};

			//--- Mission
			case 10;
			case 9: {
				[_selected,_display,BIS_fnc_strategicMapOpen_mousePos] call bis_fnc_ORBATTooltip;
			};
		};
	} else {
		[[],_display] call bis_fnc_ORBATTooltip;
	};
	_info ctrlcommit 0;
	BIS_fnc_strategicMapOpen_selected = _selected;
};

//--- Mouse click on icon
BIS_fnc_strategicMapOpen_mouseClickDisable = false;
BIS_fnc_strategicMapOpen_selected = [];
BIS_fnc_strategicMapOpen_mousePos = [0,0];
BIS_fnc_strategicMapOpen_mouse = {
	BIS_fnc_strategicMapOpen_mousePos = [_this select 1,_this select 2];
};

#define DIK_H               0x23
#define DIK_NUMPAD5         0x4C

BIS_fnc_strategicMapOpen_keyDown = {
	_display = _this select 0;
	_key = _this select 1;

	//--- H
	switch _key do {
		case DIK_H: {
			_fade = ceil ctrlfade (_display displayctrl 2);
			_fade = (_fade + 1) % 2;
			{
				(_display displayctrl _x) ctrlsetfade _fade;
				(_display displayctrl _x) ctrlcommit 0.3;
			} foreach [2,1000,1500,2350,2301];
		};
		case DIK_NUMPAD5: {
			[BIS_fnc_strategicMapOpen_mapCenter,1] spawn bis_fnc_strategicMapAnimate;
		};
	};
	false
};


_map = _display displayctrl 51;
_map ctrlmapanimadd [0,_scale,_mapCenter];
ctrlmapanimcommit _map;
BIS_fnc_strategicMapOpen_mapCenter = _mapCenter;

_map ctrladdeventhandler ["draw","_this call BIS_fnc_strategicMapOpen_draw;"];
_map ctrladdeventhandler ["mousemoving","_this call BIS_fnc_strategicMapOpen_mouse;"];
_map ctrladdeventhandler ["mouseholding","_this call BIS_fnc_strategicMapOpen_mouse;"];
_map ctrladdeventhandler ["mousebuttonclick","[nil,_this] spawn BIS_fnc_strategicMapMouseButtonClick;"];
_display displayaddeventhandler ["keydown","_this call BIS_fnc_strategicMapOpen_keyDown"];

if (_isNight) then {
	_map ctrlsetbackgroundcolor [0,0,0,1];
	_map ctrlcommit 0;
};

//--- Measure
[_display] spawn {
	disableserialization;
	_display = _this select 0;
	_showMiles = false;

	_map = _display displayctrl 51;
	waituntil {ctrlmapanimdone _map};

	_xStart = (_map ctrlmapworldtoscreen [0,0,0]) select 0;
	_xEnd = (_map ctrlmapworldtoscreen [1000,0,0]) select 0;
	_w1km = abs (_xstart - _xEnd);
	_w1m = _w1km * 1.60934;
	if !(_showMiles) then {_w1m = 0.01};
	_h = 0.01;

	_measure = _display displayctrl 2301;
	_measure ctrlsetposition [
		safezoneX + 0.02125,
		safezoneY + safezoneH - 3.5 * 0.04,
		1,
		_h * 5
	];
	//_measure ctrlsetfade 0.25;
	_measure ctrlcommit 0;
	_measure ctrlenable false;

	_colors = ["#(argb,8,8,3)color(0,0,0,1)","\A3\Ui_f\data\GUI\Rsc\RscDisplayStrategicMap\measure_ca.paa"];
	_kmSegment = _w1km / 5;
	for "_i" from 0 to 4 do {
		_km = _display displayctrl (1200 + _i);
		_km ctrlsettext (_colors select (_i % 2));
		_km ctrlsetposition [
			_w1m + _kmSegment * _i,
			_h,
			_kmSegment,
			_h
		];
		_km ctrlcommit 0;
	};

	_text_0 = _display displayctrl 1002;
	_text_0 ctrlsetposition [
		_w1m - _w1km,
		_h * 3,
		2 * _w1km,
		_h * 2
	];
	_text_0 ctrlcommit 0;
	_text_km = _display displayctrl 1004;
	_text_km ctrlsetposition [
		_w1m - _w1km + (safezoneH / 30),
		_h * 3,
		2 * _w1km,
		_h * 2
	];
	_text_km ctrlcommit 0;

	if (_showMiles) then {
		_m0 = _display displayctrl 1205;
		_m0 ctrlsettext "#(argb,8,8,3)color(1,1,1,1)";
		_m0 ctrlsetposition [
			0,
			_h,
			_w1m,
			_h
		];
		_m0 ctrlcommit 0;
		_text_m = _display displayctrl 1003;
		_text_m ctrlsetposition [
			0,
			_h * 3,
			2 * _w1m,
			_h * 2
		];
		_text_m ctrlcommit 0;
	};
};

//--- Show markers
{
	_x setmarkeralpha 1;
} foreach _markers;
BIS_fnc_strategicMapOpen_markers = _markers;

//--- Fade in
_fade = _display displayctrl 1099;
_fade ctrlsetfade 1;
_fade ctrlcommit 2;

//--- Create upward looking camera (increases FPS, as no scene is drawn)
BIS_fnc_strategicMapOpen_camera = if (count allmissionobjects "Camera" == 0) then {
	_camera = "camera" camcreate position player;
	_camera cameraeffect ["internal","back"];
	_camera campreparepos [position player select 0,position player select 1,(position player select 2) + 10];
	_camera campreparetarget [position player select 0,(position player select 1) + 1,(position player select 2) + 1000];
	_camera campreparefov 0.1;
	_camera camcommitprepared 0;
	_camera
} else {
	objnull
};

//--- Garbage collector
_display displayaddeventhandler [
	"unload",
	"
		{
			_x setmarkeralpha 0;
		} foreach BIS_fnc_strategicMapOpen_markers;

		BIS_fnc_strategicMapOpen_camera cameraeffect ['terminate','back'];
		camdestroy BIS_fnc_strategicMapOpen_camera;

		BIS_fnc_strategicMapOpen_camera = nil;
		BIS_fnc_strategicMapOpen_player = nil;
		BIS_fnc_strategicMapOpen_mapSize = nil;
		BIS_fnc_strategicMapOpen_mapCenter = nil;
		BIS_fnc_strategicMapOpen_isNight = nil;
		BIS_fnc_strategicMapOpen_ORBAT = nil;
		BIS_fnc_strategicMapOpen_ORBATOverlay = nil;
		BIS_fnc_strategicMapOpen_missions = nil;
		BIS_fnc_strategicMapOpen_markers = nil;
		BIS_fnc_strategicMapOpen_images = nil;
		BIS_fnc_strategicMapOpen_draw = nil;
		BIS_fnc_strategicMapOpen_clouds = nil;
		BIS_fnc_strategicMapOpen_mousePos = nil;
		BIS_fnc_strategicMapOpen_mouseClickDisable = nil;
		BIS_fnc_strategicMapOpen_selected = nil;
		BIS_fnc_strategicMapOpen_indexSizeTexture = nil;
		BIS_fnc_strategicMapOpen_indexTextureSize = nil;
		with uinamespace do {
			RscDisplayStrategicMap_scaleMin = nil;
			RscDisplayStrategicMap_scaleMax = nil;
			RscDisplayStrategicMap_scaleDefault = nil;

			RscDisplayStrategicMap_colorOutside_R = nil;
			RscDisplayStrategicMap_colorOutside_G = nil;
			RscDisplayStrategicMap_colorOutside_B = nil;
		};
	"
];

cuttext ["","black in"];
endloadingscreen;

_display};

 

init:

[] call compile preprocessFile "MyFunctions.sqf";

 

 

 

 

What's wrong with this?

Share this post


Link to post
Share on other sites

wierd, as far as i can see nothing, it should work! for some reason it isn't recognizing your function name?

 

the path for Myfucntions.sqf is right?

 

you can also load functions from the init.sqf, you can just paste them right in. this would at least test if there is a problem with function itself

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Ok, I paste the content of "MyFunction.sqf" (should be the function itself, right?) in the init.sqf, and it should open the map at mission start, right?

It does not.

 

Share this post


Link to post
Share on other sites

to paste it into the init just loads the function along with the other stuff in the init, it will still need to be called in mission same as before.

 

i'm starting to question myself now... am no expert! will see if i can put together working example to show what i mean

 

 

Share this post


Link to post
Share on other sites
Just now, lordfrith said:

it will still need to be called in mission same as before.

I did try to call it as before, but it gives me the same error.Really appreciate your help mate!!

Share this post


Link to post
Share on other sites

ok here's a link  for how to set this up, its small demo mission.

 

in mission the function is called from the trigger (radio channel)

  • Thanks 1

Share this post


Link to post
Share on other sites

you can also book a function like this in the init:

//[] call zagor64bz_fnc_test_Function1;
zagor64bz_fnc_test_Function1 = compile preprocessFileLineNumbers "Functions\fn_yourFunction.sqf";

personally I prefer to go through the description.ext:

https://community.bistudio.com/wiki/Functions_Library_(Arma_3)#Folder_Path

// Exemple:
// [] call zagor64bz_fnc_YourFunction_1
// [] call zagor64bz_fnc_YourFunction_2
// [] call zagor64bz_fnc_YourFunction_3

class CfgFunctions
{
	class zagor64bz
	{
		class Functions
		{
			file = "fnc";
			
			class YourFunction_1 {}; // fnc\fn_YourFunction_1.sqf
			class YourFunction_2 {}; // fnc\fn_YourFunction_2.sqf
			class YourFunction_3 {}; // fnc\fn_YourFunction_3.sqf
			
		};
	};
};

 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

OK..I GOT IT WORKING!!!

I feel dumb, but after looking at your function, I realize that the end of my script was wrong.

It was like this

];

cuttext ["","black in"];
endloadingscreen;

_display};

while it should have been:

];

cuttext ["","black in"];
endloadingscreen;

_display
};

 

THANK YOU. Now you can zoom in/out the strategic map.

Hopefully, it will be useful to other that want to have Strategic map zoom capabilities.

  • Like 3

Share this post


Link to post
Share on other sites

hmm, the slight format difference shouldn't change how it works, its just more human readable for big blocks of code so maybe there was something else resolved in the rewrite?

 

Anyway it works so all good :rthumb:

 

  • Like 2

Share this post


Link to post
Share on other sites

That's all I changed...but hey.....as you said.... it works..hahahahaha

Again, thank you.

Zagor out!

 

  • Haha 1

Share this post


Link to post
Share on other sites
4 hours ago, zagor64bz said:

Nope...it doesn't open the map...

Here is the error report:

 

4 hours ago, zagor64bz said:

Error position: <zag_fnc_mapsZoom;>

4 hours ago, zagor64bz said:

zag_fnc_mapZoom = { /*

 

Spelling mistake.

 

  • Thanks 3
  • Haha 1

Share this post


Link to post
Share on other sites

Thanks a lot for opening the tread and working on the solution, guys! :icon14:

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×