Jump to content
Sign in to follow this  
Delta Hawk

Adjustable sights for new weapons pack?

Recommended Posts

This might be a redundant question but how do you set up rifles and machine guns with adjustable sights using the page up and page down in the config file? I'm making a weapons pack for my Soldiers and Marines and it'll be much more accurate with adjustable sights. Thanks guys.

Share this post


Link to post
Share on other sites

Look into config files and find reference to a weapon that has zeroing, for instance the M24.

Share this post


Link to post
Share on other sites

Thanks Zelik for replying, but I've already looked into the config files. I've also looked at the weapons config reference in the BIS wiki and I can't find anything :( I'm sure it's something that I'm just not noticing but I can't find it.

Share this post


Link to post
Share on other sites

ok it's fairly simple actually, here goes:

this example is from our M14 and M21 in unsung mod

class cfgweapons
{
//add your parent entities here like 
//class rifle;
class Uns_Rifle762; //our external parent

class uns_m14: Uns_Rifle762
{
	scope = 2;
	value = 0;
	displayName = "M-14 Rifle";
	model = "\uns_weap2\m14\P85_m14";
	picture = "\uns_weap2\m14\w_m14.paa";
	UiPicture = "\CA\weapons\data\Ico\i_regular_CA.paa";
	magazines[] = {"uns_m14mag","uns_m14mag_T","uns_m14mag_NT"};
	optics = 1;
	drySound[] = {"\uns_weap\m14\m14_dry",0.00316228,1,10};
	reloadMagazineSound[] = {"\uns_weap\m14\m14_reload",0.0562341,1,20};
	handAnim[] = {"OFP2_ManSkeleton","\Ca\weapons\data\Anim\M24.rtm"};
//this bit creates your zeroing, with each number in the brackets (array) being the zeroed range
//the initindex is the number in the array that the rifle starts on when picked up, in this case 0 is 100m, cos we're in nam, you may want to set it to 2, or 300m for non jungle environments
[b]		weaponInfoType = "RscWeaponZeroing";
	discreteDistance[] = {100,200,300,400,500,600,700,800,900,1000};
	discreteDistanceInitIndex = 0;
[/b]
//deleted fire modes as not important here
};
class uns_M21: Uns_Rifle762
{
	scope = 2;
	displayName = "XM-21 Sniper Rifle";
	model = "\uns_weap2\m14\P85_m21";
	picture = "\uns_weap2\m14\w_m21.paa";
	UiPicture = "\CA\weapons\data\Ico\i_sniper_CA.paa";
	magazines[] = {"uns_m14mag","uns_m14mag_T","uns_m14mag_NT"};
	modelOptics = "\uns_weap2\m14\optika_m21";
	opticsFlare = 1;
	opticsDisablePeripheralVision = 1;
	opticsZoomMin = 0.05;
	opticsZoomMax = 0.1;
	distanceZoomMin = 300;
	distanceZoomMax = 300;
//ok so this rifle has a scope and an alt-optics, and each one has zeroing defined in in its mode
	class OpticsModes
	{
		class scope
		{
			opticsID = 1;
			useModelOptics = 1;
			opticsZoomInit = 0.1;
			opticsZoomMin = 0.04;
			opticsZoomMax = 0.1;
			distanceZoomMin = 300;//300
			distanceZoomMax = 300;
			opticsPPEffects[] = {"OpticsCHAbera1","OpticsBlur1"};
			opticsDisablePeripherialVision = 1;
			memoryPointCamera = "opticView";
			visionMode[] = {"Normal"};
			thermalMode[] = {0,4};
			opticsFlare = 1;
			cameraDir = "";
[b]				weaponInfoType = "RscWeaponZeroing";
			discreteDistance[] = {100,200,300,400,500,600,700,800,900,1000,1100,1200};
			discreteDistanceInitIndex = 1;[/b]
		};
		class Ironsights: scope
		{
			opticsID = 2;
			useModelOptics = 0;
			opticsFlare = 0;
			opticsDisablePeripherialVision = 0;
			opticsZoomMin = 0.25;
			opticsZoomMax = 1.1;
			opticsZoomInit = 0.5;
			memoryPointCamera = "eye";
			visionMode[] = {};
[b]				weaponInfoType = "RscWeaponZeroing";
			discreteDistance[] = {100,200,300,400,500,600,700,800,900,1000,1100,1200};
			discreteDistanceInitIndex = 0;
[/b]			};
	};
	soundContinuous = 0;
	sound[] = {"\uns_weap\m14\m14_fire",1.0,0.99,480};
	drySound[] = {"\ca\Weapons\Data\Sound\M21_dry_v1",0.000316228,1,10};
	reloadMagazineSound[] = {"\uns_weap\m14\m14_reload",0.0562341,1,20};
	minRange = 2;
	minRangeProbab = 0.1;
	midRange = 400;
	midRangeProbab = 0.7;
	maxRange = 600;
	maxRangeProbab = 0.01;
	dispersion = 0.001;
	autofire = 0;
	reloadTime = 0.1;
	backgroundReload = 1;
	recoil = "recoil_single_primary_6outof10";
	recoilProne = "recoil_single_primary_prone_5outof10";
	value = 1000;
	aiRateOfFire = 6;
	aiRateOfFireDistance = 800;
	handAnim[] = {"OFP2_ManSkeleton","\Ca\weapons\data\Anim\M24.rtm"};
//fire modes deleted to save space here
};
};

