IPB

Welcome Guest ( Log In | Register )

AI Refusing to Use Air-Launched Guided Weapons
DarkWolf985
post Jul 10 2017, 08:45 AM
Post #1


Enlisted
*

Group: Soldiers
Posts: 14
Joined: 23-June 13
From: United States
Member No.: 9,654



Hello,

I have been having this issue with the AI for quite some time. Up until I switched the AI Type for my helicopter pilots to Void's MissileBird, the AI would basically never launch Air-to-Air or Air-to-Ground Missiles, neither would them fire their rockets. Now I face a similar problem with my jets, the pilots use their Air-to-Air Missiles and Autocannons perfectly but simply refuse to launch their Air-to-Ground weapons, being them guided or unguided, despite the fact that they appear to switch to them and give land vehicles a lock warning. The armament is all put on the AltFire inputs and the Weapon AIs appear completely normal. I even attempted to switch the bf2hc's AIBehaviours with the AIX2 version and even tried changing the AI Type from Plane to Bomber but to no avail. Can anyone point me in the right direction here?

Thank you for your time in advance.
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies (1 - 8)
clivewil
post Jul 10 2017, 12:55 PM
Post #2


meh.
Group Icon

Group: Mr. Admin
Posts: 2,008,251
Joined: 24-July 07
From: Perth, Western Australia
Member No.: 3,545



it's 3:30am and i'm about to go to bed, but i'll answer this when i wake up

in the meantime, if you have AIX then take a look at the F-16LG, that has 2 different working LG AGM weapons that bots can use

--->

besides the weapon itself as defined in the tweak, there's a couple of notable things in both weapons.ai and objects.ai

weapons.ai:

rem *Cruise Missiles*
weaponTemplate.create AIX_F16LG_JASSM
WeaponTemplate.WeaponActivate PIMenuSelect2
WeaponTemplate.WeaponFire PIAltFire

weaponTemplate.indirect 0
weaponTemplate.minRange 50.0
weaponTemplate.maxRange 600.0
weaponTemplate.setStrength Infantry 45.0
weaponTemplate.setStrength LightArmour 45.0
weaponTemplate.setStrength HeavyArmour 45.0
weaponTemplate.setStrength NavalArmour 0.0
weaponTemplate.setStrength Helicopter 0.0
weaponTemplate.setStrength Airplane 0.0
weaponTemplate.allowedDeviation 200.0 ***
weaponTemplate.fireRate 1800

*** note the massive deviation. you can reduce this later if you think the bots are firing too often or too indiscriminately. it suited the JASSM, which is an autonomous cruise missile that flies very slowly and can re-target during flight

some might argue that setting the major strengths all at 45.0 does not give the bot a clear choice if confronted by multiple target types - if it bothers you, then set it to e.g. 44.0 45.0 46.0 respectively - but remember BF2's targeting system prioritises the target in the middle of the hud when firing, regardless of where the locked target is. if your lock is on an APC slightly off to the side, but there's a tank directly in front - you're targeting the tank.

objects.ai:

rem *** Plugins ***
aiTemplatePlugIn.create Unit AIX_F16LGUnit
aiTemplatePlugIn.equipmentTypeName Plane
aiTemplatePlugIn.setStrategicStrength 0 2
aiTemplatePlugIn.setStrategicStrength 1 2


note the 0, 2 - 1, 2 instead of the usual 0, 3 - 1, 3

one little trick i would use during testing was to change the AGM's Fire3p sound in the plane's tweak to 'is3dsound 0' which means you'd hear it clearly every time a bot fired an AGM regardless of where you were on the map. after tuning and testing, change it back to 1 or it'll drive you nuts


--------------------
Go to the top of the page
 
+Quote Post
DarkWolf985
post Jul 10 2017, 10:08 PM
Post #3


Enlisted
*

Group: Soldiers
Posts: 14
Joined: 23-June 13
From: United States
Member No.: 9,654



QUOTE (clivewil @ Jul 10 2017, 01:55 PM) *
it's 3:30am and i'm about to go to bed, but i'll answer this when i wake up

