Jump to content
Sign in to follow this  
CaponeSB

Intro text

Recommended Posts

Hello everybody. I found a lot of threads talking about this topic, but none of them helped me (prolly I'm making mistakes but I can't understand why..)

I just want a simple text (like the one in the campaign) showing at the bottom right of the screen when the mission starts.

Thanks in advance.

Share this post


Link to post
Share on other sites
Hello everybody. I found a lot of threads talking about this topic, but none of them helped me (prolly I'm making mistakes but I can't understand why..)

I just want a simple text (like the one in the campaign) showing at the bottom right of the screen when the mission starts.

Thanks in advance.

There is a module called "Mission Name", at least i think that what it was. Anyway that should give you what you are looking for.

Share this post


Link to post
Share on other sites

Thanks a lot, didn't notice it. But how can I use more of them? I mean, I made 3 modules, linked to 3 different triggers with different countdowns in order to have a sequence, but it just shows me the latest that has been put in the editor..

Share this post


Link to post
Share on other sites

If you want it exactly how it's done in the campaign, here are two methods. Unfortunately as far as I can see, BIS didn't include these functions in the function library, so you'll have to create your own. They are fnc_SITREP and fnc_showOSD. They both display lines of information in the lower right corner. SITREP shows the date, then whatever lines of custom text you want under that. showOSD doesn't require any parameters - it automatically shows the time, date and location on BIS islands.

First, copy these into script files with the filenames shown and place them in a folder named functions in your mission folder.

fn_SITREP.sqf

_this spawn {
private ["_text"];
_text = _this;

// Compile date
private ["_month", "_day", "_hour", "_minute"];
_month = str (date select 1);
_day = str (date select 2);
_hour = str (date select 3);
_minute = str (date select 4);

if (date select 1 < 10) then {_month = format ["0%1", str (date select 1)]};
if (date select 2 < 10) then {_day = format ["0%1", str (date select 2)]};
if (date select 3 < 10) then {_hour = format ["0%1", str (date select 3)]};
if (date select 4 < 10) then {_minute = format ["0%1", str (date select 4)]};

private ["_time", "_date"];
_time = format ["%1:%2", _hour, _minute];
_date = format ["%1-%2-%3", str (date select 0), _month, _day];

// Compile SITREP
private ["_SITREP"];
_SITREP = [
	[_date + " ", ""],
	[_time, "font = 'PuristaMedium'"]
];

if (count _text > 0) then {
	_SITREP = _SITREP + [["", "<br/>"]];
	{_SITREP = _SITREP + [_x]} forEach _text;
};

// Display SITREP
[
	_SITREP,
	safeZoneX - 0.01,
	safeZoneY + (1 - 0.125) * safeZoneH,
	true,
	"<t align = 'right' size = '1.0' font = 'PuristaLight'>%1</t>"
] spawn BIS_fnc_typeText2;
};

fn_showOSD.sqf:

/*
Author: Jiri Wainar

Description:
Display OSD with location, time and possibly some other campaign related info.

Parameter(s):
_this select 0: array (optional)	- position (default: player's position)
_this select 1: array (optional)	- date in format [_year,_month,_day,_hour,_min] (default: current date)

Example:
[] call BIS_fnc_camp_showOSD;

Returns:
- nothing -
*/

if (missionNamespace getVariable ["BIS_fnc_camp_showOSD__running",false]) exitWith {};

BIS_fnc_camp_showOSD__running = true;

private["_fn_getSector"];

_fn_getSector =
{
private["_map","_posX","_posY","_gridX","_gridY","_secWidth","_secHeight"];
private["_bottomLeftX","_bottomLeftY","_topRightX","_topRightY"];

_map = toLower worldName;

if !(_map in ["altis","stratis"]) exitWith
{
	-1
};

if (_map == "stratis") then
{
	_bottomLeftX = 1302;
	_bottomLeftY = 230;
	_topRightX   = 6825;
	_topRightY   = 7810;
}
else
{
	_bottomLeftX = 1765;
	_bottomLeftY = 4639;
	_topRightX   = 28624;
	_topRightY   = 26008;
};

_posX = _this select 0;
_posY = _this select 1;

//check if player is outside the map grid
if !(_posX > _bottomLeftX && _posX < _topRightX && _posY > _bottomLeftY && _posY < _topRightY) exitWith
{
	0
};

//offset player pos to [0,0]
_posX      = _posX - _bottomLeftX;
_posY      = _posY - _bottomLeftY;

_secWidth  = (_topRightX - _bottomLeftX)/3;
_secHeight = (_topRightY - _bottomLeftY)/3;

_gridX = floor (_posX/_secWidth);
_gridY = floor (_posY/_secHeight);

((_gridY * 3) + _gridX + 1)
};


private["_position","_date","_output","_showDate","_showLocation","_showMap"];
private["_tLoc","_tMap","_tDate","_tTime","_tTimeH","_tTimeM","_tDay","_tMonth","_tYear"];

