ModModder's Guide

This will probably be answered in your guide once you have the time to get to it, but I have just one quick question. How do I set a specific XML file to override the original from within a module rather than simply adding onto it? For example, I have a module that adds some new leaders, and in that module I have a CIV4CivilizationInfos.xml where I've removed the old leaders for a civ and added the new ones. Yet when I load the game with that module I see both the old leaders and the new ones for that civ, which is not what I want.
 
This will probably be answered in your guide once you have the time to get to it, but I have just one quick question. How do I set a specific XML file to override the original from within a module rather than simply adding onto it? For example, I have a module that adds some new leaders, and in that module I have a CIV4CivilizationInfos.xml where I've removed the old leaders for a civ and added the new ones. Yet when I load the game with that module I see both the old leaders and the new ones for that civ, which is not what I want.

Yeah, it will be in the thread (I'm planning to work on that tonight), but I'll explain it here. Not difficult, really, just have to take an extra step.

There is a tag called <bForceOverwrite>; Set it for your entry. This will force the game to completely replace the standard entry with that of your module, only way to load default values back in.

However, that means you must have the entire entry for the unit/building/civ/whatever you are modifying. Otherwise, it will simply delete everything that is not listed. So make sure you have the entire entry when using that tag. ;)
 
trying to start my 1st module :D.

Question: what for / when do i have to use the unitSchema?

i wanted to start just by adding a new unit or two and grant it a new spell.

do i only need to add the unitSchema when i add a new tag and how do i start the unitinfos.xml then if i dont need to start with unit schema?
 
If you use any xml file in your module that requires a schema (which are all, except the gametext ones), you have to include the schema that is associated with it. Look at the top of the file for what schema you need.
Then you have to rename the schema to something like YOURMOD_CIV4UnitSchema.xml or whatever schema you are using and change the filename in the file that needs the schema too.
look at the chain of command module for how it is done exactly.

Normally you shouldn't touch the schema at all, but it has to be included.
 
The simplest module to look at is the BuildXP module. It contains two real files and a schema; Both files use the UnitSchema.

You must rename the schema (YOURMOD_OriginalFileName.xml), and then change the reference to the schema in your actual file.

To use your unit example... You need Civ4UnitInfos.xml and Civ4UnitSchema.xml. Add "YourModName_" to the front of both of those (YourModName_Civ4UnitSchema.xml), and then in UnitInfos, change the following line:

<Civ4UnitInfos xmlns="x-schema:CIV4UnitSchema.xml">

to

<Civ4UnitInfos xmlns="x-schema:YourModName_CIV4UnitSchema.xml">
 
You don't actually have to rename the schema, but if you don't any later patch that alters the schema will break your module.
 
thx!

another question. wanted to make a spell that converts all living resources into a drained resource. that wasnt too hard as i could copy the fertility code :D and modify it. but then i want the bonus to return to its original form some turns later. i have no idea how to achieve this.
Is there a way to do this like improvements say "10 turns to village"?
If not i could do it like its done with hell terrain and turn the terrain to something drained earth like thingy for 10 turns and then turn it back to the old form but i dont know how to do that, either.
 
Im learning a little modding by myself, but how do I make a spesific unit non buildable?
Im making sheaim (my favourite civ) more funnier, I have a lot of questions but I have solved some by just looking the code.
Is there any good tutorial about how to add units or change unit art?

Thanks! :)
 
You don't actually have to rename the schema, but if you don't any later patch that alters the schema will break your module.

This is true, but renaming it is a good idea regardless. :lol:

thx!

another question. wanted to make a spell that converts all living resources into a drained resource. that wasnt too hard as i could copy the fertility code :D and modify it. but then i want the bonus to return to its original form some turns later. i have no idea how to achieve this.
Is there a way to do this like improvements say "10 turns to village"?
If not i could do it like its done with hell terrain and turn the terrain to something drained earth like thingy for 10 turns and then turn it back to the old form but i dont know how to do that, either.

You can use the setTempBonusType function. For example:

pPlot.setTempBonusType(Bonus, Timer)

Im learning a little modding by myself, but how do I make a specific unit non buildable?
Im making sheaim (my favourite civ) more funnier, I have a lot of questions but I have solved some by just looking the code.
Is there any good tutorial about how to add units or change unit art?

Thanks! :)

There are several ways.... Easiest way would be to use <iCost>-1</iCost>
 
<Civ4UnitInfos xmlns="x-schema:CIV4UnitSchema.xml">
to
<Civ4UnitInfos xmlns="x-schema:YourModName_CIV4UnitSchema.xml">
Is it possible to use relative path to base schema ?? (( Like: "../../Assets/Units/CIV4UnitSchema.xml" ))
 
Is there a (preferably easy) way to add a new specialist type for one Civ only?
 
Top Bottom