How to make weapons target different classes of ship?

(Taiidan Republic Mod) #1

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",

So it can attack stuff. Here are the weapons:


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?

(GOLIATH Mod) #2


I was just playing with this too. If a weapon’s accuracy is set to 0 against a certain type of target in the wepn file, then it won’t shoot at that target type at all.

(Taiidan Republic Mod) #3

Ah yes, it works! Thank you my friend, with this information I can make my EMP Corvettes much more balanced…