in the meantime, if you have AIX then take a look at the F-16LG, that has 2 different working LG AGM weapons that bots can use

--->

besides the weapon itself as defined in the tweak, there's a couple of notable things in both weapons.ai and objects.ai

weapons.ai:

rem *Cruise Missiles*
weaponTemplate.create AIX_F16LG_JASSM
WeaponTemplate.WeaponActivate PIMenuSelect2
WeaponTemplate.WeaponFire PIAltFire

weaponTemplate.indirect 0
weaponTemplate.minRange 50.0
weaponTemplate.maxRange 600.0
weaponTemplate.setStrength Infantry 45.0
weaponTemplate.setStrength LightArmour 45.0
weaponTemplate.setStrength HeavyArmour 45.0
weaponTemplate.setStrength NavalArmour 0.0
weaponTemplate.setStrength Helicopter 0.0
weaponTemplate.setStrength Airplane 0.0
weaponTemplate.allowedDeviation 200.0 ***
weaponTemplate.fireRate 1800

*** note the massive deviation. you can reduce this later if you think the bots are firing too often or too indiscriminately. it suited the JASSM, which is an autonomous cruise missile that flies very slowly and can re-target during flight

some might argue that setting the major strengths all at 45.0 does not give the bot a clear choice if confronted by multiple target types - if it bothers you, then set it to e.g. 44.0 45.0 46.0 respectively - but remember BF2's targeting system prioritises the target in the middle of the hud when firing, regardless of where the locked target is. if your lock is on an APC slightly off to the side, but there's a tank directly in front - you're targeting the tank.

objects.ai:

rem *** Plugins ***
aiTemplatePlugIn.create Unit AIX_F16LGUnit
aiTemplatePlugIn.equipmentTypeName Plane
aiTemplatePlugIn.setStrategicStrength 0 2
aiTemplatePlugIn.setStrategicStrength 1 2


note the 0, 2 - 1, 2 instead of the usual 0, 3 - 1, 3

one little trick i would use during testing was to change the AGM's Fire3p sound in the plane's tweak to 'is3dsound 0' which means you'd hear it clearly every time a bot fired an AGM regardless of where you were on the map. after tuning and testing, change it back to 1 or it'll drive you nuts


I appreciate the response.

I did try to model the object and weapon ai on multiple different aircraft of multiple different mods, but so far I have had no luck.

This is the Objects.ai:

aiTemplatePlugIn.create Unit ms_jet_pilotUnit
aiTemplatePlugIn.equipmentTypeName Plane
aiTemplatePlugIn.setStrategicStrength 0 11
aiTemplatePlugIn.setStrategicStrength 1 9
aiTemplatePlugIn.cullDistance 1000

Weapons.ai:

weaponTemplate.create ms_jet_guided_missile_ai
weaponTemplate.indirect 0
weaponTemplate.minRange 5.0
weaponTemplate.maxRange 800.0
weaponTemplate.weaponFire PIAltFire
weaponTemplate.weaponActivate PIMenuSelect2
weaponTemplate.setStrength Infantry 0.0
weaponTemplate.setStrength LightArmour 15.0
weaponTemplate.setStrength HeavyArmour 20.0
weaponTemplate.setStrength NavalArmour 19.0
weaponTemplate.setStrength Helicopter 0.0
weaponTemplate.setStrength Airplane 0.0
weaponTemplate.allowedDeviation 60.0

The weapon's tweak:

