Jump to content
Sign in to follow this  
AveryTheKitty

How to use ORBAT Groups like in campaign and another question.

Recommended Posts

If you have played the campaign on Development Branch, you probably know that you can click on the markers and it will bring up a tab with Task Force Aegis or Falcon and such. How does one do this?

And secondly, where do you or how do you find the function/script used in the beginning of each mission in the campaign that states information like the time and location?

Thanks.

Share this post


Link to post
Share on other sites

Currently there is no documentation on the ORBAT feature, it will come later. In the meantime the best is unPBO the campaign and learn by yourself. If I find how to do it I'll report here.

EDIT: Here's the campaign files.

Edited by HKFlash

Share this post


Link to post
Share on other sites

is the campaign pbo available anywhere? Or do I have to use the dev build

Share this post


Link to post
Share on other sites
is the campaign pbo available anywhere? Or do I have to use the dev build

You have to use dev.

Share this post


Link to post
Share on other sites
What about this?

This is a really cool function, because it automatically displays the time, date and your location without any input needed from you. It gets any landmarks near your position and displays that as your location. So if you're in the middle of camp Maxwell, it will display 'Camp Maxwell'. If you're on the road near camp maxwell, it will display 'Near Camp Maxwell', then your location on the island.

There's a bug in it somewhere though; your position on the island isn't always correct, as in the above screenshot - it says 'North-west Stratis', but LZ Connor is in the South.

The function isn't integrated into the functions library, so you'll have to add it to your mission:

/*
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 -
*/

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;

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 1: {localize "STR_A3_SectorNorthWest"};
	case 2: {localize "STR_A3_SectorSouth"};
	case 3: {localize "STR_A3_SectorSouthEast"};
	case 4: {localize "STR_A3_SectorWest"};
	case 5: {localize "STR_A3_SectorCentral"};
	case 6: {localize "STR_A3_SectorEast"};
	case 7: {localize "STR_A3_SectorNorthWest"};
	case 8: {localize "STR_A3_SectorNorth"};
	case 9: {localize "STR_A3_SectorNorthEast"};

	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];


//sum the output params & print it
_output =
[
[_tDate,"<t size='1.0' font='PuristaMedium'>%1</t>",0],
[_tTime,"<t size='1.0' font='PuristaBold'>%1</t><br/>",5]
];

if (_showLocation) then
{
_output = _output + [[toUpper _tLoc,"<t size='0.9' font='PuristaBold'>%1</t><br/>",5]];
};

if (_showMap) then
{
_output = _output + [[_tMap,"<t size='0.9'>%1</t><br/>",30]];
};

[_output,-safezoneX,0.85,"<t color='#FFFFFFFF' align='right'>%1</t>"] spawn BIS_fnc_typeText;

You can make it work in your mission by putting the following in your decription.ext:

class CfgFunctions {
class [color="#FF0000"]TAG[/color] {
	class MyMission {
		class [color="#0000FF"]showOSD[/color] { file = "[b][color="#FF8C00"]fn_showOSD.sqf[/color][/b]"; };

	};
};
};

So, with the function in your mission folder named fn_showOSD.sqf you could call it in the mission like this:

[] call [color="#FF0000"]TAG[/color]_fnc_[color="#0000FF"]showOSD[/color];

Share this post


Link to post
Share on other sites

Thank you so much!

EDIT: Sorry, I'm very new to scripting. Where do I place the function?

I made a folder already called "functions" and placed it there, but when I loaded up my mission it said "OA_fnc_showOSD.sqf now found". Please help.

---------- Post added at 11:49 PM ---------- Previous post was at 11:11 PM ----------

And one last question before I have to sign off.

I have a helicopter carrying the player over to a military base, which will then drop off the player and fly away. How would I make that function using a trigger trip only when the player hops out?

Thanks.

Edited by Nightmare515

Share this post


Link to post
Share on other sites

If it's in a folder named functions in your mission folder, code should be as follows:

class CfgFunctions {
class TAG {
	class MyMission {
		class showOSD { file = "functions\fn_showOSD.sqf"; };

	};
};
};

Share this post


Link to post
Share on other sites

It's still saying it's not found.

---------- Post added at 07:05 PM ---------- Previous post was at 07:04 PM ----------

I'm also having this problem with images and videos too. :(

---------- Post added at 07:16 PM ---------- Previous post was at 07:05 PM ----------

Turns out the function wasn't named correctly. Derp.

Share this post


Link to post
Share on other sites

I have a helicopter carrying the player over to a military base, which will then drop off the player and fly away. How would I make that function using a trigger trip only when the player hops out?

vehicle player != choppername

Maybe with a distance check to a marker at the base as well

(vehicle player != choppername) and ((player distance getMarkerPos "base") < 50)

Edited by 2nd Ranger

Share this post


Link to post
Share on other sites

It looks like this function only works on Altis and Stratis but on mod maps it will still show time so can it be edited to only show time and cut out the "not stratis or Altis" error?

/*
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 -
*/

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;

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 1: {localize "STR_A3_SectorNorthWest"};
	case 2: {localize "STR_A3_SectorSouth"};
	case 3: {localize "STR_A3_SectorSouthEast"};
	case 4: {localize "STR_A3_SectorWest"};
	case 5: {localize "STR_A3_SectorCentral"};
	case 6: {localize "STR_A3_SectorEast"};
	case 7: {localize "STR_A3_SectorNorthWest"};
	case 8: {localize "STR_A3_SectorNorth"};
	case 9: {localize "STR_A3_SectorNorthEast"};

	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];


//sum the output params & print it
_output =
[
[_tDate,"<t size='1.0' font='PuristaMedium'>%1</t>",0],
[_tTime,"<t size='1.0' font='PuristaBold'>%1</t><br/>",5]
];

if (_showLocation) then
{
_output = _output + [[toUpper _tLoc,"<t size='0.9' font='PuristaBold'>%1</t><br/>",5]];
};

if (_showMap) then
{
_output = _output + [[_tMap,"<t size='0.9'>%1</t><br/>",30]];
};

[_output,-safezoneX,0.85,"<t color='#FFFFFFFF' align='right'>%1</t>"] spawn BIS_fnc_typeText;

I'm not a script wizard so I can only understand small parts of this code.

Any help would be great I think it is a very cool little function would love to use it on more maps.

EDIT.

Managed to make it stop checking for locations by simply changing a couple of the true/false values, now I just need to get the time to display a little longer.

The time comes in fine but i think once it finishes and hits the "false" to check for location it instantly disappears (process takes about 3 seconds from time in to instant disappear) which can be kind of jarring as well as not providing enough time to read time.

Edited by PenguinInATuxedo

Share this post


Link to post
Share on other sites

@PenguinInATuxedo Would be cool, if you would share what you changed.

I made it work for 20% of Clafghan. you only have to add :

if !(_map in ["altis","stratis","[color="#A52A2A"]clafghan[/color]"]) exitWith

When youre in a village you get the exact name and so on.

But when you´re outside you get an error and nothing works. So it would be great to know what you´ve changed.

Regards NIN3

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  

×