for a tank turret you need both the vehicle turret and the gun defined like this bmp 30mm cannon here

class cfgvehicles
{
//parent classes add
class BMP2_Base: Tracked_APC
{
	scope = 0;
	vehicleClass = "ArmouredW";
	displayName = "BMP2";
	model = "ca\Tracked_E\BMP\BMP2";
	picture = "\ca\tracked\Data\ico\bmp2_CA.paa";
	Icon = "\Ca\tracked\Data\map_ico\icomap_bmp2_CA.paa";
//etc
	class Turrets: Turrets
	{
		class MainTurret: MainTurret
		{
			weapons[] = {"EB_2A42","EB_PKT","EB_AT5LauncherSingle","LaserDesignator_mounted"};
			magazines[] = {"EB_RU_160Rnd_30mm_APDS","EB_RU_350Rnd_30mm_HEI","EB_2000Rnd_762x54_PKT","EB_8Rnd_AT5","Laserbatteries"};
			viewGunnerInExternal = 1;
			gunnerOpticsEffect[] = {"TankGunnerOptics1","OpticsBlur2","OpticsCHAbera2"};
			soundServo[] = {"\ca\sounds\vehicles\servos\turret-1",0.01,1,10};
			minElev = -4.5;
			maxElev = 74;
			minTurn = -360;
			maxTurn = 360;
			gunnerAction = "BMP2_GunnerOut";
			gunnerInAction = "BMP2_Gunner";
			gunnerGetInAction = "GetInMedium";
			gunnerGetOutAction = "GetOutMedium";
			forceHideGunner = 0;
			gunnerOpticsModel = "\ca\weapons\2Dscope_BMPgun";
			gunnerOutOpticsModel = "";
//copied weapon zeroing data values to the turret, just changed WeaponInfoType to TurretInfoType
[b]				TurretInfoType = "RscWeaponZeroing";
			discreteDistance[] = {250,500,750,1000,1250,1500,1750,2000,2500,3000};
			discreteDistanceInitIndex = 0;
[/b]
//etc
		};
	};
};
};