ObjectTemplate.weaponHud.hudName "MEC-250"
ObjectTemplate.weaponHud.guiIndex 6402
ObjectTemplate.weaponHud.hasFireRate 0
ObjectTemplate.weaponHud.addShowOnCamMode 2
ObjectTemplate.weaponHud.firstLockSound HUD_TargetTrack
ObjectTemplate.weaponHud.secondLockSound HUD_TargetLock
rem ---EndComp ---
rem ---BeginComp:MultiFireComp ---
ObjectTemplate.createComponent MultiFireComp
ObjectTemplate.fire.roundsPerMinute 200
ObjectTemplate.fire.fireInput PIAltFire
ObjectTemplate.fire.addFireRate 0
ObjectTemplate.fire.useDummyProjectiles 1
ObjectTemplate.fire.addBarrelName ms_bomb_mec250_dummy
rem ---EndComp ---
rem ---BeginComp:DefaultAmmoComp ---
ObjectTemplate.createComponent DefaultAmmoComp
ObjectTemplate.ammo.ammoType 15
ObjectTemplate.ammo.nrOfMags 12
ObjectTemplate.ammo.magSize 1
ObjectTemplate.ammo.reloadTime 3
ObjectTemplate.ammo.autoReload 1
ObjectTemplate.ammo.reloadWithoutPlayer 1
rem ---EndComp ---
rem ---BeginComp:WeaponBasedRecoilComp ---
ObjectTemplate.createComponent WeaponBasedRecoilComp
rem ---EndComp ---
rem ---BeginComp:SimpleDeviationComp ---
ObjectTemplate.createComponent SimpleDeviationComp
rem ---EndComp ---
rem ---BeginComp:DefaultSoundComp ---
ObjectTemplate.createComponent DefaultSoundComp
rem ---EndComp ---
rem ---BeginComp:DefaultAnimationComp ---
ObjectTemplate.createComponent DefaultAnimationComp
rem ---EndComp ---
rem ---BeginComp:ToggleCameraComp ---
ObjectTemplate.createComponent ToggleCameraComp
ObjectTemplate.zoom.startCameraId 2
ObjectTemplate.zoom.startCameraViewMode 1
rem ---EndComp ---
rem ---BeginComp:MultiFireArmTargetComp ---
ObjectTemplate.createComponent MultiFireArmTargetComp
ObjectTemplate.target.maxDistance 9999
ObjectTemplate.target.targetSystem TSLaserGuided
ObjectTemplate.target.connectionEffectOnlyWhenZoomed 1
ObjectTemplate.target.useCameraDirectionToTarget 1
ObjectTemplate.target.lockDelay 0
ObjectTemplate.target.lockAngle 60
rem ---EndComp ---
ObjectTemplate.floaterMod 0
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.material 56
ObjectTemplate.aiTemplate ms_jet_guided_missile_ai

Like I said, when I play as a ground vehicle with just me and the test bot, he clearly locks-on to me, and I get laser warning, but not matter what, he refuses to launch the weapon. But when it comes to the Air-to-Air Missile and Autocannon, they use it all the time. A similarly-coded guided missile works fine with the attack helicopters after I changed to the MissileBird AI Type. I really just don't see what causes the AI to do this.

This post has been edited by DarkWolf985: Jul 10 2017, 10:09 PM
Go to the top of the page
 
+Quote Post
clivewil
post Jul 10 2017, 11:10 PM
Post #4


meh.
Group Icon

Group: Mr. Admin
Posts: 2,008,251
Joined: 24-July 07
From: Perth, Western Australia
Member No.: 3,545



if you feel like it, zip it up and upload it and i'll see if i can troubleshoot it and isolate the cause


--------------------
Go to the top of the page
 
+Quote Post
DarkWolf985
post Jul 11 2017, 10:16 AM
Post #5


Enlisted
*

Group: Soldiers
Posts: 14
Joined: 23-June 13
From: United States
Member No.: 9,654



QUOTE (clivewil @ Jul 11 2017, 12:10 AM) *
if you feel like it, zip it up and upload it and i'll see if i can troubleshoot it and isolate the cause


I greatly appreciate it. https://drive.google.com/open?id=0B8nrahdi3...NkxWWTVuSWg0cU0
Go to the top of the page
 
+Quote Post
clivewil
post Jul 11 2017, 01:26 PM
Post #6


meh.
Group Icon

Group: Mr. Admin
Posts: 2,008,251
Joined: 24-July 07
From: Perth, Western Australia
Member No.: 3,545



