Jump to content
CheyenneAH56

Firemodes not shown on HUD, counter this with control display but not clean

Recommended Posts

Hi all ; I'll try to make it short.

 

I have created a new weapon, with three fire modes which can be installed on all vanilla and community planes and helicopters, even those provided without weapons at the base (e.g. unarmed WY-55, etc.).

Everything is working well, except that I cannot see the display of fire modes in the HUD at the top right, on any of the vehicles.

 

I then understood slightly that the display seams to depends on the vehicle and its configuration (UnitInfoType: RscBlaBlaBla), and not on the weapon, because this one, moreover, is a weapon mountable on vehicle (so WeaponInfoType: RscBlaBlaBla is not used).

 

Therefore ; to counter this, i created a control display and a script.

The only current problem, when the player is in the pause menu, the display remains there, same for the splendid camera, same for the spectator mode, same for the GUI editor, etc.

I managed to use a displayeventhandler to hide the control display in the pause menu, but not for the rest mentioned.

 

If someone can do a lot much easier, I'm interested, just to understand a little better ! 😶

 

> Here is the script :

 

_veh = _this select 0;

waitUntil {(currentWeapon _veh == "MyNewWeapon") && (!isNull findDisplay 46)};
("FireModes" call BIS_fnc_rscLayer) cutRsc ["RscTitleDisplayEmpty", "PLAIN", -1, false];

with uiNamespace do
{
	_display = uiNamespace getVariable "RscTitleDisplayEmpty";
	FireModes = _display ctrlCreate ["RscStructuredText", -1];
};

sleep 0.01;
FireModes = [uiNamespace getVariable "FireModes"];
(FireModes select 0) ctrlSetPosition [32.5 * (((safezoneW / safezoneH) min 1.2) / 40), -1.60 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25), 0.095 * safezoneW, 0.085 * safezoneH];

sleep 0.01;
(findDisplay 46) displayAddEventHandler ["KeyDown", "if (_this select 1 == 0x01) then {(FireModes select 0) ctrlShow false;};"];

while {alive _veh} do
{
	(FireModes select 0) ctrlCommit 0.0;

	if ((currentWeapon _veh == "MyNewWeapon") && (player in _veh) && (assignedDriver _veh == player) && !(visibleMap) && (isNull (uinamespace getvariable "RscDisplayInterrupt"))) then
	{
		(FireModes select 0) ctrlShow true;
		(FireModes select 0) ctrlSetStructuredText parseText format ["<t size='0.8' align='Left' font='RobotoCondensed' color='#D9FFFFFF'>%1</t>", gettext (configFile >> "CfgWeapons" >> "MyNewWeapon" >> (currentWeaponMode (driver _veh)) >> "displayName")];
	}
	else
	{
		(FireModes select 0) ctrlShow false;
	};
};

sleep 0.01;
ctrlDelete (FireModes select 0);

sleep 0.01;
terminate _thisScript;

 

> Here is the configuration of the weapon (it is unusual / but do not focus on it, it works) :

 

