I’m looking at the hgn_attackbomber
. In the ship file it has:
addAbility(NewShipType,"CanAttack",1,3,1,0,0.35,1,"Capturer, Frigate, SmallCapitalShip, BigCapitalShip, Corvette, Corvette_hw1, Fighter, Fighter_hw1, Utility","FlyBy_Bomber_vs_Frigate",
{Fighter="Bomber_vs_Fighter"},
{Fighter_hw1="Bomber_vs_Fighter"},
{Corvette="Bomber_vs_Corvette"},
{Corvette_hw1="Bomber_vs_Corvette"},
{Frigate="Bomber_vs_Frigate"},
{SubSystem="TopAttack_Bomber_vs_Subsystem"},
{SmallCapitalShip="Bomber_vs_SmallCapShip"},
{BigCapitalShip="Bomber_vs_CapShip"},
{Mothership="Bomber_vs_Mothership"},
{ResourceLarge="Flyby_Bomber_vs_ResourceLarge"});
So it can attack stuff. Here are the weapons:
StartShipWeaponConfig(NewShipType,"Hgn_BombLauncher","Weapon_L","Weapon_L");
StartShipWeaponConfig(NewShipType,"Hgn_BombLauncher","Weapon_R","Weapon_R");
StartShipWeaponConfig(NewShipType,"Hgn_AntiShipBombLauncher","Weapon_L","Weapon_L");
StartShipWeaponConfig(NewShipType,"Hgn_AntiShipBombLauncher","Weapon_R","Weapon_R");
StartShipWeaponConfig(NewShipType,"Hgn_AntiSubSystemBombLauncher","Weapon_L","Weapon_L");
StartShipWeaponConfig(NewShipType,"Hgn_AntiSubSystemBombLauncher","Weapon_R","Weapon_R");
That is a lot of weapons. I’m pretty sure it doesn’t fire them all each time. So how does the game know that the “antisubsystembomblauncher” is to be used against subsystems? There is no custom code, so the magic must be in the weapon files.
The weapon files do not seem to have anything special in them, except that hgn_antisubsystembomblauncher.wepn
only has accuracy values for subsystems.
hgn_bomblauncher.wepn
has “Normal Only” as its attack type, but hgn_antisubsystembomblauncher.wepn
and hgn_antishipbomblauncher.wepn
have “Special Attack”, so presumably that is something to do with it.
Improved plasma bomb research does this:
{
Name = "AttackBomberImprovedBombs",
RequiredResearch = "",
RequiredSubSystems = "Research | AdvancedResearch & FighterProduction",
Cost = 1500,
Time = 45,
DisplayedName = "$7517",
DisplayPriority = 30,
Description = "$7518",
UpgradeType = Ability,
TargetType = Ship,
TargetName = "Hgn_AttackBomber",
UpgradeName = "UseSpecialWeaponsInNormalAttack",
Icon = Icon_Ability,
ShortDisplayedName = "$7208",
},
So that presumably takes the “normal” weapon hgn_bomblauncher
out of the picture. So for upgraded bombers how does the game decide between hgn_antisubsystembomblauncher.wepn
and hgn_antishipbomblauncher.wepn
? And more importantly how can I replicate that?