Research with multiple targets?

Research items have a “TargetName” field that targets the specific ships they apply to. Can I list multiple ships here? I have multiple carrier types I need to be able to upgrade with the same tech.

1 Like

Not sure if this is somehow different, but Vaygr upgrades affect multiple ships, so this should be possible, right ? (I’m not a modder so I’m just guessing here).

The Vaygr apply upgrades to “families”. There are several types of families, and I don’t understand the differences between them.

Okay then I guess you have to wait for someone more knowledgeable than me to help you out :wink:

1 Like

There are 10 families:

  • Build Family – This family specifies what ships a builder can build. Examples: Fighter_Hgn, Battlecruiser_Vgr, Frigate_Kus, etc…
  • Display Family – This family specifies which tab you select in order to display the ship. Examples: Fighter, Corvette, SuperCap, etc…
  • Attack Family – This family specifies “how large” a ship is for enemy targeting purposes. Examples: Corvette, Munition, UnAttackable, etc.
  • Dock Family – Similar to the build family, this family what ships can dock with a carrier/“ship-holder”. Examples: Fighter, Corvette, SuperCap, etc…
  • Avoidance Family – This family specifies how other ships should attempt to avoid collisions with this ship. Examples: DontAvoid, Strikecraft, Mothership, etc.
  • Collision Family – Not sure. The only entries in this table are Small, Big, and Unmoveable. This might be how collisions affect the ship; how much the ship moves when a collision occurs.
  • Collision Damage Family – I’m really not sure about this one. The only entries in this table are SmallShip, BigShip, SmallRock and BigRock.
  • Auto Formation Family – This family specifies how the ship attempts to organize itself into a formation. Examples: Fighter, Frigate, SuperCap, etc…
  • Armor Family – This family specifies how much “armor” the ship has for weapon armor penetration calculation (I presume). Examples: Unarmoured, HeavyArmour, ResourceArmour, etc…
  • Unitcaps Family – This family specifies what unitcap the ship belongs in. Examples: Fighter, MinelayerCorvette, Destroyer, Shipyard, Capital, etc…

For research targets, you want to specify a ship (for TargetType = Ship) or a Display Family (for TargetType = Family). You can’t pick and choose which ships in the family get the research technology, but there is a workaround.

The base research:

{
	Name =			"SomeResearch_Base",
	RequiredResearch =	"",
	RequiredSubSystems =	"Research",
	Cost = 			800,
	Time = 			30,
	DisplayedName =		"SomeResearch_Base",
	DisplayPriority =	99999,
	Description =		"SomeResearch_Base",
	UpgradeType =		Modifier,
	TargetType =		Family, -- or Ship
	TargetName = 		"Corvette", -- or "Hgn_SomeShip"
	Icon = 			Icon_Tech,
	ShortDisplayedName = 	"SomeResearch_Base",
},

The entries for each ship:

{
	Name =			"SomeResearch_MGCorvette",
	RequiredResearch =	"SomeResearch_Base",
	RequiredSubSystems =	"",
	Cost = 			0,
	Time = 			0,
	DisplayedName =		"SomeResearch_MGCorvette",
	DisplayPriority =	99999,
	Description =		"SomeResearch_MGCorvette",
	UpgradeType =		Modifier,
	TargetType =		Ship,
	TargetName = 		"Hgn_MultigunCorvette",
	Icon = 			Icon_Tech,
	ShortDisplayedName = 	"SomeResearch_MGCorvette",
},

Another entry for another ship:

{
	Name =			"SomeResearch_FocusCorvette",
	RequiredResearch =	"SomeResearch_Base",
	RequiredSubSystems =	"",
	Cost = 			0,
	Time = 			0,
	DisplayedName =		"SomeResearch_FocusCorvette",
	DisplayPriority =	99999,
	Description =		"SomeResearch_FocusCorvette",
	UpgradeType =		Modifier,
	TargetType =		Ship,
	TargetName = 		"Hgn_FocusCorvette",
	Icon = 			Icon_Tech,
	ShortDisplayedName = 	"SomeResearch_FocusCorvette",
},

Note that the cost and time values are set to 0. This means that they will unlock automatically when the base research is unlocked.

3 Likes

You know, a thread about how to set up a *.SHIP file (in wiki mode in the first post) would be very handy and would generate a lot of debates on it.

In the first post you put a complete SHIP file (functions per line and the EQUAL sign), then, any member can create a post about that function, possible parameters and guiding comments.

Then, edit the first post (or cover post as I prefer) to simply add the LINK to that answer, which will be within the same thread.

@Chimas: What? This was about research, not ships??? Unless I missed something?

As it was said, make one base research item and then everything depending to it with time 0 cost 0. The second you research the first one, the depend ones will research automatically.

Serendipity, my friend …

I don’t care what order or when the items are researched. I just want to minimize the amount of junk I have to add to the research table (and my scripts which parse this table).

Oh, that’s the worst way then.
Make a unique family for all your carriers.
Also Tags? I don’t know what they’re for, but ship now have tags and I think they could be used to categorize your carriers.

Which family?

Also, can a ship belong to multiple of these families?

Here’s some fancy things for you (this file goes into data:scripts/races/<RACE>/scripts/research/<WHATEVER>.lua):

function AutoUnlockResearch(base, targetType, targetName)
	copy = {}
	for k, v in base do
		copy[k] = v
	end
	copy.Name = copy.Name .. targetName
	copy.RequiredResearch = base.Name
	copy.Cost = 0
	copy.Time = 0
	copy.TargetType = targetType
	copy.TargetName = targetName
	return copy
end

SomeResearch_Base = {
	Name =			"SomeResearch_Base",
	RequiredResearch =	"",
	RequiredSubSystems =	"Research",
	Cost = 			800,
	Time = 			30,
	DisplayedName =		"SomeResearch_Base",
	DisplayPriority =	99999,
	Description =		"SomeResearch_Base",
	UpgradeType =		Modifier,
	TargetType =		Family, -- or Ship
	TargetName = 		"Corvette", -- or "Hgn_SomeShip"
	Icon = 			Icon_Tech,
	ShortDisplayedName = 	"SomeResearch_Base",
}

base_research = {
	SomeResearch_Base,
	AutoUnlockResearch(SomeResearch_Base, Ship, "Hgn_MultigunCorvette"),
	AutoUnlockResearch(SomeResearch_Base, Ship, "Hgn_FocusCorvette")
}

-- Add these items to the research tree!
for i,e in base_research do
	research[res_index] = e
	res_index = res_index+1
end

base_research = nil
2 Likes

Interesting. I didn’t think of using loops or functions.