How to get the free habor effects of Carthage?

Elfdemon

Chieftain
Joined
Oct 9, 2007
Messages
65
In a recent game I edited the xml of Maria of Austria, adding the following trait in addition to the diplomatic marriage trait:

<Row>
<LeaderType>LEADER_MARIA</LeaderType>
<TraitType>TRAIT_PHOENICIAN_HERITAGE</TraitType>
</Row>

The problem is, this Carthage unique trait only partially works. The trait of Carthage has two abilities, one is free harbors for every coastal citiy, another is units can cross mountains once you got a general. I've tested it and found out that the mountain-crossing ability DO work, but the free harbor ability DO NOT.

Can anyone tell me what's wrong with that? Do I need to edit other files to get the free harbor effect done? Please tell! Thanks.
 
Just did a lil testing. It seems the free harbor thing only works if it is Austria's only trait, it won't work if there is any other trait (but the mountain-crossing ability of the trait still works). This is strange, because normally you can stack up multiple traits with no problem. But for the phoenician_heritage trait, only the mountain thing work in all circumstences, the free harbor thing stops working if phoenician_heritage is NOT the only trait that a leader has.

Anyway, can anyone please suggest a solution? How to get the free harbor effect to work?
 
Just did a lil testing. It seems the free harbor thing only works if it is Austria's only trait, it won't work if there is any other trait (but the mountain-crossing ability of the trait still works). This is strange, because normally you can stack up multiple traits with no problem. But for the phoenician_heritage trait, only the mountain thing work in all circumstences, the free harbor thing stops working if phoenician_heritage is NOT the only trait that a leader has.

Anyway, can anyone please suggest a solution? How to get the free harbor effect to work?

Instead of stacking traits, why don't you just add the harbor effect to the diplomatic marriage trait? Just add the line <FreeBuilding>BUILDING_HARBOR</FreeBuilding> to the end of the diplomatic marriage trait, or just combine both traits into one super trait:

<Type>TRAIT_ANNEX_CITY_STATE</Type>
<Description>TXT_KEY_TRAIT_ANNEX_CITY_STATE</Description>
<ShortDescription>TXT_KEY_TRAIT_ANNEX_CITY_STATE_SHORT</ShortDescription>
<AbleToAnnexCityStates>true</AbleToAnnexCityStates>
<CrossesMountainsAfterGreatGeneral>true</CrossesMountainsAfterGreatGeneral>
<FreeBuilding>BUILDING_HARBOR</FreeBuilding>

You'll have to update the text file for the trait description to say it does all that, but it will function.
 
Instead of stacking traits, why don't you just add the harbor effect to the diplomatic marriage trait? Just add the line <FreeBuilding>BUILDING_HARBOR</FreeBuilding> to the end of the diplomatic marriage trait, or just combine both traits into one super trait:

<Type>TRAIT_ANNEX_CITY_STATE</Type>
<Description>TXT_KEY_TRAIT_ANNEX_CITY_STATE</Description>
<ShortDescription>TXT_KEY_TRAIT_ANNEX_CITY_STATE_SHORT</ShortDescription>
<AbleToAnnexCityStates>true</AbleToAnnexCityStates>
<CrossesMountainsAfterGreatGeneral>true</CrossesMountainsAfterGreatGeneral>
<FreeBuilding>BUILDING_HARBOR</FreeBuilding>

You'll have to update the text file for the trait description to say it does all that, but it will function.

Thanks for your suggestion, but it does not work. You can try it yourself if you don't believe me.

There's something weird about this free harbor thing.......
 
Thanks for your suggestion, but it does not work. You can try it yourself if you don't believe me.

There's something weird about this free harbor thing.......

Okay, so I did just try it.

I made a simple mod

Code:
<GameData>
	<Traits>
		<Update>
			<Where Type="TRAIT_ANNEX_CITY_STATE"/>
			<Set>
				<FreeBuilding>BUILDING_HARBOR</FreeBuilding>
			</Set>
		</Update>
	</Traits>
</GameData>

Adding the free harbor building to the diplomatic marriage trait and... it worked. So something must be wrong with your XML.

The only other obvious thing I can think of is that the free harbor only appears in coastal cities and you've just been checking in-land cities.
 
Okay, so I did just try it.

I made a simple mod

Code:
<GameData>
	<Traits>
		<Update>
			<Where Type="TRAIT_ANNEX_CITY_STATE"/>
			<Set>
				<FreeBuilding>BUILDING_HARBOR</FreeBuilding>
			</Set>
		</Update>
	</Traits>
</GameData>

Adding the free harbor building to the diplomatic marriage trait and... it worked. So something must be wrong with your XML.

The only other obvious thing I can think of is that the free harbor only appears in coastal cities and you've just been checking in-land cities.

