Jump to content

Recommended Posts

Hello folks,
I'm having real problems with a project.
Unfortunately I have to admit that I am a real noob when it comes to scripting.
The project is an xm7 with the xm157 visor.
For the aiming optics I use “xm157_info_type” from the Ace.
Unfortunately this is not very good when it comes to close combat.
So my idea was to convert the optics into a 3d sight. Like in the RHS MOD ( big fan ).
but the conversion was so extensive that it is now necessary to change the model, if you are in the CameraView==“GUNNER”, and in the correct OpticsMode 0= “DOT” the complete model must be exchanged for another.

My previous procedure is really bad.

https://drive.google.com/file/d/1eie9dWsaiKda1dDxvRLUxhhMw9ibzOqJ/view
https://drive.google.com/file/d/1X4pmTKe3GFQBQud29DaoPUl1Yc-Yrvxq/view

Class CfgFunctions

class CfgFunctions //eigene Klasse in der config.cpp 
	{
			class abw 
			{
				tag = abw;
				
				class functions 
				{
					class checkoptik 
					{
						file = "abw\scripts\abw_checkoptik.sqf";
						description = "Handling of prefered optic changing";
					}; 

				};
			};
	};
	
class RscInGameUI  
	{
			class RscUnitInfo;	// External class reference
			class RscWeaponZeroing;	// External class reference
			class abw_01_xm157  : RscWeaponZeroing 
				{
					onLoad = "['onLoad',_this,'RscUnitInfo','IGUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay');[] call abw_fnc_checkoptik";
				};

	};

cfgWeapons  class of the XM157

	class ItemCore;
	class InventoryOpticsItem_Base_F;
	
	class XM157: ItemCore
		{
			displayName = "XM157";
			descriptionShort = "Fire Control Systems<br />Magnification: 8x";
			scope = 2;
			author = "101stAB Frankyman";
			model = "abw\xm157\XM157";
			picture = "abw\ui\xm157ui_ca";
			inertia = 0.3;
			class CBA_ScriptedOptic
				{
					bodyTexture = "abw\xm7Tex\ace_vector_body_co";
					bodyTextureSize = 1;
					minMagnificationReticleScale[] = {1,"5*1.026"};
					maxMagnificationReticleScale[] = {8,"5*1.026"};
					hideMagnification = 1;
					disableTilt = 0;
				};
			ACE_ScopeHeightAboveRail = 5.54325;
			discretedistance[] = {100,200,300,400,500,600,700,800,900,1000};
			weaponInfoType = "abw_01_xm157";
			class ItemInfo: InventoryOpticsItem_Base_F
				{
					mass = 10;
					scope = 2;
					optics = 1;
					modelOptics = "\x\cba\addons\optics\cba_optic_big_100";
					class OpticsModes
					{
						class optic
						{
							opticsID = 1;
							useModelOptics = 1;
							opticsPPEffects[] = {"OpticsCHAbera1","OpticsBlur1"};
							opticsZoomMin = 0.03125;
							opticsZoomMax = 0.25;
							opticsZoomInit = 0.25;
							discreteDistance[] = {100,200,300,400,500,600,700,800,900,1000};
							discreteDistanceInitIndex = 1;
							distanceZoomMin = 100;
							distanceZoomMax = 1000;
							memoryPointCamera = "opticView";
							visionMode[] = {};
							opticsFlare = 1;
							opticsDisablePeripherialVision = 1;
							cameraDir = "";
						};
						class RedDot
						{
							opticsID = 2;
							useModelOptics = 0;
							opticsPPEffects[] = {""};
							opticsFlare = 0;
							opticsDisablePeripherialVision = 0;
							opticsZoomMin = 0.375;
							opticsZoomMax = 1;
							opticsZoomInit = 0.75;
							memoryPointCamera = "eye";
							visionMode[] = {};
							distanceZoomMin = 100;
							distanceZoomMax = 100;
							
						};
					};
				};
				
		};
		class XM157_hide : XM157
		{
			scope = 1;
			model = "abw\xm157\XM157_un";
			weaponInfoType = "abw_01_xm157";
			class CBA_ScriptedOptic {};
		class OpticsModes 
						{
							class optic {};
							class RedDot {};
						};
		};
};

at the moment i would be really happy if at least the change of class “XM157” to “XM157”_hide and back again would work.
the whole thing should be solved via a function.

Ich konnte schon vor 10 Jahren, als ich nun Fahrzeuge für Arma2 gemacht habe, nicht skripten.
Die Zeit und einige gesundheitliche Probleme machten es nicht besser. deshalb schäme ich mich das skript zu posten.

		if (!isServer) then
		{
			while {true} do
			{
				disableSerialization;

				private _p = missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", player];
				if (((primaryWeaponItems _p) select 2) isEqualTo "XM157" && cameraView isEqualTo "GUNNER" && cameraOn _p && (player getOpticsMode 0) isEqualTo "RedDot") then
				{
					_p addPrimaryWeaponItem "XM157_hide";
					}, {exitWith}

					sleep 0.5;
				};
				
				};

I am open to all ideas.
another possibility would be PIP . but when I looked at the code for it and the one from ACE, I have to admit quite honestly that it's out of my league.
Thank you for reading at least this far.

 

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

×