Willy issues: AI won't fire passenger gun? [Video Included]

Ask questions, discuss ideas, get answers
Post Reply
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Willy issues: AI won't fire passenger gun? [Video Included]

Post by Swaffy »

I recently copied [all of] the Willy files from "Raid on Ahelielelba" from Secret Weapons.
It is the Jeep Willy with the second PCO using an M1919A4 machinegun.

(As a side note for future reference, I renamed the "Willy" to "WillyM1919 so that the original Willy does not interfere.")

My issue with it is that bots will not fire the M1919A4. They will aim it at enemies, but that's it.



Here's all of the coding in an organized fashion:

< Objects.rfa/Objects/Vehicles/Land/WillyM1919/AI/Objects.con >
{AI information for the Passenger PCO that uses the MG.}
I left out the other AI information to reduce clutter.

Code: Select all

aiTemplatePlugIn.create Unit WillyM1919PassengerUnit
aiTemplatePlugIn.equipmentType 8
rem aiTemplatePlugIn.setStrategicStrength 0 1
rem aiTemplatePlugIn.setStrategicStrength 1 0
aiTemplatePlugIn.setStrategicStrength 0 1
aiTemplatePlugIn.setStrategicStrength 1 1
aiTemplatePlugIn.setSelectKey PIMenuSelect2
aiTemplatePlugIn.setHasExposedSoldier 1

aiTemplatePlugIn.create Armament WillyM1919MgArms
aiTemplatePlugIn.setIsAntiAircraft 1

aiTemplatePlugIn.create ControlInfo WillyM1919PassengerCtrl
aiTemplatePlugIn.driveTurnControl           PIYaw
aiTemplatePlugIn.driveThrottleControl       PIThrottle
aiTemplatePlugIn.aimHorizontalControl       PIMouseLookX
aiTemplatePlugIn.aimVerticalControl         PIMouseLookY
aiTemplatePlugIn.lookHorizontalControl      PIMouseLookX
aiTemplatePlugIn.lookVerticalControl        PIMouseLookY
aiTemplatePlugIn.throttleSensitivity       -1.0
aiTemplatePlugIn.pitchSensitivity           0.21817
aiTemplatePlugIn.rollSensitivity           -0.21817
aiTemplatePlugIn.yawSensitivity            -2.5
aiTemplatePlugIn.lookVerticalSensitivity    0.21817
aiTemplatePlugIn.lookHorizontalSensitivity -0.21817
aiTemplatePlugIn.throttleLookAhead          1.0
aiTemplatePlugIn.pitchLookAhead             1.0
aiTemplatePlugIn.rollLookAhead              1.0
aiTemplatePlugIn.yawLookAhead               1.0
aiTemplatePlugIn.lookVerticalLookAhead      1.0
aiTemplatePlugIn.lookHorizontalLookAhead    1.0
aiTemplatePlugIn.throttleScale              1.0
rem *** Angle in radians ***
aiTemplatePlugIn.pitchScale                 5.0
aiTemplatePlugIn.rollScale                  5.0
aiTemplatePlugIn.yawScale                   0.0020
aiTemplatePlugIn.lookVerticalScale          1.0
aiTemplatePlugIn.lookHorizontalScale        1.0
aiTemplatePlugIn.setCameraRelativeMinRotationDeg -110/-40/0
aiTemplatePlugIn.setCameraRelativeMaxRotationDeg 110/10/0

rem *** AITemplate ***
aiTemplate.create WillyM1919Passenger
aiTemplate.addType ITUnit
aiTemplate.addType ITBiological
aiTemplate.addType ITGround
aiTemplate.degeneration 10
aiTemplate.allowedTimeDiff 2
aiTemplate.basicTemp 6
aiTemplate.commonKnowledge 0
aiTemplate.secondary 1
aiTemplate.addPlugIn WillyM1919MgArms
aiTemplate.addPlugIn WillyM1919PassengerUnit
aiTemplate.addPlugIn WillyM1919PassengerCtrl
< Objects.rfa/Objects/Vehicles/Land/WillyM1919/AI/Objects.con >
{AI information for the machinegun}

Code: Select all

rem *** M1919A4 *** 
weaponTemplate.create M1919A4_AI
weaponTemplate.burst 1
weaponTemplate.indirect 0
weaponTemplate.minRange 1.0
weaponTemplate.maxRange 250.0
weaponTemplate.weaponActivate PINone
weaponTemplate.weaponFire PIFire
weaponTemplate.setStrength Infantry    8.0
weaponTemplate.setStrength LightArmour 1.0
weaponTemplate.setStrength HeavyArmour 0.0
weaponTemplate.setStrength NavalArmour 0.0
weaponTemplate.setStrength Submarine   0.0
weaponTemplate.setStrength Air         0.0
< Objects.rfa/Objects/Vehicles/Land/WillyM1919/Objects.con >
{The AI template is inserted at the arrow.}

