Jump to content
Sign in to follow this  
alexboy

C-RAM AI aiming help

Recommended Posts

Hey guys im working on a C-RAM and... im trying to have the turret automatically lock onto a target its aiming at without haveing to press tab to lock... because my AI is able to aim at the target and follow the target... but unable to "fire"... he can see the target because he is able to say "enemy helicopter (how far away)", even when i tell him to fire at a specific target or tell him to engage or open fire... he still wont fire ?

Share this post


Link to post
Share on other sites

even though i am trying to make it somewhat like a static cannon like an static mg ? because it wont be moving... or just look at the turret aspect ?

Share this post


Link to post
Share on other sites

sorry for double post but new config...

here is my config.cpp...

dont mind the init its in note form so doesnt affect it... but for some reason.. this will not fire ?? it aims... sees and all but AI cannot fire it or will not fire for some reason... when i get in the C-ram I am able to fire and such...???

class LandVehicle;
class StaticWeapon: LandVehicle {
	class NewTurret;
	class Sounds;
	class AnimationSources;
	class EventHandlers;
};

class StaticCannon: StaticWeapon{
	class ViewOptics;
};

class at_phalanx_base: StaticCannon
{
	displayName = "Mantis C-RAM";
	model = "at_phalanx\at_phalanx";
	memoryPointsGetInDriver="pos_driver_dir";
	memoryPointsGetInDriverDir="pos_driver";
	threat[] = {0.2,0.9,1};
	hasDriver = 0;
	radarType = 4;
	gunnerCanSee = 23;
	type = 1;
	armor = 10000;



////////////////////////////////////////////////
//	BAKED
////////////////////////////////////////////////

	//class EventHandlers: EventHandlers
	//{
	//	init = "_this execVM ""\at_phalanx\start.sqf"";";
	//	};



	class AnimationSources: AnimationSources
	{
		class recoil_source {source = "reload"; weapon = "at_phalanx_autocannon_35mm";};
		class muzzle_rot_cannon {source = "reload"; weapon = "at_phalanx_autocannon_35mm";};
		//class ManTurret {
		//	source = "direct";
		//	animPeriod = 0.001;
		//};
		//class ManGun {
		//	source = "direct";
		//	animPeriod = 0.001;
		//};
	};
	class Sounds: Sounds {
		class Engine;
		class Movement;
	};
	class Turrets
	{
		class MainTurret: NewTurret
		{
			gunnerName="Gunner";
			primary=1;
			primaryGunner=1;
			startEngine = 0;
			initElev=0;
			minElev=-360;
			maxElev=+360;
			minTurn = -360;
			maxTurn =+360;
			maxHorizontalRotSpeed = 1.5;	// 1 = 45°/sec
			maxVerticalRotSpeed = 1.5;


			weapons[]={"at_phalanx_autocannon_35mm"};
			magazines[] = {"at_phalanx_35mag"};

			memoryPointsGetInGunner = "pos_gunner_dir";
			memoryPointsGetInGunnerDir = "pos_gunner";
			memoryPointGunnerOptics="gunnerview";//gunnerview or usti hlavne
			memoryPointGun = "usti hlavne";
			selectionFireAnim = "zasleh";
			gunBeg = "usti hlavne";
			gunEnd = "konec hlavne";
			turretInfoType = "RscWeaponRangeZeroing";
			soundServo[]= {"A3\Sounds_F\vehicles\armor\noises\servo_best", db+3, 1.0,40};

			outGunnerMayFire = 1;	// Turn off to make player able to look around freely outside optics view.
			inGunnerMayFire = 1;
			gunnerForceOptics=1;
			showGunnerOptics=1;
			gunnerOutForceOptics = 1;
			forceHideGunner=1;
			stabilizedInAxes = "StabilizedInAxesBoth";
			showAllTargets = 2;


			class OpticsIn {
				class Wide: ViewOptics {
					initAngleX=0;
					minAngleX=-30;
					maxAngleX=+30;
					initAngleY=0;
					minAngleY=-100;
					maxAngleY=+100;
					initFov=0.3;
					minFov=0.3;
					maxFov=0.3;
					visionMode[] = {"NV","Ti"};
					thermalMode[] = {0,1}; //red hot chilli
					gunnerOpticsModel = "\A3\Weapons_F\Reticle\Optics_Gunner_AAA_01_w_F.p3d";
					gunnerOpticsEffect[] = {};
				};
				class Medium: Wide {
					gunnerOpticsModel = "\A3\Weapons_F\Reticle\Optics_Gunner_AAA_01_m_F.p3d";
					initFov=0.07;
					minFov=0.07;
					maxFov=0.07;
				};
				class Narrow: Wide {
					gunnerOpticsModel = "\A3\Weapons_F\Reticle\Optics_Gunner_AAA_01_n_F.p3d";
					initFov=0.028;
					minFov=0.028;
					maxFov=0.028;
				};
			};
		};
	};
};

