Honger/Sandbox – User

From Bohemia Interactive Community
Jump to navigation Jump to search


CfgWeaponCursors

CfgWeaponCursors is a class that can be defined in an addon's config file and is used to override default Arma 3 cursor/crosshair. It contains subclasses of weapon cursors that can be individual to each weapon type. These subclasses are as follows:

  • default - a base/core class of crosshair,
  • arifle - assault rifles
  • mg - machine guns
  • srifle - sniper rifles
  • smg - submachine guns
  • hgun - handguns
  • sgun - "special" guns for launcher slot.

Some modded weapons may have their own cursor types and will not take any data from the classes listed above.

Sections

Every weapon crosshair subclass consists of four sections - SectionLeft, SectionTop, SectionRight and SectionBottom. Each section displays the same texture provided for crosshair (so 4 times the same texture is displayed) and can be cropped using parameters

Crosshair texture should be a size of 128x128px in greyscale mode (AI88) and contain full image of crosshair, which will be cropped into four sections later. Weapon cursor is resized with interface size so make sure it's big enough to be visible in smallest UI size.

Config Example

class CfgWeaponCursors
{
	class default
	{
		texture = "#(argb,8,8,3)color(1,1,1,1)";
		color[] =
		{
			"(profilenamespace getvariable ['IGUI_TEXT_RGB_R', 0])",
			"(profilenamespace getvariable ['IGUI_TEXT_RGB_G', 1])",
			"(profilenamespace getvariable ['IGUI_TEXT_RGB_B', 1])",
			"(profilenamespace getvariable ['IGUI_TEXT_RGB_A', 0.8])"
		};
		fade = 0.41999999;
		fadeRatioDamage = 0.5;
		fadeRatioFatigue = 0.5;
		shadowEnabled = 0;
		class Sections
		{
		};
	};

	class arifle : default
	{
		texture = "\myCustomCrosshairPBO\texture\crosshairTexture.paa";
		class Sections
		{
			class SectionLeft
			{
				uMin = 0;
				uMax = 0.44999999;
				vMin = "0.5 - (1 / 2)";
				vMax = "0.5 + (1 / 2)";
				xOffset = -30;
				yOffset = 0;
			};

			class SectionTop
			{
				uMin = "0.5 - (1 / 2)";
				uMax = "0.5 + (1 / 2)";
				vMin = 0;
				vMax = 0.44999999;
				xOffset = 0;
				yOffset = -30;
			};

			class SectionRight
			{
				uMin = "1 - 0.45";
				uMax = "1 - 0";
				vMin = "0.5 - (1 / 2)";
				vMax = "0.5 + (1 / 2)";
				xOffset = 30;
				yOffset = 0;
			};

			class SectionBottom
			{
				uMin = "0.5 - (1 / 2)";
				uMax = "0.5 + (1 / 2)";
				vMin = "1 - 0.45";
				vMax = "1 - 0";
				xOffset = 0;
				yOffset = 30;
			};
		};
	};

	class mg : default
	{
		texture = "\myCustomCrosshairPBO\texture\crosshairTexture.paa"; // this can be a different PAA file if this gun type is supposed to have a different crosshair
		class Sections
		{
			class SectionLeft
			{
				uMin = 0;
				uMax = 0.44999999;
				vMin = "0.5 - (1 / 2)";
				vMax = "0.5 + (1 / 2)";
				xOffset = -30;
				yOffset = 0;
			};

			class SectionTop
			{
				uMin = "0.5 - (1 / 2)";
				uMax = "0.5 + (1 / 2)";
				vMin = 0;
				vMax = 0.44999999;
				xOffset = 0;
				yOffset = -30;
			};

			class SectionRight
			{
				uMin = "1 - 0.45";
				uMax = "1 - 0";
				vMin = "0.5 - (1 / 2)";
				vMax = "0.5 + (1 / 2)";
				xOffset = 30;
				yOffset = 0;
			};

			class SectionBottom
			{
				uMin = "0.5 - (1 / 2)";
				uMax = "0.5 + (1 / 2)";
				vMin = "1 - 0.45";
				vMax = "1 - 0";
				xOffset = 0;
				yOffset = 30;
			};
		};
	};

	class srifle : default
	{
		texture = "\myCustomCrosshairPBO\texture\crosshairTexture.paa";
		class Sections
		{
			class SectionLeft
			{
				uMin = 0;
				uMax = 0.44999999;
				vMin = "0.5 - (1 / 2)";
				vMax = "0.5 + (1 / 2)";
				xOffset = -30;
				yOffset = 0;
			};

			class SectionTop
			{
				uMin = "0.5 - (1 / 2)";
				uMax = "0.5 + (1 / 2)";
				vMin = 0;
				vMax = 0.44999999;
				xOffset = 0;
				yOffset = -30;
			};

