Jump to content
Col. Akhanteros

Contact DLC-style map help

Recommended Posts

I'm trying to make a mission where one side has a standard-type topo map and the other has a map similar to

Spoiler

the first Contact DLC mission where there's just a shitty drawing in the map screen.

 

I'm not talking about

Spoiler

the scripted neutrino map or wavelength diagram, or even the topo map,

I'm talking about just having an image overlayed over the map. I can't firgure out how the hell to do this.

Can anyone help?

Share this post


Link to post
Share on other sites

Not sure about how Contact does it, as I have not played it yet.

There is this thread about overlaying an image on the map screen. Don't know if that helps you?

Share this post


Link to post
Share on other sites
18 hours ago, Larrow said:

Not sure about how Contact does it, as I have not played it yet.

There is this thread about overlaying an image on the map screen. Don't know if that helps you?

 

It looks like it does, thank you. Not sure exactly how to implement it though. Do you just stick this code (from your post in that thread) in the .init?

addMissionEventHandler [ "Map", {
	params ["_mapIsOpened", "_mapIsForced"];

	_briefingBackground = findDisplay 12 displayCtrl 1102;
	_briefingPicture = findDisplay 12 displayCtrl 1101;

	if ( _mapIsOpened ) then {
		_briefingBackground ctrlShow true;
		_briefingBackground ctrlSetBackgroundColor[ 0.161, 0.388, 0.576, 1 ];
		_briefingPicture ctrlShow true;
		_briefingPicture ctrlSetText "images\blueprints.paa";
	};
}];

It doesn't look like you can adjust the size of it with just that, though.

 

