Jump to content
Sign in to follow this  
nzdfcrash

Laser not locking in custom aircraft

Recommended Posts

Hey all again....

I have tried many things to try solve the bug which is the custom aircraft not being able to lock on lasers. Original theory was that the issue was coming from the weapon code which is...

	class anzac_GBU12_LGB: anzac_LaserBombBase {
	hit = 5000;
	indirectHit = 1100;
	indirectHitRange = 12;
               laserLock = true;
	nvLock = 1;
	model = "\ca\air\gbu12fly.p3d";
	proxyShape = "\ca\air\gbu12_proxy.p3d";
};

It appears this may not be the case so the next step naturally was to look at the code of the aircraft in question which I did and altered a few variables which now allows for the laser to be seen on the radar but not be able to lock on it in either the pilot or gunner seat.

	class anzac_adf_f111_hvy : Plane
{
	destrType = "DestructWreck";
	scope = 0;
	vtol = 0;
	crew = "anzac_fighter_pilot_classic";
	typicalCargo[] = {"anzac_fighter_pilot_classic"};
	model="\anzac_fixed_wing_strike\anzac_adf_f111_hvy.p3d";
	displayName = "F-111C Ardvark (HMB)(C)(R)";
	side= 1;
	soundEngine[]={"\anzac_fixed_wing_strike_s\engine.wav",10,1.0};
	camouflage = 12;
	audible = 6;
	vehicleClass = "ADF_Fix";
	faction = "ANZAC";
	accuracy = 0.200000;
       landingSpeed = 250;
	landingAoa = "rad 10";
	acceleration = 200;
	maxSpeed = 1750;
	armor = 40;
	armorStructured = 1;
               laserScanner = true;
	irTarget = true;
	irScanRangeMin = 0;
	irScanRangeMax = 8000; // was 0
	irScanToEyeFactor = 9;
	irScanGround = true;
	memoryPointsGetInDriver = "pos_driver";
	memoryPointsGetInDriverDir = "pos_driver_dir";
	aileronSensitivity = 0.8; 		
	elevatorSensitivity = 0.6;
	wheelSteeringSensitivity = 2.5;
	brakeDistance=250; 
	driverAction = A10_Pilot;
	hasGunner = 1;
	radarType = 4;
	LockDetectionSystem = 8;
	IncommingMisslieDetectionSystem = 16;
	weapons[] = {"CMFlareLauncher"};
	magazines[] = {"120Rnd_CMFlare_Chaff_Magazine"};
	soundLocked[] = {"\ca\Tracked\Data\Sound\alarm_loop1", 0.000316, 2};
	soundIncommingMissile[] = {"\ca\Tracked\Data\Sound\alarm_loop1", 0.000316, 4};
	gunAimDown = 0.045000;
	flapsFrictionCoef = 0.300000; 
	envelope[] = {0.000000, 0.400000, 1.900000, 4, 6.800000, 8.300000, 8.500000, 7.800000, 6.200000, 3.600000, 2.200000, 1.600000, 1.100000, 0.700000, 0.400000, 0};
	minFireTime = 30;
	gearUpTime = 4.500000;
	gearDownTime = 3;
	cost = 20000000;
	type = "VAir";
	threat[] = {0.1, 0.4, 1.0};
	icon="\anzac_fixed_wing_strike_t\tex\misc\f111icon.paa";
	picture="\anzac_fixed_wing_strike_t\tex\misc\f111pic.paa";
	mapSize=9;
	driverIsCommander = 1;
	hiddenSelections[] = {"camo_1", "camo_2", "camo_3", "camo_4", "camo_5", "camo_6", "camo_7", "camo_8", "camo_9", "camo_10", "camo_11", "camo_12", "target1","target2","target3","target4","map","myplane"};
	hiddenSelectionsTextures[] = {"\anzac_fixed_wing_strike_t\tex\camo\bottom1.paa", "\anzac_fixed_wing_strike_t\tex\camo\bottom2.paa", "\anzac_fixed_wing_strike_t\tex\camo\bottom3.paa", "\anzac_fixed_wing_strike_t\tex\camo\roundel.paa", "\anzac_fixed_wing_strike_t\tex\camo\side1.paa", "\anzac_fixed_wing_strike_t\tex\camo\tail.paa", "\anzac_fixed_wing_strike_t\tex\camo\tailwing.paa", "\anzac_fixed_wing_strike_t\tex\camo\top1.paa", "\anzac_fixed_wing_strike_t\tex\camo\top2.paa", "\anzac_fixed_wing_strike_t\tex\camo\top3.paa", "\anzac_fixed_wing_strike_t\tex\camo\wingl.paa", "\anzac_fixed_wing_strike_t\tex\camo\wingr.paa", "\anzac_fixed_wing_strike_t\tex\fighter_blue_ca.paa.paa"};			
       soundDammage[] = {"\anzac_fixed_wing_strike_s\alarm", 1, 1};
       soundLandCrash[] = {"\anzac_fixed_wing_strike_s\Tire", 8, 1.2, 1200};
	soundGetIn[] = {"ca\sounds\Air\AV8\ext\ext-jetair-cabine-close1", db-25, 1};
	soundGetOut[] = {"ca\sounds\Air\AV8\ext\ext-jetair-cabine-open1", db-25, 1, 40};
	soundEngineOnInt[] = {"\anzac_fixed_wing_strike_s\F111_start_in", 0.1, 0.7};
	soundEngineOnExt[] = {"\anzac_fixed_wing_strike_s\F111_start", 0.7, 0.7, 1000};
	soundEngineOffInt[] = {"\anzac_fixed_wing_strike_s\F111_stop_in", 0.1, 0.7};
	soundEngineOffExt[] = {"\anzac_fixed_wing_strike_s\F111_stop", 0.7, 0.7, 1000};

