Figuring Out Building Creation

Ooh, good idea @Tbird!
Although to apply it to the Knightly units I'd have to edit the unit infos, at which point it becomes a lot less modular :think:
I guess I could just give the instruction to people not to use it unless they're using v37, and/or to make a backup of their units file, to avoid losing any modifications to units that were done on the SVN since.
 
Ooh, good idea @Tbird!
Although to apply it to the Knightly units I'd have to edit the unit infos, at which point it becomes a lot less modular :think:
I guess I could just give the instruction to people not to use it unless they're using v37, and/or to make a backup of their units file, to avoid losing any modifications to units that were done on the SVN since.

You can add it to the knightly units and still keep it modular. That is what WoC is for. In your mod you have a unitinfos file with something like.
Code:
	<UnitInfo>
		<Type>UNIT_FRED1</Type>
		<SubCombatTypes>
			<SubCombatType>UNITCOMBAT_NEW_KNIGHT1</SubCombatType>
		</SubCombatTypes>
	<UnitInfo>
 
You'll want to review how to add a combat class - there's a link to a document for that on the first page of the modders documentation thread. There could be a few out of date details so if it's not completely followable, ask for clarification there so I know where it's not up to speed yet. Adding Unitcombats aren't quite as straightforward as xml normally is.
 
I found <BuildingHappinessChange> in the BuildingDefines. It doesn't appear to do anything. I don't think its been used anywhere, either. Has anyone used it? Does anyone know how it works?
 
I found <BuildingHappinessChange> in the BuildingDefines. It doesn't appear to do anything. I don't think its been used anywhere, either. Has anyone used it? Does anyone know how it works?

You can see an example if its use in the VokaryaWonders_CIV4BuildingInfos.xml file (modules\vokarya). THere are multiple buildings in there that use it.

It gives extra happiness if both buildings are in the city, the one with the BuildingHappinessChange tag and the one that it mentions. For example, BUILDING_BAYREUTH specifies
Code:
<BuildingHappinessChanges>
				<BuildingHappinessChange>
					<BuildingType>BUILDINGCLASS_OPERA_HOUSE</BuildingType>
					<iHappinessChange>1</iHappinessChange>
				</BuildingHappinessChange>
			</BuildingHappinessChanges>
So if both the wonder and an opera house are in the city it gives +1 happiness.

It might give the happiness to the building with the tags, or it might give +1 happiness to all the specified buildings everywhere. I'm not sure which. It might be shown clearly in the civilopedia entry for that wonder whether it gets +1 happy for having an opera house in the same city, or if it gives +1 happy to opera houses everywhere.

It could be either one, but since these are wonders that use the tag I suspect it is giving any buildings of the specified building class the specified happiness amount globally. Since the same tag is used by civics, that points in the "globally" direction as well.
 
Thanks for the pointer. I fiddled with it a bit, and it didn't seem to say anything in the civilopedia, but I'll check out Vokarya's stuff, presumably it works for him. :goodjob:
 
OK, this is weird. I can't access the Wonders section of the Civilopedia anymore.
Presumably this is the result of my wonders, but I have no idea how :confused:

Assuming that it can't be the XML of the wonders themselves, could this have something to do with references to my subfolder? But I was able to create plenty of functioning wonders without ever running into this problem! Why only now? :sad:

Anyone have any ideas?
 
Interesting... I've included your wonders in my game (SVN 9219) and I had similar problems, but it was not the wonders section of the Civilopedia that disappeared, it was the units section. As a consequence I added the Knightly trait manually to every knight unit and removed the unit-files of the mod mod. Now everything seems to be fine.
 
That's even weirder!
I'm not having any problems with units :hmm:
It must be something to do with the way I included my folder? ...Maybe I'll try moving it into MyMods and see if that solves the problem :huh:

EDIT: If I move the folder to MyMods, the Units AND the Great Wonders sections won't load! What? :run:

EDIT 2: OK, by removing the <init/> line in my AlexMods config XML, which I had forgotten to remove earlier, I solved the problem of the Great Wonders section not working. However, the Units section is still not working, as reported by Kornifere. I'm still not sure why direct editing solved the problem is his case; could this be something related to WOC loading?

EDIT 3: TOKYO DRIFT
SO. It turns out that my unit entry for heavy cavalry contained a superfluous TYPE_ prefix, which was causing the units section of the Civilopedia not to load. However, in fixing it I discovered that the new UnitCombat Knightly completely overwrites all of the old unitcombats, so that knight units only have Knightly and not, say, Melee. :crazyeye: I am continuing to investigate!
 
It looks like unitcombat edits don't like WoC loading. This is why Kornifere could solve the problem by defining them in the unit XMLs directly; my typo wasn't needed to define the unit, and there was also no overwriting.

This does, however, have the unfortunate implication that I can't actually get the Knight wonders working properly without editing the unitfiles directly. Thus making the whole enterprise much less modular, not to mention time consuming for people at home to install. Unless I can figure out someway to distribute Promotions based solely on Unit <Type>. Which would be much less elegant, but oh well.

EDIT: RETURN OF THE EDIT
Turns out I can assign promotions based on unit type rather than unitcombat. Doing so works perfectly, except that it somehow seems to have stopped the Wonders part of the Civilopedia from loading again. Even though the change was to an autobuilding that isn't a wonder!? :wallbash:
 
This does, however, have the unfortunate implication that I can't actually get the Knight wonders working properly without editing the unitfiles directly. Thus making the whole enterprise much less modular, not to mention time consuming for people at home to install. Unless I can figure out someway to distribute Promotions based solely on Unit <Type>. Which would be much less elegant, but oh well.