class at_phalanx_35:at_phalanx_base
{
	scope=2;
	side=3;
	hasDriver=0;
	hasGunner=1;
};
class at_phalanx_35AI:at_phalanx_base
{	
	displayName="Mantis C-RAM AI";
	scope=2;
	side=3;
	hasGunner=1;



	class Turrets: Turrets
	{
		class MainTurret: MainTurret
		{
			animationSourceBody="ManTurret";
			animationSourceGun="ManGun";
			body="ManTurret";
			gun="ManGun";
			//class OpticsIn
		};

	};
};
};


Share this post


Link to post
Share on other sites

Could be a problem with your weapons or the ammo. Try replacing them with vanilla BIS anti-air cannon ammo and weapons to narrow down the problem.

Share this post


Link to post
Share on other sites

i got it to work... was a distance problem in the amm/weapon... was only inheriting distance - far... not close,medium, and far

another problem... my outeroptics for the camera is facing in the direction of the turret..... while the inneroptics for the camera is way off from where the turrets facing??? whats the problem with this...

i have copy/pasted the memory points from my other turret.. which works perfectly... but for some reason this is off now ???? any help is appreciated

if you could give me the memory point for inneroptics or something ?

Share this post


Link to post
Share on other sites

OK new issue... if anyone can help me set up a script that pulls bullets that are fired (mainly missiles or artillery/tank ammo) and be able to pull the position of it and send it to the phalanx ? so the phalanx can target it ?

im so poor in this and so lost of how to even get the info of a bullet from the game???

Share this post


Link to post
Share on other sites

made a script / mod that searches for weapons firing... and my phalanx can follow the ammo that is fired ... it will follow but will not fire is there any type of script made that can make a person fire at an object or a way to pull a variable from a clientside init... and be able to implement it into the unit so it can fire at it in some sort of way... or a command to fire... i have tried dofire, commandfire...

dotarget works so it follows it... cant find out how to force it to fire at it ... (i place an object (a sphere) on the ammo and i cant make it fire at the object the class is a target base for the sphere)

Share this post


Link to post
Share on other sites

If you've got the C-RAM following the target correctly, try then using the fire command. Although the AI might just be following the the target rather than targeting it with proper a lead. Keen to hear how you get on.

Share this post


Link to post
Share on other sites

how can you make it lead it properly ?

also when i just make a trigger with fire a1 fire "at_phalanx_autocannon_35mm";

and just trigger that one through radio it doesn't fire ?

Edited by alexboy

Share this post


Link to post
Share on other sites

I GOT IT TO FIRE!!!! it follows its target and fires at it....

only problem is a way for it to take damage... i have an object on the bullet thats being tracked (without geo lod/fire lod) because if there is one it collides with the ammo being trackked causing it to delete the ammo / destroy it causing the target unable to follow the ammo any more since it doesnt exist basically....

how can i make it be able to take damage from the phalanx bullets but not the ammo ???

because i want the bullets from the phalanx to damage it so it blows the ammo... but the ammo blows up when i place the object at the position of the bullet... and cant figure out how to make this work

Edited by alexboy

Share this post


Link to post
Share on other sites

So if I understand you correctly you have an object (without fire or geo LODs) placed via setpos at the location of the incoming artillery round. The C-RAM then targets this object, not the artillery?

What I would do is adjust your script for placing the object at the artillery round's location so it's slightly below the round. Then add a conditional loop to the script that only moves the object if it has taken no damage. Add a fire/geo LOD to the object and add enough armor value to it's config so that it can take a few hits from C-RAM ammo.

This way, when the C-RAM fires on and hits your object, it will stop moving, which will make the artillery round colide with it, then you can delete this object via the script.

Of course, you will have to experiment to find the right place to position the object in flight, and with the right size of the object.

Good to hear you're making progress!

Share this post


Link to post
Share on other sites

reason i dont target the artillery because i dont know if all or any artillery ammo have a geometry lod ? and if it is its such a small object just making it easier since AI isnt 100% accurate

i tried doing the object below... but when it drops downwards it collides because the object collides with it some how idk how... but ya it does ima move it to the left and see if that works and if the object is destroyed then delete the artillery

see how that goes... but as for the geometry how can i make it work properly

like can i make the object like static or an object in game so it doesnt require any/little amount of coding so its simple

(i jsut tried puting a house config inside of my static config and i guess i cant mix them ? like no errors... just my addon wont show up in the game for some reason ???

example

class CfgVehicles
{
class static;
class alex_phalanx : static {
bla 
bla 
bla
                                    };

class house;

class alex_house : house {
bla 
bla 
bla
                                   };
   };

Edited by alexboy

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  

×