Noob :)

Regis Hastur

Chieftain
Joined
Feb 26, 2007
Messages
38
Location
Germany
I could need some help and hope to get any :)

My mod is "simple". I just want to add Airbases as improvement. But I'm not sure what I have to change. Best thing to start should be CIV5Improvements.xml I thought.

I grabbed the code of a Fort, put it into a file in Modbuddy and altered it to this:

Code:
<GameData>
	<Table name="Improvements">
		<Column name="ImprovementAirUnits" type="boolean" reference="Improvements(Type)" default="false"/>
	</Table>
	<Improvements>
		<Row>
			<Type>IMPROVEMENT_AIRBASE</Type>
			<Description>TXT_KEY_IMPROVEMENT_AIRBASE</Description>
			<Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_AIRBASE_TEXT</Civilopedia>
			<ArtDefineTag>ART_DEF_IMPROVEMENT_AIRBASE</ArtDefineTag>
			<DestroyedWhenPillaged>true</DestroyedWhenPillaged>
			<BuildableOnResources>true</BuildableOnResources>
			<DefenseModifier>15</DefenseModifier>
			<OutsideBorders>true</OutsideBorders>
			<PortraitIndex>24</PortraitIndex>
			<IconAtlas>TERRAIN_ATLAS</IconAtlas>
		</Row>
	</Improvements>
</GameData>

Ok but now it gets tricky for me. I have made some simple progs with C. But I am always confused if more than one file comes along. Where do I see now where I have to look for the rest I have to alter? Where to put the graphic?

What is the "reference"-thing in the column for? Or The <IconAtlas>
Where do I find <ArtDefineTag>; <Civilopedia>; <Describtion>
There must be a file on the top pointing to all those files? Which is it?

So as you see ... I don't get the BIG PICTURE and can't find a place where it is explained.
 
I could need some help and hope to get any :)

My mod is "simple". I just want to add Airbases as improvement. But I'm not sure what I have to change. Best thing to start should be CIV5Improvements.xml I thought.

I grabbed the code of a Fort, put it into a file in Modbuddy and altered it to this:

Code:
<GameData>
	<Table name="Improvements">
		<Column name="ImprovementAirUnits" type="boolean" reference="Improvements(Type)" default="false"/>
	</Table>
	<Improvements>
		<Row>
			<Type>IMPROVEMENT_AIRBASE</Type>
			<Description>TXT_KEY_IMPROVEMENT_AIRBASE</Description>
			<Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_AIRBASE_TEXT</Civilopedia>
			<ArtDefineTag>ART_DEF_IMPROVEMENT_AIRBASE</ArtDefineTag>
			<DestroyedWhenPillaged>true</DestroyedWhenPillaged>
			<BuildableOnResources>true</BuildableOnResources>
			<DefenseModifier>15</DefenseModifier>
			<OutsideBorders>true</OutsideBorders>
			<PortraitIndex>24</PortraitIndex>
			<IconAtlas>TERRAIN_ATLAS</IconAtlas>
		</Row>
	</Improvements>
</GameData>

Ok but now it gets tricky for me. I have made some simple progs with C. But I am always confused if more than one file comes along. Where do I see now where I have to look for the rest I have to alter? Where to put the graphic?

What is the "reference"-thing in the column for? Or The <IconAtlas>
Where do I find <ArtDefineTag>; <Civilopedia>; <Describtion>
There must be a file on the top pointing to all those files? Which is it?

So as you see ... I don't get the BIG PICTURE and can't find a place where it is explained.

Did you figure it out? I'm trying to figure out something similar. Is there somewhere that lists all the commands that are available under <Improvements> <Row>? For example, is there a command to let you build inside ENEMY territory? So confusing.
 
What is the "reference"-thing in the column for?

The Reference entry tells a line what sort of table the expected item would be found in. For instance, let's say you wanted to create an improvement that randomly spawned a unit of a certain type (let's say Brute). You'd set the Reference to the Units table, so that it'd know where to find UNIT_BRUTE. Otherwise, it just sees UNIT_BRUTE as a text string that it has no idea what to do with. Since you're using a boolean, you don't use a Reference because "false" doesn't refer directly to anything found in one of the existing tables.

The fact that you're trying to add a new line to an existing table is an entirely different issue. In general, this is a bad idea, because of what can happen if you try loading multiple mods that do this. You're generally better off creating a new table.