	class Damage {
		tex[] = {};
		mat[] = {"anzac_fixed_wing_strike\tex\f111_glass.rvmat", "anzac_fixed_wing_strike\tex\f111_glass_damage.rvmat", "anzac_fixed_wing_strike\tex\f111_glass_damage.rvmat", "anzac_fixed_wing_strike\tex\bottom1.rvmat", "anzac_fixed_wing_strike\tex\bottom1_damage.rvmat", "anzac_fixed_wing_strike\tex\bottom1_destruct.rvmat", "anzac_fixed_wing_strike\tex\bottom2.rvmat", "anzac_fixed_wing_strike\tex\bottom2_damage.rvmat", "anzac_fixed_wing_strike\tex\bottom2_destruct.rvmat", "anzac_fixed_wing_strike\tex\bottom3.rvmat", "anzac_fixed_wing_strike\tex\bottom3_damage.rvmat", "anzac_fixed_wing_strike\tex\bottom3_destruct.rvmat", "anzac_fixed_wing_strike\tex\side1.rvmat", "anzac_fixed_wing_strike\tex\side1_damage.rvmat", "anzac_fixed_wing_strike\tex\side1_destruct.rvmat", "anzac_fixed_wing_strike\tex\tail.rvmat", "anzac_fixed_wing_strike\tex\tail_damage.rvmat", "anzac_fixed_wing_strike\tex\tail_destruct.rvmat", "anzac_fixed_wing_strike\tex\tailwing.rvmat", "anzac_fixed_wing_strike\tex\tailwing_damage.rvmat", "anzac_fixed_wing_strike\tex\tailwing_destruct.rvmat", "anzac_fixed_wing_strike\tex\top1.rvmat", "anzac_fixed_wing_strike\tex\top1_damage.rvmat", "anzac_fixed_wing_strike\tex\top1_destruct.rvmat", "anzac_fixed_wing_strike\tex\top2.rvmat", "anzac_fixed_wing_strike\tex\top2_damage.rvmat", "anzac_fixed_wing_strike\tex\top2_destruct.rvmat", "anzac_fixed_wing_strike\tex\top3.rvmat", "anzac_fixed_wing_strike\tex\top3_damage.rvmat", "anzac_fixed_wing_strike\tex\top3_destruct.rvmat", "anzac_fixed_wing_strike\tex\wingl.rvmat", "anzac_fixed_wing_strike\tex\wingl_damage.rvmat", "anzac_fixed_wing_strike\tex\wingl_destruct.rvmat", "anzac_fixed_wing_strike\tex\wingr.rvmat", "anzac_fixed_wing_strike\tex\wingr_damage.rvmat", "anzac_fixed_wing_strike\tex\wingr_destruct.rvmat"};
	};

