View Full Version : "Obsolete" Units


RERomine
Jul 17, 2007, 02:05 PM
Does anyone know which .XML file specifies when a unit becomes "obsolete"? I'm making some changes to my game and one of the things I want to do is stop units from becoming obsolete when they really aren't. This is with the vanilla version of Civ IV. I'm looking at four units in particular: Infantry, SAM Infantry, Marines and SEALs. Marines and SEALs are still better for amphibious assaults than Mech Infantry and should still be available. SAM Infantry is better at intercepting aircraft and should be around for that reason. As for Infantry, I just like the idea of having a light infantry unit available. If possible, I want to mod it so light units can move through mountains. Not sure if I can, but I haven't gotten that far yet.

snarko
Jul 17, 2007, 02:21 PM
I believe the unit is obsolete when you have the techs for all the units it upgrade to. A way to prevent this would be making a tech noone can research and a unit requiring this tech. Then make the units you don't want to obsolete upgrade to this (never buildable) unit.

RERomine
Jul 17, 2007, 02:54 PM
I believe the unit is obsolete when you have the techs for all the units it upgrade to. A way to prevent this would be making a tech noone can research and a unit requiring this tech. Then make the units you don't want to obsolete upgrade to this (never buildable) unit.

I looked at the .XML and that makes sense. Once all units a unit can upgrade to are available, that unit seems to become obsolete. Now I just have to decide what mythical unit to create :)

Mewtarthio
Jul 17, 2007, 07:09 PM
I looked at the .XML and that makes sense. Once all units a unit can upgrade to are available, that unit seems to become obsolete. Now I just have to decide what mythical unit to create :)

Tech: Porcine Flight
Unit: Frozen Devil

EmperorFool
Jul 17, 2007, 07:42 PM
Or you could make it so those units don't upgrade to Mech Inf. That makes a certain sense to me, though clearly breaks the normal expectation. I think of it like this: Mech Inf is to Infantry as Tank is to Cavalry (which don't upgrade to Tank).

RERomine
Jul 18, 2007, 10:04 AM
Or you could make it so those units don't upgrade to Mech Inf. That makes a certain sense to me, though clearly breaks the normal expectation. I think of it like this: Mech Inf is to Infantry as Tank is to Cavalry (which don't upgrade to Tank).

I do like how they managed to attach a chopper blade to a horse :)

Currently, I have just eliminated the upgrade of the units I mentioned as a quick approach. The XML is on the testy side and since the schemas aren't actually XSD files and referenced in the XML, I can't validate the XML against the schema until I start the game.

Personally, I hate the way the XML is done. Hasn't Firaxis ever heard of an "attribute"? :confused:

Dom Pedro II
Jul 18, 2007, 02:16 PM
If you don't want a unit to become obsolete by being replaced with an upgraded unit, don't have it upgrade to another unit.... do that in the CIV4UnitInfos.xml file.

If you want a unit to become obsolete but not able to upgrade to anything (so that it no longer appears in the build queue) you'll need a small mod component I made that can be found in the Mod Components forum.

Dom Pedro II
Jul 18, 2007, 02:18 PM
Currently, I have just eliminated the upgrade of the units I mentioned as a quick approach. The XML is on the testy side and since the schemas aren't actually XSD files and referenced in the XML, I can't validate the XML against the schema until I start the game.

A trade secret taught to me a couple of months ago is to try to open it in Internet Explorer. If you've followed the schema, it should open fine. If not, you'll get an error. It's not foolproof, but it works well in my experience.

RERomine
Jul 19, 2007, 11:53 AM
A trade secret taught to me a couple of months ago is to try to open it in Internet Explorer. If you've followed the schema, it should open fine. If not, you'll get an error. It's not foolproof, but it works well in my experience.

I've got XMLSpy that I use for work, so that's the editting tool I use. If the schema was in referenced in the XML, I could validate against the schema without having to try to run it. As it is, the XML is validating as "well formed", but it wasn't loading. In the end, I just commented out the upgrade references to the units I didn't want to disappear from the build list.

Dom Pedro II
Jul 19, 2007, 01:13 PM
Well, commenting out works fine, but you could just remove the upgrade unit references. But that's just a matter of preference really.

RERomine
Jul 20, 2007, 10:09 AM
Well, commenting out works fine, but you could just remove the upgrade unit references. But that's just a matter of preference really.

Ultimately, I want to put the commented out code back in because I'm not sure how the AI will respond to the presence of units less powerful than Mech Infantry. I don't want the AI to start deleting these units for the more powerful Mech Infantry unit. That would result in it pretty much penalizing itself for changes I've made. If the upgrade remains available, units it deems weak will probably upgraded rather than disbanded. Only play testing will let help me figure out what the AI does.

Also, part of my changes included restoring the cargo capacity of the Mech Infantry that was present in Civ III. They can now carry 1 "light unit", which I classified as anything with a speed of 1 and also workers and settlers. I'll have to play with it some to see if I like the affect of the changes. Workers and settlers may end up being dropped out of that "light unit" list because they are non-combatants, with a speed of at least 2. Also, "riding" in the Mech Infantry unit might result in them being destroyed with the unit if destroyed. This again might penalize the AI and it's also unrealistic. Civilian don't ride in military vehicles, at least not in large numbers.