How do I create a new XML entry?

Joined
Dec 31, 2001
Messages
497
Location
Christchurch, New Zealand
I've added a new XML entry to every unit in the units xml and also added the entry in the schema, hoping I could actually make code to activate it (give it meaning) later.

However, it appears I still haven't done enough to let it run the progeam without errors. What have I missed?

I tried to find a decent tutorial to show me how to do this, specifically for units, but couldn't find one. Could someone point me to the right tutorial if it exists please?
 
The tutorial was for adding attributes for leaders, which encompassed three files.
I want to add one attribute for units. I can only find two files associated with this: CIV4UnitInfos.xml and CIV4UnitSchema.xml. So far as I can tell, I have done everything with these I am supposed to. The new attribute I am adding is iVisibilityRange.
 

Attachments

  • Units.zip
    27.8 KB · Views: 29
In addition to adding the ElementType entry as you did, you need to add the line in red as well to the bottom of the ElementType UnitInfo section of CIV4UnitSchema:

Code:
		<element type="HotKey"/>
		<element type="bAltDown"/>
		<element type="bShiftDown"/>
		<element type="bCtrlDown"/>
		<element type="iHotKeyPriority"/>
		<element type="FreePromotions"/>
		<element type="LeaderPromotion"/>
		<element type="iLeaderExperience"/>
		<element type="iOrderPriority" minOccurs="0"/>
		[COLOR="Red"]<element type="iVisibilityRange" minOccurs="0"/>[/COLOR]
	</ElementType>

All entries are defined like this under the ElementType UnitInfo to say that this tag is for units.

You add minOccurs="0" so that all units in the XML don't need your new tag.
 
You need to add a second line for iVisibility in CIV4UnitSchema.xml. The second line should be inserted after line 599 - "<element type="bNoRevealMap"/>" and should use the same syntax.
 
Thx guys. :)

Now, all I have to do is figure out how to activate it. ;)

Yikes though - finding out about minOccurs AFTER already painfully putting the line within each unit.

I take it I can simply generate a default if the entry isn't specified.

Oh, and if someone could point me in the direction of how to compile SDK that would be appreciated too. :)
 
Top Bottom