Replacing (or deleting) items under "Unit_FreePromotions"

XerbSys

Chieftain
Joined
Oct 5, 2010
Messages
19
Hello,

i'me modding a little bit with the anti-air-gun and will give them a uniqe promotion (Interception V) instead of Interception IV. The new promotion is well defined, the problems is how go get rid of the old one?

The given files looks as follows:

<Unit_FreePromotions>
...
<Row>
<UnitType>UNIT_ANTI_AIRCRAFT_GUN</UnitType>
<PromotionType>PROMOTION_INTERCEPTION_IV</PromotionType>
</Row>
<Row>
<UnitType>UNIT_ANTI_AIRCRAFT_GUN</UnitType>
<PromotionType>PROMOTION_ANTI_AIR</PromotionType>
</Row>
...
</Unit_FreePromotions>

How can I change the <PromotionType>PROMOTION_INTERCEPTION_IV</PromotionType>
into
<PromotionType>PROMOTION_INTERCEPTION_V</PromotionType>?

Thanks for ideas!
 
If I'm understanding the question correctly, you're going to want to update the Unit_FreePromotions table. This is pretty easy to do in XML. Use this code (or code such as this) between the <GameData> tags in your XML file (make sure it's tabbed properly):

<Unit_FreePromotions>
<Update>
<Set PromotionType="PROMOTION_INTERCEPTION_V"/>
<Where UnitType="UNIT_ANTI_AIRCRAFT_GUN"/>
</Update>
</Unit_FreePromotions>
 
If I'm understanding the question correctly, you're going to want to update the Unit_FreePromotions table. This is pretty easy to do in XML. Use this code (or code such as this) between the <GameData> tags in your XML file (make sure it's tabbed properly):

<Unit_FreePromotions>
<Update>
<Set PromotionType="PROMOTION_INTERCEPTION_V"/>
<Where UnitType="UNIT_ANTI_AIRCRAFT_GUN"/>
</Update>
</Unit_FreePromotions>
Not quite - this will replace both PROMOTION_INTERCEPTION_IV and PROMOTION_ANTI_AIR with the new promotion. You want to make it like this:
Code:
<Unit_FreePromotions>
	<Update>
		<Set PromotionType="PROMOTION_INTERCEPTION_V"/>
		<Where UnitType="UNIT_ANTI_AIRCRAFT_GUN" [color=red]PromotionType="PROMOTION_INTERCEPTION_IV"[/color]/>
	</Update>
</Unit_FreePromotions>

Also, I normally put the "where" tag before the "set" tag, but I don't know if that makes any difference on the outcome.
 
Thank's a lot, good to know that you can use multiple conditions in in the "where" tag!
 
Also, I normally put the "where" tag before the "set" tag, but I don't know if that makes any difference on the outcome.

It doesn't. But case does, so it really should be the "Where" tag and the "Set" tag.

You can also "double-up" the attributes in the <Set> tag

Code:
<Set Combat="50" Moves="3"/>

or

Code:
<Set>
  <Combat>50</Combat>
  <Moves>3</Moves>
</Set>

but NOT

Code:
<Update>
  <Set Combat="50"/>
  <Set Moves="3"/>
</Update>
 
Back
Top Bottom