Do you also have to stick this in there as well or something? (that's from the original post)

_x = SafeZoneXAbs;
	_y = SafeZoneY + 1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25);
	_w = SafeZoneWAbs;
	_h = SafeZoneH - 1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25);
	/*
	_ctrl = (findDisplay 12) ctrlCreate ["ControlsBackground", 1000];
	_ctrl ctrlSetPosition [_x, _y, _w, _h];
	_ctrl ctrlSetText "";
	_ctrl ctrlCommit 0; 

	_ctrl2 = (findDisplay 12) ctrlCreate ["RscPicture",1001, ((findDisplay 12) displayCtrl 1000)];
	_ctrl2 ctrlSetPosition [_x, _y, _w, _h];
	_ctrl2 ctrlSetText "media\img\splashscreen1.paa";
	_ctrl2 ctrlCommit 0; 

 

Sorry for my incompetence; my coding knowledge is limited.

Share this post


Link to post
Share on other sites
5 hours ago, Col. Akhanteros said:

Not sure exactly how to implement it though. Do you just stick this code (from your post in that thread) in the .init?

I would put it on initPlayerLocal.sqf as you only want to know when a player opens their map. Then you can also add a condition of the players side for which players get the image, as you mention different style maps for different player sides.

 

5 hours ago, Col. Akhanteros said:

It doesn't look like you can adjust the size of it with just that, though.

It is currently the size of the screen. As commented in that thread the control is a RscPictureKeepAspect, which means the image will be scaled to fit inside the control keeping its aspect ratio. So no matter how you resize it (controlSetPosition) the image will be scaled to fit in the control keeping its aspect ratio the same.

Thats why in that thread in my second post I suggest resizing the image and using the other control, which lies behind the picture, to obscure the map. i.e I suggested making the image 16:9 and turning the text controls background colour blue to match @Mr H. pictures paper colour.

  • Like 2

Share this post


Link to post
Share on other sites
10 hours ago, Larrow said:

I would put it on initPlayerLocal.sqf as you only want to know when a player opens their map. Then you can also add a condition of the players side for which players get the image, as you mention different style maps for different player sides.

 

It is currently the size of the screen. As commented in that thread the control is a RscPictureKeepAspect, which means the image will be scaled to fit inside the control keeping its aspect ratio. So no matter how you resize it (controlSetPosition) the image will be scaled to fit in the control keeping its aspect ratio the same.

Thats why in that thread in my second post I suggest resizing the image and using the other control, which lies behind the picture, to obscure the map. i.e I suggested making the image 16:9 and turning the text controls background colour blue to match @Mr H. pictures paper colour.

 

Ah, OK. So your line of code—correct me if I'm wrong—appears to function this way:

 

1: An "event handler" is added for the map, which I assume means the script will define the forthcoming code as stuff related to the map screen.

2: Parameters defined, might have something to do with the "event handler" syntax?

3: "_briefingBackground" is defined as a number equal to the "IDD" (whatever that means) of the map screen, which is 12, then "displayCtrl" does some gypsy magic with some numbers.

4: The same thing is done for "_briefingPicture" but with a different "displayCtrl" number.

5: "If" statement for the "_mapIsOpened" parameter shows the "_briefingBackground" and "_briefingPicture" with their respective colour/texture whenever the map is open (I suppose the background could have its own texture! I'll have to play with that).

It doesn't look as if the UI of the picture and background stays up after the map closes or new pictures are stacked every time the map opens. Maybe it does, but it looks more like it just shows the picture/background every time the "if" statement is satisfied (that's a good thing, I'm just thinking "out loud" with text).

 

 

So if one wants to have a custom map, "images\opformap.paa" for OPFOR and another custom map, "images\bluformap.paa" for BLUFOR, all with a grey background, then then one would put the following in the initPlayerLocal.sqf:

addMissionEventHandler [ "Map", {
	params ["_mapIsOpened", "_mapIsForced"];

	_briefingBackground = findDisplay 12 displayCtrl 1102;
	_briefingPicture = findDisplay 12 displayCtrl 1101;

if (side player == west) then {
		if ( _mapIsOpened ) then {
			_briefingBackground ctrlShow true;
			_briefingBackground ctrlSetBackgroundColor[ 0.5, 0.5, 0.5, 1 ];
			_briefingPicture ctrlShow true;
			_briefingPicture ctrlSetText "images\bluformap.paa";
		};
	};
if (side player == east) then {
		if ( _mapIsOpened ) then {
			_briefingBackground ctrlShow true;
			_briefingBackground ctrlSetBackgroundColor[ 0.5, 0.5, 0.5, 1 ];
			_briefingPicture ctrlShow true;
			_briefingPicture ctrlSetText "images\opformap.paa";
		};
}];

 

EDIT: The above script works great. Thanks for your help, I appreciate it.

Edited by Col. Akhanteros
It freakin works dude

Share this post


Link to post
Share on other sites

Usually when @Larrow gives you an answer, it works 😉

Share this post


Link to post
Share on other sites

1. Yes when something happens to the map( opened or closed ) the code given to the event will run.

2. Yes the params( _mapIsOpened _mapIsForced ) are passed automatically to the code by the event.

3. _briefingBackground is a reference to a control that exists in the map UI. Display 12 is the map UI, displayCtrl 1101 is a picture control in the map UI and displayCtrl 1102 is a text control in the map UI. These two controls I believe are used for intros, but we are hijacking them for our own use during the mission. During a mission they are usually hidden and is why we apply ctrlShow true to them.

5.

15 hours ago, Col. Akhanteros said:

I suppose the background could have its own texture!

Unfortunately no, the other control is a Rsctext control and would not take an image. You can fill it with text or colour its background.

 

16 hours ago, Col. Akhanteros said:

It doesn't look as if the UI of the picture and background stays up after the map closes or new pictures are stacked every time the map opens. Maybe it does, but it looks more like it just shows the picture/background every time the "if" statement is satisfied (that's a good thing, I'm just thinking "out loud" with text).

When the map is closed the map UI is hidden, this includes all the controls that exist within the UI. The changes to the two map UI controls actually persist, but it does not hurt to keep applying them on map open.

 

Spoiler

addMissionEventHandler [ "Map", {
	params ["_mapIsOpened", "_mapIsForced"];

	if ( _mapIsOpened ) then {
		
		//Get Text control
		_briefingBackground = findDisplay 12 displayCtrl 1102;
		//Set its background color
		_briefingBackground ctrlSetBackgroundColor[ 0.5, 0.5, 0.5, 1 ];
		//Make it visible
		_briefingBackground ctrlShow true;
		
		//Get Picture control
		_briefingPicture = findDisplay 12 displayCtrl 1101;
		
		//Set picture based on players side
		if (playerSide == west) then {
			_briefingPicture ctrlSetText "images\bluformap.paa";
		};
		if (playerSide == east) then {
			_briefingPicture ctrlSetText "images\opformap.paa";
		};
		
		//Make it visible
		_briefingPicture ctrlShow true;
	};
}];

 

 

  • 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

×