Spent the last week hammering on 666, and I came up with a solution!!!
Since Trebic’s script causes syncs online, I started looking for alternatives. Instead of trying to fix the targeting bug, I simply enabled ships to fire on secondary targets. So imagine the image below, but with all 5 ships firing their weapons at the secondary target in front of them. This works just as good, and is indistinguishable to the player.
Sounds easy right? Well modding is never easy… I know several people (including myself) tried to do this in the past, but kept hitting a brick wall. Turns out there’s a design limitation from 2003, that we weren’t aware of:
"Weapons with “gimble” setting will not periodically update their targeting assignment even if secondary target engagement and independent scanning is enabled. These will “stick” their target to the one designated either by the player, or the ship’s selected target… Use AnimatedTurret if you’d like to have weapons [attack secondary targets]… [For Example] Vagyr and HGN Mothership defense guns function much better as AnimatedTurret setting. Note that this does not require an actual turret model, see Vagyr Battlecruiser’s side hull lasers."
Source: http://hw2wiki.net/wiki.hw2.info/BugsReference_show_comments=1.html
FunctionStartWeaponConfig reference: http://hw2wiki.net/wiki.hw2.info/FunctionStartWeaponConfig.html
FunctionsetAngles reference: http://hw2wiki.net/wiki.hw2.info/FunctionsetAngles.html
Solution
The solution is to convert Gimble weapons to AnimatedTurret weapons, and allow them to fire on secondary targets.
Old:
StartWeaponConfig(NewWeaponType,“Gimble”,“Bullet”,“kinetic_mass”,“Normal”,1900,2000,0,0,0,0,1,1,0,0.36,1.0,1.2,0,0,0,0,0.1,“Normal”,0,0,0);
setAngles(NewWeaponType,25,0,0,0,0);
New:
StartWeaponConfig(NewWeaponType,“AnimatedTurret”,“Bullet”,“kinetic_mass”,“Normal”,1900,2000,0,0,0,0,1,1,0,0.36,1.0,1.2,1,0,500,500,0.1,“Normal”,0,0,0);
setAngles(NewWeaponType,0,-25,25,-25,25);
Changes:
sWeaponType: Gimble -> AnimatedTurret
iShootAtSecondaries: 0 -> 1
iShootAtSurroundings: 0 (best to leave this disabled)
fMaxAzimuthSpeed (Horizontal Tracking): 0 -> 500
fMaxDeclinationSpeed (Verticala Tracking): 0 -> 500
iTrackTargetsOutsideRange: 0 (best to leave this disabled)
fTriggerHappy (FiringArc): 25 -> 0
fMinAzimuth (LeftRotation): 0 -> -25
fMaxAzimuth (RightRotation): 0 -> 25
fMinDeclination (DownRotation): 0 -> -25
fMaxDeclination (UpRotation): 0 -> 25
Ships Affected in Default Game
Hiigaran: Scouts, Interceptors, Bombers
Vaygr: Scouts, Assault Craft, Bombers, Lance, Laser Corvettes
Kushan/Taiidan: Scouts, Interceptors, Bombers, Cloaked Fighters
Weapons Affected in Default Game:
hgn_peashooter.wepn
hgn_kineticautogun.wepn
hgn_antishipbomblauncher.wepn
hw1_scout.wepn
hw1_interceptor.wepn
hw1_bomber.wepn
kus_cloakedfighter.wepn
vgr_flechettecannon.wepn
vgr_antishipbomblauncher.wepn
vgr_lightplasmalance.wepn
vgr_laser.wepn
Note that these weapon conversions will significantly improve their effectiveness, so a balance pass will need to be made after making these changes. Edit: This solution is now in the 2.3 Players Patch.
All credits still go to Trebic for tackling this. Without him, I’m not sure if anyone would have solved this problem anytime soon.