Code: Select all

rem *** WillyM1919PassengerPCO ***
ObjectTemplate.create PlayerControlObject WillyM1919PassengerPCO
ObjectTemplate.setnetworkableInfo WillyM1919BodyInfo
ObjectTemplate.aiTemplate WillyM1919Passenger                    <---------------------
ObjectTemplate.setSoldierExitLocation 1.5/0/-0.8 0/0/0
ObjectTemplate.GUIIndex 53
ObjectTemplate.setVehicleIcon "Vehicle/Icon_BritJeep.tga"
ObjectTemplate.setVehicleIconPos 56/88
ObjectTemplate.setNumberOfWeaponIcons 1
ObjectTemplate.setPrimaryAmmoIcon "Ammo/Icon_bullet.tga"
ObjectTemplate.setPrimaryAmmoBar ABAmmoBarHeatBar
ObjectTemplate.setCrossHairType CHTCrossHair
ObjectTemplate.setVehicleCategory VCLand
ObjectTemplate.setVehicleType VTScoutCar
ObjectTemplate.setToolTipType TTSasWilly
ObjectTemplate.setMinimapIcon "Minimap/minimap_icon_common_16x16.tga"
ObjectTemplate.hasRestrictedExit 1
rem --------------------------------------
ObjectTemplate.addTemplate WillyM1919Entry
ObjectTemplate.setPosition -0.16/-0.35/0.6
ObjectTemplate.addTemplate WillyM1919Entry
ObjectTemplate.setPosition -0.16/-0.35/-0.9
ObjectTemplate.addTemplate WillyM1919PassengerSeat
ObjectTemplate.setPosition 0.3/0.25/-0.499
ObjectTemplate.addTemplate M1919A4_Horz_Rot
ObjectTemplate.setPosition 0.27/0.57/0.28


rem *** WillyM1919GunnerCamera ***
ObjectTemplate.create Camera WillyM1919GunnerCamera


rem *** WillyM1919PassengerSeat ***
ObjectTemplate.create SeatObject WillyM1919PassengerSeat
ObjectTemplate.seatFlags c_SeatShowFullBodySoldier
ObjectTemplate.seatFlags c_SeatIsOutside
ObjectTemplate.seatAnimationUpperBody Ub_PassengerInWilly
ObjectTemplate.seatAnimationLowerBody Lb_PassengerInWilly


rem *** M1919A4_Horz_Rot ***
ObjectTemplate.create RotationalBundle M1919A4_Horz_Rot
ObjectTemplate.setnetworkableInfo WillyM1919TurretInfo
ObjectTemplate.loadSoundScript Sounds/M1919A4Turret.ssc
ObjectTemplate.setMinRotation -45/0/0
ObjectTemplate.setMaxRotation 45/0/0
ObjectTemplate.setMaxSpeed 90/0/0
ObjectTemplate.setAcceleration 5000/0/00
ObjectTemplate.AutomaticYawStabilization 1
ObjectTemplate.setInputToYaw c_PIMouseLookX
ObjectTemplate.addTemplate M1919A4_Vert_Rot
ObjectTemplate.addTemplate M1919A4_Support
ObjectTemplate.setPosition 0.0/-0.159/0.0


rem *** M1919A4_Support ***
ObjectTemplate.create SimpleObject M1919A4_Support
ObjectTemplate.geometry M1919A4_Rotate_M1


rem *** M1919A4_Vert_Rot ***
ObjectTemplate.create RotationalBundle M1919A4_Vert_Rot
ObjectTemplate.setnetworkableInfo WillyM1919TurretInfo
ObjectTemplate.loadSoundScript Sounds/M1919A4Turret.ssc
ObjectTemplate.setMinRotation 0/-15/0
ObjectTemplate.setMaxRotation 0/30/0
ObjectTemplate.setMaxSpeed 0/90/0
ObjectTemplate.setAcceleration 0/5000/0
ObjectTemplate.AutomaticPitchStabilization 1
ObjectTemplate.setInputToPitch c_PIMouseLookY
ObjectTemplate.addTemplate WillyM1919GunnerCamera
ObjectTemplate.setPosition 0.0/0.2/-0.318
ObjectTemplate.addTemplate M1919A4
ObjectTemplate.setPosition 0.0/-0.0689999/0.21
< Objects.rfa/Objects/Vehicles/Land/WillyM1919/Weapons.con >
{The AI template is inserted at the arrow}