The bigger problem you're going to have is trying to code the Lua in to do what you want (have aircraft base on these). That is NOT going to be trivial; it might not even be possible. Adding a new line to an XML table does absolutely nothing; if you want it to DO anything, you have to code up Lua logic to execute the functionality, and that has a lot of limitations and requires a LOT more work.

Or The <IconAtlas>

Icon Atlases are declared in the GameInfo directory, in the icon atlases file (as you could probably guess). Each represents an 8x8 set of icons in a variety of sizes. So you tell it you need TERRAIN_ATLAS, icon #24, and it knows to use the icon for the Fort because that's what's in slot #24. (Actually the 25th slot, it starts at 0.) But which file it USES for that icon depends on what size icon you need; that Fort icon is available in a half-dozen different sizes depending on whether you need it for the Civiliopedia entry, the worker's button, or the tech tree.

You can't add a new icon to an existing atlas, but you CAN create a new atlas (meaning create a half-dozen DDS files in various sizes, and then link them to a new XML entry). If you're only adding a single icon then this is horribly inefficient, but if you're adding hundreds (like I did in my mod) it's not bad.

Where do I find <ArtDefineTag>

It's in one of the files hidden inside the game's packages. You'd have to use an unpacker if you wanted to add another one, and adding a non-GameData XML file is very different than what you've been doing. (No Row or Update syntax.)

<Civilopedia>; <Description>

These are just text keys; the existing ones can be found in NewText/Language_en_US/(files), assuming you're using a US installation. The reason for this is so that the game can support multiple languages; the improvement table says TXT_KEY_IMPROVEMENT_FORT, and if you're playing in US English mode the text key file translates that to "Fort", while if you're playing in some other language it'd translate it some other way. In Lua, there's a function just for extracting the appropriate text key depending on your current language setting.

There must be a file on the top pointing to all those files? Which is it?

No, there mustn't. That's not how XML works, there's no top-level file. The game takes ALL XML (the existing gamedata, and any OnModActivated/UpdateDatabase or VFS files in your mod), pulls it in, and creates an SQL database using whatever files you want.

And eromrab: the list of what's in the table is right there at the top of the default Improvements file. If it's not in that list, you can't do it in XML. Lua opens up more options, but even there you're still limited by the available functions, and for that list you'd have to go to the wiki.
 
And eromrab: the list of what's in the table is right there at the top of the default Improvements file. If it's not in that list, you can't do it in XML. Lua opens up more options, but even there you're still limited by the available functions, and for that list you'd have to go to the wiki.

So... total noob question... I'm *just* starting to look into this whole modding thing. Is it possible to do something like edit the fort so you can build it in enemy territory? I want to make a fortification that is less effective that can be built when laying enemy cities under siege...
 
So... total noob question... I'm *just* starting to look into this whole modding thing. Is it possible to do something like edit the fort so you can build it in enemy territory? I want to make a fortification that is less effective that can be built when laying enemy cities under siege...

I mean, I see that there is the "OutsideBorders" thing for Improvements. I saw that there is a RivalTerritory one for Units. Is there any way to add RivalTerritory to the Improvements?
 
I saw that there is a RivalTerritory one for Units. Is there any way to add RivalTerritory to the Improvements?

XML doesn't work that way. If the Lua functions underlying this are exposed to the user then you can often create your own functionality that will accomplish similar means, but the fact that an entry appears in one table in no way implies its effect is portable to another table.

Lua functions, in general, are more "activated" than "permissive". It's easy to tell Lua to DO something, it's a lot harder (if not impossible) to flag it so that something CAN be done under certain circumstances.
 
XML doesn't work that way. If the Lua functions underlying this are exposed to the user then you can often create your own functionality that will accomplish similar means, but the fact that an entry appears in one table in no way implies its effect is portable to another table.

Lua functions, in general, are more "activated" than "permissive". It's easy to tell Lua to DO something, it's a lot harder (if not impossible) to flag it so that something CAN be done under certain circumstances.

Ugh. I'm trying to read up on tutorials and look all through this crap.

I dunno. I'm a bit confused, but I'm sure it's in the Lua that I need to be looking. I just don't know what I'd be looking at... haven't progressed that far. Taking some tutorials though.

I just want to know how to make a tile improvement that will look like a barbarian camp and provide defense like a fort (albeit less) yet be able to be built in enemy territory (like roads). That last part is the only part that I can't figure out.
 
Back
Top Bottom