	class Sounds {
		class EngineLowOut {
			sound[] = {"\anzac_fixed_wing_strike_s\F111_engine", 11, 1.0, 1500};
			frequency = "1.0 min (rpm + 0.5)";
			volume = "engineOn*camPos*(thrust factor[1.0, 1.0])";
		};

		class EngineHighOut {
			sound[] = {"\anzac_fixed_wing_strike_s\F111_engine_hi", 11, 1.0,1500};
			frequency = "1";
			volume = "engineOn*camPos*(thrust factor[0.1, 1.0])";
		};

		class ForsageOut {
			sound[] = {"ca\sounds\Air\AV8\ext\ext-jetair-forsage1", 35, 1.1, 5000};
			frequency = "1";
			volume = "engineOn*camPos*(thrust factor[0.5, 1.0])";
			cone[] = {3.14, 3.92, 2.0, 0.4};
		};

		class WindNoiseOut {
			sound[] = {"ca\sounds\Air\AV8\ext\ext-jetair-wind", 5, 1.0, 500};
			frequency = "(0.1+(1.2*(speed factor[1, 150])))";
			volume = "camPos*(speed factor[1, 150])";
		};

		class DistantPlaneOut {
			sound[] = {"\anzac_fixed_wing_strike_s\distantplane", 35, 0.5};
			frequency = "1";
			volume = "engineOn*camPos*(speed factor[1, 100])";
		};

		class EngineLowIn {
			sound[] = {"\anzac_fixed_wing_strike_s\F111_engine_in", db2, 1.0};
			frequency = "1.0 min (rpm + 0.5)";
			volume = "(1-camPos)*(engineOn*(thrust factor[1.0, 0.4]))";
		};

		class EngineHighIn {
			sound[] = {"\anzac_fixed_wing_strike_s\F111_engine_hi_in", db2, 1.0};
			frequency = "1";
			volume = "(1-camPos)*(engineOn*(thrust factor[0.1, 1.0]))";
		};

		class ForsageIn {
			sound[] = {"ca\sounds\Air\AV8\ext\ext-jetair-engine-low2", db3, 1.2};
			frequency = "1";
			volume = "(1-camPos)*(engineOn*(thrust factor[0.75, 1.0]))";
		};

		class WindNoiseIn {
			sound[] = {"ca\sounds\Air\AV8\int\int-jetair-wind1", db-7, 1.1};
			frequency = "(0.1+(1.2*(speed factor[1, 150])))";
			volume = "(1-camPos)*(speed factor[1, 150])";
		};
	};