Code: Select all

rem *** M1919A4 ***
ObjectTemplate.create FireArms M1919A4
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.setnetworkableInfo Vehicle_M1919A4_Info
ObjectTemplate.geometry M1919A4_Base_M1
ObjectTemplate.aiTemplate M1919A4_AI                    <---------------------
ObjectTemplate.projectileTemplate Browning_Projectile
ObjectTemplate.setTracerTemplate Browning_ProjectileTracer CRD_NONE/0.5/0/0
ObjectTemplate.projectilePosition 0/0/2
ObjectTemplate.magSize -1
ObjectTemplate.numOfMag 1
ObjectTemplate.magType 0
ObjectTemplate.reloadtime 0.1
ObjectTemplate.recoilSpeed 50.0
ObjectTemplate.roundOfFire 12
ObjectTemplate.autoReload 1
ObjectTemplate.setFireCameraShakeAnimationState FireMachineGunShake
ObjectTemplate.velocity 1000
ObjectTemplate.setFireDev 0.9 0.25 0.05
ObjectTemplate.setMinDev 0.5
ObjectTemplate.fireInCameraDof 1
ObjectTemplate.addSkeletonIK Bip01_R_Hand 0.09/0.08/-0.689 0/80/90
ObjectTemplate.addSkeletonIK Bip01_L_Hand -0.069/0.09/-0.719 -104.824/-80.783/92.894
ObjectTemplate.loadSoundScript Sounds/M1919A4.ssc
ObjectTemplate.addTemplate e_MuzzSmoke
ObjectTemplate.setPosition 0.0/0.1/0.762519
ObjectTemplate.startoneffects 1
ObjectTemplate.addTemplate e_Shell792mm
ObjectTemplate.setPosition 0.00999999/0.07/0.37
ObjectTemplate.startoneffects 1


Last edited by Swaffy on Thu May 26, 2011 6:34 pm, edited 1 time in total.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
POTAmatt
Posts: 89
Joined: Mon Dec 07, 2009 9:09 pm
Location: New Yawk

Re: Willy issues: AI won't fire passenger gun? [Video Includ

Post by POTAmatt »

At a quick glance, i see a couple of problems. Changes are in bold.

Set the equipment type to fixed:

aiTemplatePlugIn.create Unit WillyM1919PassengerUnit
aiTemplatePlugIn.equipmentType 4


AI camera rotations need to match horiz/vert rotations of the weapon:

aiTemplatePlugIn.create ControlInfo WillyM1919PassengerCtrl
aiTemplatePlugIn.driveTurnControl PIYaw
aiTemplatePlugIn.driveThrottleControl PIThrottle
aiTemplatePlugIn.aimHorizontalControl PIMouseLookX
aiTemplatePlugIn.aimVerticalControl PIMouseLookY
aiTemplatePlugIn.lookHorizontalControl PIMouseLookX
aiTemplatePlugIn.lookVerticalControl PIMouseLookY
aiTemplatePlugIn.throttleSensitivity -1.0
aiTemplatePlugIn.pitchSensitivity 0.21817
aiTemplatePlugIn.rollSensitivity -0.21817
aiTemplatePlugIn.yawSensitivity -2.5
aiTemplatePlugIn.lookVerticalSensitivity 0.21817
aiTemplatePlugIn.lookHorizontalSensitivity -0.21817
aiTemplatePlugIn.throttleLookAhead 1.0
aiTemplatePlugIn.pitchLookAhead 1.0
aiTemplatePlugIn.rollLookAhead 1.0
aiTemplatePlugIn.yawLookAhead 1.0
aiTemplatePlugIn.lookVerticalLookAhead 1.0
aiTemplatePlugIn.lookHorizontalLookAhead 1.0
aiTemplatePlugIn.throttleScale 1.0
rem *** Angle in radians ***
aiTemplatePlugIn.pitchScale 5.0
aiTemplatePlugIn.rollScale 5.0
aiTemplatePlugIn.yawScale 0.0020
aiTemplatePlugIn.lookVerticalScale 1.0
aiTemplatePlugIn.lookHorizontalScale 1.0
aiTemplatePlugIn.setCameraRelativeMinRotationDeg -45/-15/0
aiTemplatePlugIn.setCameraRelativeMaxRotationDeg 45/30/0
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Willy issues: AI won't fire passenger gun? [Video Includ

Post by Swaffy »

Thank you. It works!
Alright, cool.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
Post Reply