How do I prevent a Free Unit (from policy)

Kruelgor

Emperor
Joined
May 12, 2010
Messages
1,165
Location
The United States
Here is the default code:

<Policy_FreeUnitClasses>
<Row>
<PolicyType>POLICY_CITIZENSHIP</PolicyType>
<UnitClassType>UNITCLASS_WORKER</UnitClassType>
<Count>1</Count>
</Row>
</Policy_FreeUnitClasses>



I want to keep the policy CITIZENSHIP, but I do not want it to yield a free unit. How do I delete this segment of code out of the game?
 
How do I delete this segment of code out of the game?

Like so:
Code:
<Policy_FreeUnitClasses>
  <Delete PolicyType="POLICY_CITIZENSHIP"/>
</Policy_FreeUnitClasses>

Pretty easy, huh?

You see, the free unit classes table is a "secondary" table. Deleting a row in it does nothing to the entry it refers to (the POLICY_CITIZENSHIP entry in the "primary" <Policies> table), and no other tables check for the presence of this table so it won't cause dependency issues. As a simple rule of thumb, if a table has an <ID> entry, then it's a primary table and you have to be careful with deletion, but ones like this are completely optional and therefore are safe to delete entries in their entirety.

If you're uncomfortable with deleting things like this, then just set the quantity to 0. Same effect.
 
Hmmmm. I already tried that exact delete code you had there and it didn't work, I must have had something wrong. Nice to know I can also put "0" didn't know that.

Anyway, I already worked around it, but thank you for helping out. I will put your name in the "Special thanks" section of my modded scenario when I'm completed.
 
Hmmmm. I already tried that exact delete code you had there and it didn't work, I must have had something wrong.

We'd have to see your specific code, but if you had any other changes to that table and those other changes were broken, then none of it would get loaded.
(The other common mistake people make is trying to put the <Delete > command inside an <Update> block, like you would a Set/Where. It doesn't work that way.)
 
I'm trying to make the burial tomb available to all civs.

You can't do it that way, because the Burial Tomb shares the same Building Class as the Temple. So removing the entry in the BuildingClassOverrides table would mean that Egypt builds Temples instead of Burial Tombs, but wouldn't do anything to the other civs. No one would be able to make Burial Tombs.

You'd have to create a new building class, and move the Burial Tomb over to that.
 
You can't do it that way, because the Burial Tomb shares the same Building Class as the Temple. So removing the entry in the BuildingClassOverrides table would mean that Egypt builds Temples instead of Burial Tombs, but wouldn't do anything to the other civs. No one would be able to make Burial Tombs.

You'd have to create a new building class, and move the Burial Tomb over to that.

Yep, I figured that one out finally...the hard way after a couple of hours :)
 
Back
Top Bottom