	class Turrets
	{
		class MainTurret : NewTurret
		{
			body = "";
     				gun = "";
			commanding = -1;
			memoryPointsGetInGunner= "pos_gunner";
			memoryPointsGetInGunnerDir= "pos_gunner_dir";
	                weapons[] = {"anzac_MK82_Launcher"};
			magazines[] = {"anzac_24Rnd_MK82"};
			castGunnerShadow = 1;
			viewGunnerShadow = 1;
			gunnerAction = AH1Z_Gunner;
			memoryPointGunnerOptics= "gunnerview";
			gunnerOpticsModel=\ca\air\optika_Ka50_rocket.p3d;
			gunnerForceOptics = 0;
			minElev=-60; maxElev=+10; initElev=0;
			minTurn=-70; maxTurn=+70; initTurn=0;
			gunnerInAction = AH1Z_Gunner;
		};
	};
	class animationsources {
		class ABSwitch {
			source = "user";
			animperiod = 0.1;
			initphase = 0;
		};
		class pavetack {
			source = "user";
			animperiod = 0.1;
			initphase = 0;
		};
	};

Any ideas or suggestions?

Share this post


Link to post
Share on other sites

My theory is that BIS scaled irScanRangeXXX in centimeters. Try larger numbers. As example, for the MOAB i had to equip the C130 with laserscanner and this is the related config part:

class C130J : Plane {
	laserScanner = 1;
	irScanRangeMin = 1000;
	irScanRangeMax = 350000;
	irScanToEyeFactor = 5;
	class UserActions {
		class GLT_GPSaction {
			priority = 0;
			shortcut = "";
			displayNameDefault = "";
			position = "";
			radius = 5;
			onlyforplayer = 1;
			displayName = "GPS/INS System";
			condition = "(isengineon this) && (player == (driver this))";
			statement = "createDialog 'glt_airgpsmfd'";
		};
	};
};

Hope this helps.

Share this post


Link to post
Share on other sites

Applied to no avail :C latest test proved that the aircraft can see the laser but still lacks the ability to lock onto the laser target. Ai seems to be able to lock onto the laser target but humans cant.

Share this post


Link to post
Share on other sites

Sorry asking this dumb question but you do have defined TRUE as 1?

#define    true   1

Sorry again, i just know it is often the trivial stuff that gets forgotten.

Share this post


Link to post
Share on other sites

yes its defined

#define true 1
#define false 0

#define VSoft 0
#define VArmor 1
#define VAir 2

#define private 0
#define protected 1
#define public 2

#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7

#define ReadAndWrite 0
#define ReadAndCreate 1
#define ReadOnly 2
#define ReadOnlyVerified 3

Share this post


Link to post
Share on other sites

Did you test with BIS GBU12?

What is the setting for "canLock"?

Mind to post the config for anzac_LaserBombBase?

Share this post


Link to post
Share on other sites

Heres the base

	class anzac_LaserBombBase: LaserBombCore {
	hit = 5000;
	cost = 5000;
	indirectHit = 1100;
	indirectHitRange = 12;
	model = "";
	proxyShape = "";
	soundHit[] = {"Ca\sounds\Weapons\explosions\explosion_large1", 28.183832, 1, 1900};
	trackOversteer = 1;
	trackLead = 0.950000;
	maneuvrability = 20;
	CraterEffects = "BombCrater";
	explosionEffects = "BombExplosion";
	explosionTime = 2;
	fuseDistance = 35;
	whistleDist = 24;
               laserLock = true;
	nvLock = 1;
	canLock = 1;
	irLock = 0;
};

Hopefully we can come to a solution that fixes the problem :pray:

Share this post


Link to post
Share on other sites

Hmmm...irLock does silly things sometimes. Try to comment it out just to see what happens.

You should also try with BIS GBU12 to check if the plane can lock these on.

Just to compare, thats the equivalent code from the Missilebox:

class GLT_LaserBombBase : LaserBombCore {
	hit = 5000;
	cost = 5000;
	indirectHit = 1100;
	indirectHitRange = 12;
	model = "";
	proxyShape = "";
	soundHit[] = {"Ca\sounds\Weapons\explosions\explosion_large1", db29, 1, 1900};
	trackOversteer = 1;
	trackLead = 0.95;
	maneuvrability = 20;
	CraterEffects = "BombCrater";
	explosionEffects = "BombExplosion";
	explosionTime = 2;
	fuseDistance = 35;
	whistleDist = 24;
	nvLock = 1;
};
class GLT_GBU12_LGB : GLT_LaserBombBase {
	hit = 5000;
	indirectHit = 1100;
	indirectHitRange = 12;
	model = "\glt_missilebox\GLT_GBU12\GLT_GBU12fly.p3d";
	proxyShape = "\glt_missilebox\GLT_GBU12\GLT_GBU12.p3d";
};

As you see, our code is almost identical except that irLock. If the plane can lock BIS GBU12, my bet goes on that.

It might be related with this: http://dev-heaven.net/issues/11086

:EDITH:

Just out of curiosity: did you ever considered to use the GLT Missilebox? ;)

No offense or anything, just curious. :D

Edited by [FRL]Myke

Share this post


Link to post
Share on other sites

Ok sorry for the delay but default GBU12 locks on so i can only but assume its a weapons issue...

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  

×