Greetings!
I've found a possible solution with creating a dummy weapon for aiming. This Dummy is the new primary weapon, the machinegun is second and the launcher third. If now an enemy occurs, the dummy weapon aims to him (align the turret correctly without starting the idle-scan while using secondary weapon) and machinegun (enemy infantry) or launcher (enemy vehicle and structure) do the rest.
The code:
Code:
<ModelConditionState
ParseCondStateType="PARSE_DEFAULT">
<Model
Name="AUJeep" />
<WeaponLaunchBone
WeaponSlotID="1"
WeaponSlotType="PRIMARY_WEAPON"
BoneName="WEAPON01"/>
<WeaponFireFXBone
WeaponSlotID="1"
WeaponSlotType="SECONDARY_WEAPON"
BoneName="WEAPON01" />
<WeaponRecoilBone
WeaponSlotID="1"
WeaponSlotType="SECONDARY_WEAPON"
BoneName="WEAPON01" />
<WeaponMuzzleFlash
WeaponSlotID="1"
WeaponSlotType="SECONDARY_WEAPON"
BoneName="WEAPON01" />
<WeaponLaunchBone
WeaponSlotID="1"
WeaponSlotType="SECONDARY_WEAPON"
BoneName="WEAPON01" />
<WeaponFireFXBone
WeaponSlotID="1"
WeaponSlotType="TERTIARY_WEAPON"
BoneName="WEAPON02" />
<WeaponLaunchBone
WeaponSlotID="1"
WeaponSlotType="TERTIARY_WEAPON"
BoneName="WEAPON02"/>
<Turret
TurretNameKey="Turret"
TurretPitch="Barrel"
TurretID="1" />
</ModelConditionState>
<!--.......-->
<!--other unit stuff-->
<!--.......-->
<Behaviors>
<WeaponSetUpdate
id="ModuleTag_WeaponSetUpdate">
<WeaponSlotTurret
ID="1"
AllowInterleavedFiring="true"
InterleavedStyle="INTERLEAVE_FIRST_AVAILABLE"
WeaponChoiceCriteria="PREFER_MOST_DAMAGE">
<Weapon
Ordering="PRIMARY_WEAPON"
Template="AimWeapon" />
<Weapon
Ordering="SECONDARY_WEAPON"
Template="MachineGun" />
<Weapon
Ordering="TERTIARY_WEAPON"
Template="MissileLauncher" />
<TurretSettings
TurretTurnRate="200"
TurretPitchRate="200"
AllowsPitch="true"
MinimumPitch="-15d"
MinIdleScanTime="1.0s"
MaxIdleScanTime="5.0s"
MinIdleScanAngle="0.0"
MaxIdleScanAngle="90.0"
ControlledWeaponSlots="PRIMARY_WEAPON SECONDARY_WEAPON TERTIARY_WEAPON">
<TurretAITargetChooserData
CanAcquireDynamicIfAssignedOutOfRange="true" />
</TurretSettings>
</WeaponSlotTurret>
</WeaponSetUpdate>
<!--other Behaviors-->
</Behaviors>
<AI>
<AIUpdate
id="ModuleTag_AI"
AutoAcquireEnemiesWhenIdle="YES">
<UnitAITargetChooserData
SympathyRange="100.0"
RotateToTargetWhenAiming="false" />
</AIUpdate>
</AI>
The AimWeapon (add to weapon.xml). The AttackRange of all three weapons must be equal to make this working.
Code:
<WeaponTemplate
id="AimWeapon"
Name="AimWeapon"
AttackRange="250.0"
WeaponSpeed="999999.0"
AcceptableAimDelta="1d"
RadiusDamageAffects="ALLIES ENEMIES NEUTRALS"
AntiMask="ANTI_GROUND ANTI_AIRBORNE_VEHICLE ANTI_AIRBORNE_INFANTRY"
CanFireWhileMoving="true"
ClipSize="1"
ReAcquireDetailType="PER_CLIP">
<FiringDuration
MinSeconds="0.1s"
MaxSeconds="0.1s" />
<ClipReloadTime
MinSeconds="0.2s"
MaxSeconds="0.2s" />
<Nuggets>
<SuppressionNugget
Radius="25.0"
Suppression="25"
DurationSeconds="2s">
</SuppressionNugget>
</Nuggets>
</WeaponTemplate>
Better solutions welcome!
Greetz
G.S.