class cfgweapons
{
//parent classes add
class CannonCore;
class EB_2A42: CannonCore
{
	scope = 1;
	displayName = "2A42 30mm";
	nameSound = "cannon";
	magazines[] = {
	"EB_RU_160Rnd_30mm_HEI","EB_RU_230Rnd_30mm_HEI","EB_RU_250Rnd_30mm_HEI","EB_RU_300Rnd_30mm_HEI","EB_RU_350Rnd_30mm_HEI",
	"EB_RU_160Rnd_30mm_HET","EB_RU_230Rnd_30mm_HET","EB_RU_250Rnd_30mm_HET","EB_RU_350Rnd_30mm_HET",
	"EB_RU_160Rnd_30mm_APBC","EB_RU_230Rnd_30mm_APBC","EB_RU_250Rnd_30mm_APBC","EB_RU_350Rnd_30mm_APBC",
	"EB_RU_160Rnd_30mm_APDS","EB_RU_200Rnd_30mm_APDS","EB_RU_230Rnd_30mm_APDS","EB_RU_250Rnd_30mm_APDS","EB_RU_350Rnd_30mm_APDS",
	"EB_RU_160Rnd_30mm_APFSDST","EB_RU_230Rnd_30mm_APFSDST","EB_RU_200Rnd_30mm_APFSDST","EB_RU_250Rnd_30mm_APFSDST","EB_RU_350Rnd_30mm_APFSDST"
	};
	modes[] = {"LowROF","HighROF","close","short","medium","far"};
	shotFromTurret = 1;
	canLock = 2;
	cursor = "Vehicle_E_MG";
	cursorAim = "\ca\Weapons\Data\clear_empty";
	cursorSize = 1;
//weapon has ballistics computer = 2 AND weaponinfotype entry AND zeroing array AND init value

[b]		ballisticsComputer = 2;
	weaponInfoType = "RscWeaponZeroing";
	discreteDistance[] = {250,500,750,1000,1250,1500,1750,2000,2500,3000};
	discreteDistanceInitIndex = 0;
[/b]
};
};

Share this post


Link to post
Share on other sites

Eggbeast, you are the man. :yay: :yay: :yay:

I've never seen that anywhere at all. Thanks!

Share this post


Link to post
Share on other sites

i should also add that you can set the values to whatever you want. if you're in a vehicle, so long as the values match between turret and weapon then you're good to go

Share this post


Link to post
Share on other sites

Eggbeast, I really appreciate your help. I hate to ask, but I've ran into trouble with my grenades. I have them in my gear selection menu in game, but I can't switch to them and throw them. Can you glance at my code and see if I'm missing something? Do I need to create my own ammo class?

class CfgPatches
{
class usm_military_weapons
{
	magazines[] = 
	{
		"usm_m67",
		"usm_anm8",
		"usm_m18_yellow",
		"usm_m18_red",
		"usm_m18_green",
		"usm_m18_violet"
	};
};
};

class CfgMagazines
{
class Default;
class HandGrenade;
class usm_m67: HandGrenade
{
	scope = public;
	value = 1;
	displayName = "M67 Grenade";
	model = "us_military_weapons\usm_m67";
	picture="\CA\weapons\data\equip\m_M67_CA.paa";
	type = WeaponSlotItem;
	ammo = GrenadeHandTimedWest;
	descriptionShort = "Hand Grenade, Fragmentation, M67.  NSN 1330-00-133-8244.";
	count=1;
	initSpeed=22;
	nameSound="handgrenade";
	maxLeadSpeed = 7;
	sound[]={,db-70,1};		
};
class usm_anm8: usm_m67
{
	displayName = "AN-M8 Grenade";
	model = "us_military_weapons\usm_anm8";
	picture="\CA\weapons\data\equip\m_ANM8_white_ca.paa";
	value = 2;
	ammo = SmokeShell;
	nameSoundWeapon = "smokeshell";
	nameSound = "smokeshell";
	descriptionShort = "Hand Grenade, Smoke, AN-M8.  NSN 1330-00-219-8511.";
};
	class usm_m18_red: usm_anm8
{
	displayName = "M18 Red";
	model = "us_military_weapons\usm_m18_red";
	picture="\CA\weapons\data\equip\m_m18red_ca.paa";
	ammo = SmokeShellRed;
	descriptionShort = "Hand Grenade, Smoke, Red, M18.  NSN 1330-00-289-6852";
};

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  

×