_showDate 	= true;


_position  	= [_this, 0, getPos player, [[]]] call BIS_fnc_param;
_date 	   	= [_this, 1, date, [[]]] call BIS_fnc_param;
_tMap		= [_this, 2, "auto", [""]] call BIS_fnc_param;
_tLoc		= [_this, 3, "auto", [""]] call BIS_fnc_param;

//safecheck _date to make sure no values are out of boundries
_date = _date call BIS_fnc_fixDate;

if (_tMap != "") then
{
_showMap = true;
}
else
{
_showMap = false;
};

if (_tLoc != "") then
{
_showLocation = true;
}
else
{
_showLocation = false;
};

//get map text
if (_showMap && _tMap == "auto") then
{
private["_sector","_map","_template"];

_sector = _position call _fn_getSector;

if (_sector == -1) then
{
	["Map not recognized! Only 'Altis' and 'Stratis' are supported."] call BIS_fnc_error;

	_showMap 	= false;
	_showLocation 	= false;
};

_map = gettext (configfile >> "cfgworlds" >> worldname >> "description");

_template = switch (_sector) do
{
	case 7: {localize "STR_A3_SectorNorthWest"};
	case 8: {localize "STR_A3_SectorNorth"};
	case 9: {localize "STR_A3_SectorNorthEast"};
	case 4: {localize "STR_A3_SectorWest"};
	case 5: {localize "STR_A3_SectorCentral"};
	case 6: {localize "STR_A3_SectorEast"};
	case 1: {localize "STR_A3_SectorSouthWest"};
	case 2: {localize "STR_A3_SectorSouth"};
	case 3: {localize "STR_A3_SectorSouthEast"};

	default
	{
		_showLocation = false;

		//hardcoded for Stratis and Altis only
		if (worldname == "Stratis") then
		{
			localize "STR_A3_NearStratis"
		}
		else
		{
			localize "STR_A3_NearAltis"
		};
	};
};

_tMap = format[_template,_map];
};

//get current location text
if (_showLocation && _tLoc == "auto") then
{
private["_locations","_loc"];

_locations = nearestLocations [getPos player, ["NameCity","NameCityCapital","NameLocal","NameMarine","NameVillage"], 500];

//filter-out locations without names
{
	if (text _x == "") then
	{
		locations set [_forEachIndex, objNull];
	};
}
forEach _locations; _locations = _locations - [objNull];

if (count _locations > 0) then
{
	_loc = _locations select 0;

	if ((getPos player) in _loc) then
	{
		_tLoc  = text _loc;
	}
	else
	{
		_tLoc = format[localize "STR_A3_NearLocation", text _loc];		//tolocalize: "Poblíž lokace %1"
	};
}
else
{
	_tLoc = "";
	_showLocation = false;
};
};

//get daytime data
_tYear 	= _date select 0;
_tMonth = _date select 1;
_tDay 	= _date select 2;

if (_tMonth < 10) then {_tMonth = format["0%1",_tMonth]};
if (_tDay < 10) then {_tDay = format["0%1",_tDay]};

//get date text
_tDate = format["%1-%2-%3 ",_tYear,_tMonth,_tDay];

//get time text
_tTimeH = _date select 3;
_tTimeM = _date select 4;

if (_tTimeH < 10) then {_tTimeH = format["0%1",_tTimeH]};
if (_tTimeM < 10) then {_tTimeM = format["0%1",_tTimeM]};

_tTime = format["%1:%2",_tTimeH,_tTimeM];

/*
A3 fonts:

PuristaLight
PuristaMedium
PuristaSemiBold
PuristaBold
*/


//sum the output params & print it
_output =
[
[_tDate,""],
[_tTime,"font='PuristaMedium'"],["","<br/>"]
];

if (_showLocation) then
{
_output = _output + [[toUpper _tLoc,""],["","<br/>"]];
};

if (_showMap) then
{
_output = _output + [[_tMap,""],["","<br/>"]];
};

private["_handle"];

//vertically align to cinematic border
_handle = [_output,safezoneX - 0.01,safeZoneY + (1 - 0.125) * safeZoneH,true,"<t align='right' size='1.0' font='PuristaLight'>%1</t>"] spawn BIS_fnc_typeText2;

waitUntil
{
scriptDone _handle;
};

BIS_fnc_camp_showOSD__running = false;

Then copy this into your description.ext:

class CfgFunctions {
class TAG {
	class MISSION_NAME {

		class sitrep		{ file = "functions\fn_SITREP.sqf"; };
		class osd		        { file = "functions\fn_showOSD.sqf"; };

	};
};
};

To use:

//--- SITREP, shows time and date then your own custom text
[
   ["NEAR CAMP ROGAIN", ""], ["", "<br/>"],   
   ["NORTHERN STRATIS",""]  

] call TAG_fnc_SITREP;

//--- showOSD, shows date, time and location automatically
[] call TAG_fnc_OSD;

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
Sign in to follow this  

×