			class SectionRight
			{
				uMin = "1 - 0.45";
				uMax = "1 - 0";
				vMin = "0.5 - (1 / 2)";
				vMax = "0.5 + (1 / 2)";
				xOffset = 30;
				yOffset = 0;
			};

			class SectionBottom
			{
				uMin = "0.5 - (1 / 2)";
				uMax = "0.5 + (1 / 2)";
				vMin = "1 - 0.45";
				vMax = "1 - 0";
				xOffset = 0;
				yOffset = 30;
			};
		};
	};

	class smg : default
	{
		texture = "\myCustomCrosshairPBO\texture\crosshairTexture.paa";
		class Sections
		{
			class SectionLeft
			{
				uMin = 0;
				uMax = 0.44999999;
				vMin = "0.5 - (1 / 2)";
				vMax = "0.5 + (1 / 2)";
				xOffset = -20;
				yOffset = 0;
			};

			class SectionTop
			{
				uMin = "0.5 - (1 / 2)";
				uMax = "0.5 + (1 / 2)";
				vMin = 0;
				vMax = 0.44999999;
				xOffset = 0;
				yOffset = -20;
			};

			class SectionRight
			{
				uMin = "1 - 0.45";
				uMax = "1 - 0";
				vMin = "0.5 - (1 / 2)";
				vMax = "0.5 + (1 / 2)";
				xOffset = 20;
				yOffset = 0;
			};

			class SectionBottom
			{
				uMin = "0.5 - (1 / 2)";
				uMax = "0.5 + (1 / 2)";
				vMin = "1 - 0.45";
				vMax = "1 - 0";
				xOffset = 0;
				yOffset = 20;
			};
		};
	};
	class hgun: default
	{
		texture = "\myCustomCrosshairPBO\texture\crosshairTexture.paa";
		class Sections
		{
			class SectionLeft
			{
				uMin = 0;
				uMax = 0.44999999;
				vMin = "0.5 - (1 / 2)";
				vMax = "0.5 + (1 / 2)";
				xOffset = -20;
				yOffset = 0;
			};

			class SectionTop
			{
				uMin = "0.5 - (1 / 2)";
				uMax = "0.5 + (1 / 2)";
				vMin = 0;
				vMax = 0.44999999;
				xOffset = 0;
				yOffset = -20;
			};

			class SectionRight
			{
				uMin = "1 - 0.45";
				uMax = "1 - 0";
				vMin = "0.5 - (1 / 2)";
				vMax = "0.5 + (1 / 2)";
				xOffset = 20;
				yOffset = 0;
			};

			class SectionBottom
			{
				uMin = "0.5 - (1 / 2)";
				uMax = "0.5 + (1 / 2)";
				vMin = "1 - 0.45";
				vMax = "1 - 0";
				xOffset = 0;
				yOffset = 20;
			};
		};
	};

	class sgun : default
	{
		texture = "\myCustomCrosshairPBO\texture\crosshairTexture.paa";
		class Sections
		{
			class SectionLeft
			{
				uMin = 0;
				uMax = 0.44999999;
				vMin = "0.5 - (1 / 2)";
				vMax = "0.5 + (1 / 2)";
				xOffset = -30;
				yOffset = 0;
			};

			class SectionTop
			{
				uMin = "0.5 - (1 / 2)";
				uMax = "0.5 + (1 / 2)";
				vMin = 0;
				vMax = 0.44999999;
				xOffset = 0;
				yOffset = -30;
			};

			class SectionRight
			{
				uMin = "1 - 0.45";
				uMax = "1 - 0";
				vMin = "0.5 - (1 / 2)";
				vMax = "0.5 + (1 / 2)";
				xOffset = 30;
				yOffset = 0;
			};

			class SectionBottom
			{
				uMin = "0.5 - (1 / 2)";
				uMax = "0.5 + (1 / 2)";
				vMin = "1 - 0.45";
				vMax = "1 - 0";
				xOffset = 0;
				yOffset = 30;
			};
		};
	};
};

class PreloadTextures
{
	class CfgWeaponCursors
	{
		class arifle	{ texture = "\myCustomCrosshairPBO\texture\crosshairTexture.paa"; };
		class srifle	{ texture = "\myCustomCrosshairPBO\texture\crosshairTexture.paa"; };
		class mg		{ texture = "\myCustomCrosshairPBO\texture\crosshairTexture.paa"; };
		class smg		{ texture = "\myCustomCrosshairPBO\texture\crosshairTexture.paa"; };
		class hgun		{ texture = "\myCustomCrosshairPBO\texture\crosshairTexture.paa"; };
		class sgun		{ texture = "\myCustomCrosshairPBO\texture\crosshairTexture.paa"; };
	};
};