Which file am I supposed to add this in? I added it in CIV5Traits_Expansion but did not work.
 
Which file am I supposed to add this in? I added it in CIV5Traits_Expansion but did not work.

You don't have to add it to any file. It uses the update function so it will update the trait's XML.

Though, from the sound of it, I'm a little confused as how you're making this mod and I think that's the source of your problems. Are you making a mod, using mod buddy, or are you directly editing the base XML files?
 
You don't have to add it to any file. It uses the update function so it will update the trait's XML.

Though, from the sound of it, I'm a little confused as how you're making this mod and I think that's the source of your problems. Are you making a mod, using mod buddy, or are you directly editing the base XML files?

Hey, sorry to revive this old thread. I'm currently working on the America All Uniques mod and have run into something like what Elfdemon did when he tried to add the free harbors ability to Austria. I'm basically updating Washington to have all traits, but the free harbors don't show up. I understand I could add the
Code:
<FreeBuilding>BUILDING_HARBOR</FreeBuilding>
to Washington's trait or something, but that seems hackish and I'm afraid it could end up breaking something else. Does anyone understand exactly why it is that the direct addition of the trait does not work?

Thanks for the help!
 
Hey, sorry to revive this old thread. I'm currently working on the America All Uniques mod and have run into something like what Elfdemon did when he tried to add the free harbors ability to Austria. I'm basically updating Washington to have all traits, but the free harbors don't show up. I understand I could add the
Code:
<FreeBuilding>BUILDING_HARBOR</FreeBuilding>
to Washington's trait or something, but that seems hackish and I'm afraid it could end up breaking something else. Does anyone understand exactly why it is that the direct addition of the trait does not work?

Thanks for the help!


Row doesn't work if the data already exists.
 
Row doesn't work if the data already exists.

Gotcha. I tried adding
Code:
	<Traits>
		<Update>
			<Where Type="TRAIT_RIVER_EXPANSION"/>
			<Set>
				<FreeBuilding>BUILDING_HARBOR</FreeBuilding>
			</Set>
		</Update>
	</Traits>

as turingmachine suggested above, but that didn't seem to work either. The mod is a bit messy right now and some stuff doesn't work properly, but I'm working on fixing it.
 
If I'm reading things correctly free buildings from traits will be bugged if the leader has multiple traits. This is because of two things:
*It will only return the first FreeBuilding, no matter how many there are or how many traits they are in.
*By default FreeBuilding is set to NO_BUILDING, meaning this is what we return for any trait which doesn't set it to something else.

So if you give Washington all traits then whichever trait is first will return NO_BUILDING and nothing else will matter. If it's really important to you that he has it I would recommend making one super trait that is a combination of all other traits. Or, if you know c++ (at least a little) you could edit the source code to make it work better.
 
I figured TRAIT_RIVER_EXPANSION would be the first trait, since it's Washington's original trait and the first I mod through the XML. I'd make a "supertrait", but there's checks for existence of a trait elsewhere (can't remember specifics right now, but something like unit promotions if a certain trait is enabled), so this might be a little bit more complex than it seems at first glance.
 
With first trait I mean first trait read by the game (that the leader has). Each trait has a number associated with it, depending on the order in which they are loaded by the game.

Looking closer it seems like TRAIT_PHILOSOPHICAL is always the first trait (given ID of 0 in the files, which is the first ID). This trait doesn't seem to be used anywhere I can tell, so you could hijack it and give it harbor as a FreeBuilding.
 
With first trait I mean first trait read by the game (that the leader has). Each trait has a number associated with it, depending on the order in which they are loaded by the game.

Looking closer it seems like TRAIT_PHILOSOPHICAL is always the first trait (given ID of 0 in the files, which is the first ID). This trait doesn't seem to be used anywhere I can tell, so you could hijack it and give it harbor as a FreeBuilding.

Thanks a lot, snarko!

I was able to update TRAIT_PHILOSOPHICAL:

Code:
<Traits>
	<Update>
		<Where Type="TRAIT_PHILOSOPHICAL"/>
		<Set>
			<GreatPeopleRateModifier>0</GreatPeopleRateModifier>
		</Set>
	</Update>
	<Update>
		<Where Type="TRAIT_PHILOSOPHICAL"/>
		<Set>
			<FreeBuilding>BUILDING_HARBOR</FreeBuilding>
		</Set>
	</Update>
</Traits>

then it was the simple matter of adding the trait to Washington:

Code:
<Leader_Traits>
	<Row>
		<LeaderType>LEADER_WASHINGTON</LeaderType>
		<TraitType>TRAIT_PHILOSOPHICAL</TraitType>
	</Row>
</Leader_Traits>

And now America has free harbors! Now on to find and fix more bugs...
 
Back
Top Bottom