There is another way.

1) copy all the units you want to add the new combat class into your unit file
2) add the unit class
3) add a line at the end of the XML for each unit containing <bForceOverwrite>1</bForceOverwrite>

This will force your version of the units to be used if your mod is installed.

It is not generally recommended because it can cause other modders problems. It is probably OK in this case but you will need to watch out for other modders changing those units an unlikely event at the moment.
 
Thanks for the tip, but after converting all of the Knight wonders to using unit type the Wonders section magically started working again? So I guess that's fine, I just don't need to use unitcombats at all.
In fact, this way works for modular units, like the Zebra Knight, which refused to cooperate with the other method :cool:

Lessons learnt so far:
1. The Civilopedia is a confusing, fickle mistress.
 
I have updated my mod thread with the hopefully-less-screwy version. :please:

Also, 4 bonus wonders which almost no one is ever going to see, as they come in the Transhuman era. :mischief:


Next up: probably more vicinity bonuses, more wonders, and hopefully I can figure out how to add a new mission to Captives so that they can build Shrunken Heads if you own Headhunter Cult. Assuming such a thing is even possible :salute:
 
and hopefully I can figure out how to add a new mission to Captives so that they can build Shrunken Heads if you own Headhunter Cult. Assuming such a thing is even possible :salute:

You will need a Mission, an Outcome, and on the unit an Action with outcomes to do that. You may need some Python or maybe not;)
 
hopefully I can figure out how to add a new mission to Captives so that they can build Shrunken Heads if you own Headhunter Cult. Assuming such a thing is even possible :salute:

Are both the Shrunken Heads and the Headhunter Cult buildings? If so, you don't need a mission. You only need to add the building to the units building list, like Pigeons can build a Feather Worker.
 
That would simplify things, I had assumed a mission was needed for each building. Maybe I should check out the pigeon :think:
That said, I would like to check out missions anyway, since I think Garland Wars should improve results from sacrificing captives.
 
To keep it modular you need to put this code as an entry in the respective UnitInfo File:

Code:
		<UnitInfo>
			<Class>UNITCLASS_CAPTIVE</Class>
			<Type>UNIT_CAPTIVE</Type>
			<Buildings>
				<Building>
					<BuildingType>BUILDING_SHRUNKEN_HEADS</BuildingType>
					<bBuilding>1</bBuilding>
				</Building>
			</Buildings>
		</UnitInfo>

Don't know if the tags are the right ones, but the structure if correct. You can have it inside your own unit info file to keeps things fully modular.
Of course you then need to have a building entry for the shrunken heads that specify what this building does, how much it costs (-1 if you want it to be only buildable by captives) and other prereqs :goodjob:
 
To keep it modular you need to put this code as an entry in the respective UnitInfo File:

Code:
		<UnitInfo>
			[S][COLOR="Red"]<Class>UNITCLASS_CAPTIVE</Class>[/COLOR][/S]
			<Type>UNIT_CAPTIVE</Type>
			<Buildings>
				<Building>
					<BuildingType>BUILDING_SHRUNKEN_HEADS</BuildingType>
					<bBuilding>1</bBuilding>
				</Building>
			</Buildings>
		</UnitInfo>

Don't know if the tags are the right ones, but the structure if correct. You can have it inside your own unit info file to keeps things fully modular.
Of course you then need to have a building entry for the shrunken heads that specify what this building does, how much it costs (-1 if you want it to be only buildable by captives) and other prereqs :goodjob:

You don't need the Class line. In fact if you do have it then sometimes it can calls errors.

edit In fact to be totally safe when using such a WoC update transaction you should put in some dependency lines to make sure that this bit of XML wont return an error because another modder did something.

Code:
		<UnitInfo>
			<Type>UNIT_CAPTIVE</Type>
			<AndDependencyTypes>
				<DependencyType>UNIT_CAPTIVE</DependencyType>
				<DependencyType>BUILDING_SHRUNKEN_HEADS</DependencyType>
			</AndDependencyTypes>
			<Buildings>
				<Building>
					<BuildingType>BUILDING_SHRUNKEN_HEADS</BuildingType>
					<bBuilding>1</bBuilding>
				</Building>
			</Buildings>
		</UnitInfo>

would be the best.
 
Thanks guys, I've added the shrunken heads building, now buildable by Millitary Captives and Captive Neanderthals. :D
So the dependency tags prevent WOC loading if those objects can't be found? How important is it to add?

In other news, I'm trying to figure out how to get a building to enable the autobuilding of another building in all cities globally. I've been trying to avoid excess Python, so I've tried using AIAndy's expression system. Problem being that I'm not sure how or when RELATION_NEAR can be used.
Currently the code looks like this:
Spoiler :

Code:
<ConstructCondition>
	<And>
		<Not>
			<Has>
				<GOMType>GOM_CIVIC</GOMType>
				<ID>CIVIC_MARXIST</ID>
			</Has>
		</Not>
			<IntegrateOr>
				<RelationType>RELATION_NEAR</RelationType>
				<GameObjectType>GAMEOBJECT_CITY</GameObjectType>
				<iDistance>9000</iDistance>
				<Has>
					<GOMType>GOM_BUILDING</GOMType>
					<ID>BUILDING_COMINTERN</ID>
				</Has>
			</IntegrateOr>
	</And>
</ConstructCondition>

It's supposed to enable construction if a civ isn't running Marxist, and someone builds Comintern, but I can't get the second part to work in-game. Any ideas? :hmm:

In other other news, does anyone know much about nvdxt? I presume there is some way to edit all my images without doing them one at a time, but I can't quite get it to cooperate.
 
Back
Top Bottom