class CfgWeapons
{
	class Laserdesignator;
	class MyNewWeapon : Laserdesignator
	{
		//_generalMacro = "Laserdesignator";
		access = 3;
		aiDispersionCoefX = 1;
		aiDispersionCoefY = 1;
		aimTransitionSpeed = 1;
		aiRateOfFire = 5;
		aiRateOfFireDispersion = 0;
		aiRateOfFireDistance = 500;
		ammo = "";
		artilleryCharge = 1;
		artilleryDispersion = 1;
		author = "Bohemia Interactive";
		autoFire = 0;
		autoReload = 1;
		backgroundReload = 1;
		ballisticsComputer = 0;
		burst = 100;
		canMODE = 1;
		canLock = 0;
		canShootInWater = 0;
		cartridgePos = "nabojnicestart";
		cartridgeVel = "nabojniceend";
		changeFiremodeSound[] = {"",1,1};
		cmImmunity = 1;
		count = 0;
		cursor = "laserDesignator";
		cursorAim = "EmptyCursor";
		cursorAimOn = "CursorAimOn";
		cursorSize = 1;
		detectRange = 0;
		dispersion = 0.002;
		displayName = "MyNewWeapon";
		distanceZoomMax = 2300;
		distanceZoomMin = 100;
		drySound[] = {"",1,1};
		emptySound[] = {"",1,1};
		enableAttack = 1;
		ffCount = 1;
		ffFrequency = 1;
		ffMagnitude = 0;
		fireAnims[] = {};
		fireLightAmbient[] = {0,0,0};
		fireLightDiffuse[] = {0.937,0.631,0.259};
		fireLightDuration = 0.05;
		fireLightIntensity = 0.2;
		fireSpreadAngle = 3;
		forceOptics = 0;
		handAnim[] = {};
		hiddenSelections[] = {};
		hiddenSelectionsTextures[] = {};
		hiddenUnderwaterSelections[] = {};
		hiddenUnderwaterSelectionsTextures[] = {};
		inertia = 0.1;
		initSpeed = 0;
		irDistance = 0;
		irDotIntensity = 0.001;
		irLaserEnd = "laser dir";
		irLaserPos = "laser pos";
		Laser = 1;
		lockAcquire = 1;
		lockedTargetSound[] = {"",0.000316228,6};
		lockingTargetSound[] = {"",0.000316228,2};
		magazineReloadSwitchPhase = 1;
		magazineReloadTime = 0;
		magazines[] = {"MyNewWeaponMag"};
		maxLeadSpeed = 10000;
		maxRange = 850;
		maxRangeProbab = 0.1;
		maxRecoilSway = 0.008;
		memoryPointCamera = "eye";
		midRange = 500;
		midRangeProbab = 0.75;
		minRange = 1;
		minRangeProbab = 0.95;
		//model = "\A3\Weapons_F\Binocular\laserdesignator_f.p3d";
		modelMagazine = "";
		//modelOptics = "\A3\Weapons_F_beta\Binocular\lasermarker_optics";
		modelSpecial = "";
		modes[] = {"MyNewWeapon_1","MyNewWeapon_2","MyNewWeapon_3"};
		multiplier = 1;
		muzzleEnd = "konec hlavne";
		muzzlePos = "usti hlavne";
		muzzles[] = {"this"};
		nameSound = "binoculars";
		optics = 1;
		opticsDisablePeripherialVision = 1;
		opticsFlare = 1;
		opticsID = 0;
		opticsPPEffects[] = {"OpticsCHAbera1","OpticsBlur1"};
		opticsZoomInit = 0.05;
		opticsZoomMax = 0.05;
		opticsZoomMin = 0.01;
		//picture = "\A3\Weapons_F_Mark\Data\UI\gear_laserdesignator_ca.paa";
		primary = 0;
		recoil = "empty";
		recoilProne = "";
		reloadAction = "";
		reloadMagazineSound[] = {"",1,1};
		reloadSound[] = {"",1,1};
		reloadTime = 0.05;
		scope = 2;
		selectionFireAnim = "zasleh";
		showAimCursorInternal = 1;
		showEmpty = 1;
		shownUnderwaterSelections[] = {};
		showSwitchAction = 1;
		showToPlayer = 1;
		simulation = "weapon";
		sound[] = {"",0,1};
		soundBegin[] = {"sound",1};
		soundBeginWater[] = {"sound",1};
		soundBullet[] = {"emptySound",1};
		soundBurst = 1;
		soundClosure[] = {"sound",1};
		soundContinuous = 0;
		soundEnd[] = {"sound",1};
		soundLoop[] = {"sound",1};
		sounds[] = {};
		swayCoef = 0.34;
		swayDecaySpeed = 2;
		textureType = "default";
		thermalMode[] = {2};
		type = 4096;
		uiPicture = "";
		useAction = 0;
		useActionTitle = "";
		useAsBinocular = 1;
		useModelOptics = 1;
		value = 5;
		visionMode[] = {"Normal","NVG","TI"};
		//weaponInfoType = "RscUnitInfoAir"; //"RscOptics_LaserDesignator_2"; Not used for vehicle mounted weapon
		weaponLockDelay = 0;
		weaponLockSystem = 0;
		weaponPoolAvailable = 1;
		weaponSoundEffect = "";
		weight = 0;
		zeroingSound[] = {"",1,1};

		class MyNewWeapon_1 : Laserdesignator
		{
			displayName = "FULL MODE";
			autoFire = 0;
			autoReload = 1;
			backgroundReload = 1;
			reloadTime = 0.05;
			burst = 100;
		};

		class MyNewWeapon_2 : Laserdesignator
		{
			displayName = "HALF MODE";
			autoFire = 0;
			autoReload = 1;
			backgroundReload = 1;
			reloadTime = 0.05;
			burst = 50;
		};

		class MyNewWeapon_3 : Laserdesignator
		{
			displayName = "LITE MODE";
			autoFire = 0;
			autoReload = 1;
			backgroundReload = 1;
			reloadTime = 0.05;
			burst = 25;
		};

		class Eventhandlers {};
	};
};

 

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

×