wld427 1705 Posted June 21, 2008 We are working on a bofors gun for project RACS. The issue is the Ai will not engage enemy aircraft ...and if they do they fire a random shot and only one. Below are posted the configs. PLEASE HELP <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #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 true 1 #define false 0 // type scope #define private 0 #define protected 1 #define public 2 class CfgPatches { class Bofors40mm { units[] = {"Bofors40mm"}; requiredVersion = 1.0; }; }; #include <cfgmagazine.h> #include <cfgWeapons.h> #include <cfgammo.h> #include <CfgSkeletons.h> class CfgVehicles { class Land; // External class reference class LandVehicle : Land { class NewTurret; // External class reference class ViewOptics; // External class reference }; class StaticWeapon : LandVehicle { class Turrets { class MainTurret : NewTurret { class ViewOptics { }; }; }; }; class Bofors40mm : StaticWeapon { scope = 2; side = 2; crew = "SoldierGB"; displayName = "Bofors 40mm AA Gun"; displayNameShort = "Bofors"; model = "\Bofors40mm\Bofors40mm"; Icon = "\Bofors40mm\tex\EDzu.paa"; picture = "\Bofors40mm\tex\ICON.paa"; mapSize = 7; nameSound = "cannon"; cargoAction[] = {""}; typicalCargo[] = {""}; transportSoldier = 0; gunnerHasFlares = 1; memoryPointsGetInGunner = "pos gunner"; memoryPointsGetInGunnerDir = "pos gunner dir"; getInAction = "GetInLow"; getOutAction = "GetOutLow"; ForceHideGunner = 0; irScanRangeMin=10; irScanRangeMax=4000; irScanGround = false; // NO IR on ground targets gunnerCanSee = CanSeeOptics+CanSeeEar+CanSeeCompass+CanSeeRadar; class Turrets : Turrets { class MainTurret : MainTurret { gunnerAction = "t72_driver"; minElev = -4.5; maxElev = 85; minTurn = -360; maxTurn = 360; gunnerOpticsModel = "\Bofors40mm\booptic"; body = "otocvez"; gun = "otochlaven"; hasGunner = 1; Commanding = 1; gunBeg = "usti hlavne"; gunEnd = "konec hlavne"; weapons[] = {"BoforsCannon_40mm"}; soundServo[] = {"\ca\Weapons\Data\Sound\gun_elevate2", db-70, 1.0}; magazines[] = {"8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_AP","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE", "8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE","8Rnd_40mm_HE"}; }; }; class Library { libTextDesc = "Originally designed as an anti tank gun in 1923, the bofors automatic cannon serves on today in many different forms."; }; }; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class cfgWeapons { class CannonCore; // External class reference class LauncherCore; // External class reference class Launcher; // External class reference class MissileLauncher : LauncherCore{}; class BoforsCannon_40mm : CannonCore { scope = 1; displayName = "40mm AA"; reloadTime = 0.2; autoFire = 1; canLock = 0; sound[] = {\ca\Weapons\Data\Sound\AGS30_shot1,db20,1}; reloadMagazineSound[] = {"\Bofors40MM\reload", 0.0316228, 1}; soundServo[] = {"", 0.0001, 1.0}; soundContinuous = 0; magazineReloadTime = .8; magazines[] = {"8Rnd_40mm_AP","8Rnd_40mm_HE"}; aiDispersionCoefX = .1; aiDispersionCoefY = .1; minRange = 1; minRangeProbab = 1; midRange = 1000; midRangeProbab = 1; maxRange = 2500; maxRangeProbab = 1; aiRateOfFire=0.3; // delay between shots at given distance aiRateOfFireDistance=3000; // at shorter distance delay goes lineary to zero maxLeadSpeed = 600; }; }; Share this post Link to post Share on other sites
.kju 3245 Posted June 22, 2008 where is your cfgAmmo class? it has to have airLock = 1; Share this post Link to post Share on other sites
scars09 9 Posted June 22, 2008 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> minRange = 1; minRangeProbab = 1; midRange = 1000; midRangeProbab = 1; maxRange = 2500; maxRangeProbab = 1; maybe try this with values different to 1 or, maybe even more interesting, change you minrange to 400 or something. if 1 is highest possible attack, and if its used for min value, then your config would make you unit shoot at the plane for 100% at 1 m distance, wich is hard to archieve i guess. like Q said, airlock=1 is good idea aswell, but i think you will need to change canlock value aswell in this case. Share this post Link to post Share on other sites
wld427 1705 Posted June 22, 2008 it worked!... thanks guys Share this post Link to post Share on other sites