Jump to content
Neviothr

Help with custom NVG lens

Recommended Posts

I'm trying to replace the lens on the night vision devices with a smaller one, a smaller hole to look through if you will. Currently, I have the next, it creates a set of NVGs, with the default, sand colored model, but every time I equip them in I get an error along the lines of object lens.paa couldn't be loaded.

 

On a side note - the .paa file was taken from another mod, converted into .png using TexView, edited, and then converted back into .paa using - again - TexView.

This is how the config.cpp looks like:

class CfgPatches
{
	class cx_nvg
	{
		units[]={};
		weapons[]={};
		requiredVersion=1.0;
		requiredAddons[]={"A3_Weapons_F"};
	};
};

class CfgWeapons
{
 class Binocular;
 class NVGoggles
 {
  displayName = "Custom NVGs";
  modelOptics =" \cx_nvg\lens.paa";
  class ItemInfo
  {
	mass = 1;
  };
 };
};

Share this post


Link to post
Share on other sites

Model optics needs to be a P3D (model) file not a .paa (texture) file. The key is in the name ;)

 

Check out the ArmA2 Sample Models and modify the nvg_optics.p3d from the archive to use the new texture in place of the old black surround.

  • Like 1

Share this post


Link to post
Share on other sites

I'm not trying to change the 3D model of the NVGs, I'm trying to change the overlay that appears when you toggle them.

 

I followed your tip and downloaded both A2SM_Data_APL.zip and A2SM_Data_APL-SA.zip from here, they did not contain a file called nvg_optics.p3d.

Edited by cx64

Share this post


Link to post
Share on other sites

Well apparently, for some stupid reason, that file IS indeed a .p3d. I tried opening the once from the mods I downloaded using Oxygen 2 - but no luck, O2 isn't able to open binarized data.

Does anyone have a template?

Share this post


Link to post
Share on other sites

I got the filename incorrect in my previous reply, it should be:

ARMA_SampleVehiclesWeapons\weapons\optika_night.p3d

^ That's your templates...

  • Like 1

Share this post


Link to post
Share on other sites

Well, looks like I've reached another wall here. As seems that using the above config to create more then one NVG device isn't working.

The next only replaces the default, sand colored, BLUFOR NVGs with a one that's called Custom NVGs.

class CfgWeapons {
    class Binocular;
    class NVGoogles
    {
        class cx_pvs14 : NVGoggles {
            author = "cx64";
            modelOptics = "\cx_nvg\onetube";
            displayName = "PVS-14";
            Scope=2;
            ScopeCurator=2;
            class ItemInfo
            {
                mass = 1;
            };
        };

        class cx_pvs15 : NVGoggles {
            author = "cx64";
            modelOptics = "\cx_nvg\twotube";
            displayName = "PVS-15";
            Scope=2;
            ScopeCurator=2;
            class ItemInfo
            {
                mass = 1;
            };
        };
    };
};

Share this post


Link to post
Share on other sites

That code. Its broken....So very broken.

Your new classes are defined WITHIN the default NVG class. Either you're making a new class or making a replacement - your code is trying to do both but achieving neither.

 

If you simply want a replacement for default NVG optics, you need to choose one or the other:

class CfgWeapons 	
{	
	class Binocular;
	class NVGoggles: Binocular
	{   
		author = "cx64";
		displayName="Night-vision Goggles";
		nameSound="nvgoggles";
		simulation="NVGoggles";
		showEmpty=0;
		muzzlePos="usti hlavne";
		muzzleEnd="konec hlavne";
		value=5;
		opticsZoomMin=1;
		opticsZoomMax=1;
		modelOptics = "\cx_nvg\onetube"; // or twotube, whichever you decide is to be your replacement
		model="\A3\Weapons_f\binocular\nvg_proxy";
		picture="\A3\Weapons_F\Data\UI\gear_nvg_CA.paa";
		descriptionUse="Make something up for this shit as you wont have the BI stringtable...";
		visionMode[]=
		{
			"Normal",
			"NVG"
		};
		class Library
		{
			libTextDesc="Make something up for this shit as you wont have the BI stringtable...";
		};
		descriptionShort="Make something up for this shit as you wont have the BI stringtable...";
		class ItemInfo
		{
			type=616;
			uniformModel="A3\weapons_f\binocular\nvg_proxy.p3d";
			modelOff="A3\weapons_f\binocular\NVG_proxy_off.p3d";
			mass=1; // seems ridiculously light considering the default is 20, but whatever
		};
	};
};

or if you want to create new classes do it like this:

class CfgWeapons 	
{	
	class Binocular;
	class NVGoggles; // lol, I fixed your typo

	class cx_pvs14 : NVGoggles 
	{
		author = "cx64";
		modelOptics = "\cx_nvg\onetube";
		displayName = "PVS-14";
		scope=2;
		scopeCurator=2;

		class ItemInfo: ItemInfo // You want to inherit everything else from the default NVGs, without this class structure your nvgs will go into binocular slot because reasons
		{
			mass = 1; // seems a little low TBH considering default nvgs are 20, but whatever
		};
        };

        class cx_pvs15 : NVGoggles 
	{
		author = "cx64";
		modelOptics = "\cx_nvg\twotube";
		displayName = "PVS-15";
		scope=2;
		scopeCurator=2;

		class ItemInfo: ItemInfo
		{
                	mass = 1;
		};
	};
};

  • Like 1

Share this post


Link to post
Share on other sites

Jackal saves me again, thank you!

  • Like 1

Share this post


Link to post
Share on other sites

Whoops, my bad.

Try this:

class CfgWeapons 	
{	
	class Binocular;
	class NVGoggles
	{
		class ItemInfo;
        };

	class cx_pvs14: NVGoggles 
	{
		author = "cx64";
		modelOptics = "\cx_nvg\onetube";
		displayName = "PVS-14";
		scope=2;
		scopeCurator=2;

		class ItemInfo: ItemInfo // You want to inherit everything else from the default NVGs, without this class structure your nvgs will go into binocular slot because reasons
		{
			mass = 1; // seems a little low TBH considering default nvgs are 20, but whatever
		};
        };

        class cx_pvs15: NVGoggles 
	{
		author = "cx64";
		modelOptics = "\cx_nvg\twotube";
		displayName = "PVS-15";
		scope=2;
		scopeCurator=2;

		class ItemInfo: ItemInfo
		{
                	mass = 1;
		};
	};
};
  • Like 1

Share this post


Link to post
Share on other sites

The above still only creates a single pair of NVG called Custom NVGs.

Share this post


Link to post
Share on other sites

I'm not going to lie, when I wrote that code I did it in a 5-minute whirl in Notepad without really checking it. However, I don't see any reason why it wouldn't work, or why they'd be called "Custom NVGs" when neither of them are named that in the config.

 

I'll post below the code from part of the pack my community uses (which definitely works!) and you can (maybe) adapt it to suit your needs.

class cfgWeapons
{
	class NVGoggles;
	class SSQN_ANPVS14: NVGoggles
	{
		author = "S Squadron";
		DLC = "SSQN";
		model = "\SSQN_Equipment\Data\NVGs\ANPVS_14_DOWN.p3d";
		picture = "\SSQN_Equipment\Data\inv\ico_anpvs14.paa";
		displayName = "AN/PVS 14";
		class ItemInfo
		{
			type=616;
			uniformModel = "\SSQN_Equipment\Data\NVGs\ANPVS_14_DOWN.p3d";
			modelOff = "\SSQN_Equipment\Data\NVGs\ANPVS_14_UP.p3d";
			mass=20;
		};
	};

	class SSQN_ANPVS15: SSQN_ANPVS14
	{
		author = "S Squadron";
		DLC = "SSQN";
		model = "\SSQN_Equipment\Data\NVGs\ANPVS_15_DOWN.p3d";
		picture = "\SSQN_Equipment\Data\inv\ico_anpvs15.paa";
		displayName = "AN/PVS 15";
		class ItemInfo: ItemInfo
		{
			uniformModel = "\SSQN_Equipment\Data\NVGs\ANPVS_15_DOWN.p3d";
			modelOff = "\SSQN_Equipment\Data\NVGs\ANPVS_15_UP.p3d";
		};
	};

	class SSQN_ANPVS21: SSQN_ANPVS14
	{
		author = "S Squadron";
		DLC = "SSQN";
		model = "\SSQN_Equipment\Data\NVGs\ANPVS_21_DOWN.p3d";
		picture = "\SSQN_Equipment\Data\inv\ico_anpvs15.paa";
		displayName = "AN/PVS 21";
		class ItemInfo: ItemInfo
		{
			uniformModel = "\SSQN_Equipment\Data\NVGs\ANPVS_21_DOWN.p3d";
			modelOff = "\SSQN_Equipment\Data\NVGs\ANPVS_21_UP.p3d";
		};
	};
};
  • Like 1

Share this post


Link to post
Share on other sites

It's working, it's working!! Thank you so much!!

  • 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

×