Help adding building to tech tree

JJimmyJ

Chieftain
Joined
Jul 15, 2012
Messages
15
Hello

I've been dipping my toe into modding. I've successfully added a new building into the game, got it showing in civolopedia etc. However, I don't know how to add it to the tech tree. I don't want to replace an existing building, I'd like to add this unique one to be available once 'railroad' has been researched and have the icon for my building show up next to the railroad icon. Can anyone advise me how to do this? I'm assuming the tech tree is linked to an art file somewhere?

Thanks
 
Just set the PrereqTech of the building, like it's done in the original XML files:

Code:
<PrereqTech>TECH_RAILROAD</PrereqTech>

Then it will show on the tech tree (assuming it's the default building of a class, or a unique building of the player's civ).
 
Hi PawelS

Thanks for the response.
I have the xml as above. I haven't done it as a unique building for my civ. I want to add it as available for all civs. I'm not sure what you mean by 'default building of a class'? I've classed it under 'Hospital' as its similar to an aqueduct (which shows as a hospital). Is there a way to add extra icons to the tech tree without replacing existing ones?
 
Building Classes don't mean groups of similar buildings, they mean a set of buildings containing the base (default) version, available for all civs that don't have uniques, and unique versions for specific civs. A civ can't have access to more than one building in a class.

If you don't want to replace an existing building or make it a civ unique, you need to create a new building class, and make your building the default one in this class:

Code:
	<BuildingClasses>
		<Row>
			<Type>BUILDINGCLASS_HOSPITAL</Type>
			<DefaultBuilding>BUILDING_HOSPITAL</DefaultBuilding>
			<Description>TXT_KEY_BUILDING_HOSPITAL</Description>
		</Row>
	</BuildingClasses>

(Replace HOSPITAL with the name of your building.)

The icons on the tech tree are generated automatically based on things available with a given technology, you don't need to add them separately.
 
Ah I see.

I had given it a unique name originally, but didn't realise I would also have to create a new class.
Ok, I should be able to make it work now.

Thanks for the help.
 
Hello again.

I cannot get this to work. Now it won't even show up in game.
Can someone much wiser than I please have a look at the attached and tell me what I'm missing?
I've created a BuildingClass, set VFS to True etc etc but it just won't show in the tech tree.

Thanks
 

Attachments

Looking at the .modinfo file, I can see that there are no Actions defined (OnModActivated -> Update Database). You wrote that in an earlier version your building was visible in the civilopedia, so I assume you know how to do it :)
 
You have no OnModActivated -> UpdateDatabase entries
 
D'oh!!!!

I think I must have been staring at it for too long:)

Thanks both. I now have it working at last :)
 
Back
Top Bottom