hey, is this an actual missile, or a guided bomb? if it's a bomb, you need to set weaponTemplate.indirect 1 in weapons.ai

with indirect set to 0, the bot expects the projectile to fly straight toward the target, and the target to be in front of him - and he also expects the projectile to be launched at a certain velocity or faster, and won't fire if the velocity is too low. indirect 0 tells the bot that the target will be below him (out of sight) and allows for freefall projectiles with an initial launch velocity of 0

perhaps have a look at how the AIX F-117a and GBU-27 (Paveway type glide bomb) are set up

in the meantime, i have downloaded your files and will hopefully have a look tomorrow, time permitting


--------------------
Go to the top of the page
 
+Quote Post
clivewil
post Jul 12 2017, 07:10 AM
Post #7


meh.
Group Icon

Group: Mr. Admin
Posts: 2,008,251
Joined: 24-July 07
From: Perth, Western Australia
Member No.: 3,545



well it's up and running and i am seeing the bots getting kills...



...but i had to make many changes to get the plane loading up, mostly reverting the menu+icons etc. back to BF2 or AIX types (there was no way i was going to install 180mb of Menu items just to support a 15mb plane) and the plane is currently using the AIX GBU weapons.ai, plus a few other adjustments

now i need to backtrack and see which of those changes was the major contributor, i'll let you know once i figure it out


--------------------
Go to the top of the page
 
+Quote Post
clivewil
post Jul 13 2017, 09:15 PM
Post #8


meh.
Group Icon

Group: Mr. Admin
Posts: 2,008,251
Joined: 24-July 07
From: Perth, Western Australia
Member No.: 3,545



ok, first up, replace your weapon.ai entry with this one:

rem *** Guided Bomb/Missile ***
weaponTemplate.create ms_jet_guided_missile_ai
WeaponTemplate.WeaponSelect PIMenuSelect1
WeaponTemplate.WeaponFire PIAltFire
weaponTemplate.indirect 1
weaponTemplate.minRange 30
weaponTemplate.maxRange 500
weaponTemplate.setStrength Infantry 0
weaponTemplate.setStrength LightArmour 35
weaponTemplate.setStrength HeavyArmour 45
weaponTemplate.setStrength NavalArmour 25
weaponTemplate.setStrength Helicopter 0
weaponTemplate.setStrength Airplane 0
weaponTemplate.allowedDeviation 30


...and i was using Plane as the equipmentTypeName, so if it's still not working with the updated weapon ai, try this too

i was using my JASSM launch warning in the jet's Fire3p to let me know whenever a bot had dropped a bomb. i heard it a LOT.


--------------------
Go to the top of the page
 
+Quote Post
DarkWolf985
post Jul 16 2017, 05:30 PM
Post #9


Enlisted
*

Group: Soldiers
Posts: 14
Joined: 23-June 13
From: United States
Member No.: 9,654



QUOTE (clivewil @ Jul 13 2017, 10:15 PM) *
ok, first up, replace your weapon.ai entry with this one:

rem *** Guided Bomb/Missile ***
weaponTemplate.create ms_jet_guided_missile_ai
WeaponTemplate.WeaponSelect PIMenuSelect1
WeaponTemplate.WeaponFire PIAltFire
weaponTemplate.indirect 1
weaponTemplate.minRange 30
weaponTemplate.maxRange 500
weaponTemplate.setStrength Infantry 0
weaponTemplate.setStrength LightArmour 35
weaponTemplate.setStrength HeavyArmour 45
weaponTemplate.setStrength NavalArmour 25
weaponTemplate.setStrength Helicopter 0
weaponTemplate.setStrength Airplane 0
weaponTemplate.allowedDeviation 30


...and i was using Plane as the equipmentTypeName, so if it's still not working with the updated weapon ai, try this too

i was using my JASSM launch warning in the jet's Fire3p to let me know whenever a bot had dropped a bomb. i heard it a LOT.


All right, I greatly appreciate the help mate.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
4 User(s) are reading this topic (4 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st July 2017 - 12:50 PM