City States UU

Gedemon

Modder
Super Moderator
Joined
Oct 4, 2004
Messages
12,781
Location
France
BROKEN with patch .674 for civ5 and G&K.

No update planned at this moment, but may come later (other mods have priority)


(old post starting below)
---------------------------------------

This mod give Unique Units to some city states. Militaristic cities may give you their UU.


City list

- Hanoi : Siamese War Elephant
- Singapore : Siamese War Elephant
- Geneve : Landsknecht
- Vienne : Landsknecht
- Seoul : Cho Ko Nu
- Edinburgh : Highlander
- Stockolm : Housecarl (city trait changed to military)
- Helsinki : Housecarl

extra CS (not included, but available in YnAEMP city states mod)

- Tikal : Jaguar Warrior
- Cuzco : Jaguar Warrior
- Lakota : Mohawk Warrior
- Sutaio : Mohawk Warrior
- Carthage : War Elephant
- Carthage : Camel Archer
- Aksum : Camel Archer
- Ulundi : zulu Impi
- Mogadishu : zulu Impi
- Kinshasa : zulu Impi
- Ife Ile : zulu Impi
- Madrid : Explorer (Conquistador)
- Lisbon (to be released) : Explorer (Conquistador)


New Units included :

- Housecarl : replace Swordsman, no resource used, amphibious
- Highlander : replace Swordsman, no resource used, ignore terrain cost
- Explorer (Conquistador) : replace Musketman, ignore terrain cost, extra sight
- Zulu Impi : replace Warrior, faster healing


Installation

- download the civ5mod file to your mod folder ("..\My Documents\My Games\Sid Meier's Civilization 5\MODS\").
- launch civ5, go to the mod browser and click "install mod"
- find the "City States UU" line and activate the mod.
- from the mod section, go to single player and set up a game


notes:
- you can delete the NewUnits folder in "..\My Documents\My Games\Sid Meier's Civilization 5\MODS\City States UU (v 2)\" if you just want vanilla unique units.
- if you want to merge it in your mod, be sure to put MinorCivilizationsUUTable.xml at the beginning of the "OnModactivated" action list


Instruction for compatibility and merging

1- Adding and editing City States unique units

Spoiler :

- first note that while dependency can't be set, the best method is to edit this mod to your taste or merge it with your. see (2) for merging instruction.
- adding can be done simply with a XML file looking like MinorCivilizationsChange.xml :
Code:
<GameData>
	<MinorCivilization_UnitClassOverrides>
		<Row>
			<MinorCivilizationType>MINOR_CIV_BUDAPEST</MinorCivilizationType>
			<UnitClassType>UNITCLASS_TANK</UnitClassType>
			<UnitType>UNIT_GERMAN_PANZER</UnitType>
		</Row>
	</MinorCivilization_UnitClassOverrides>
</GameData>
- et voilà, Panzers for Budapest...
- just remember to add your files in the Actions tab of your mod properties (OnModActivated / UpdateDatabase / yourfile.xml)

- now you may want to change or remove the UU already set by this mod or others.
- if not done yet, you can have a look at Kael's guide, or here and here for example on how to edit table content via XML
- here's an example on how to remove previous reference of Oslo, Stockholm, Helsinki and Edinburgh then set a new one for Edinburgh :
Code:
<GameData>
	<MinorCivilization_UnitClassOverrides>
		<Delete MinorCivilizationType="MINOR_CIV_OSLO" />
		<Delete MinorCivilizationType="MINOR_CIV_STOCKHOLM"/>
		<Delete MinorCivilizationType="MINOR_CIV_HELSINKI"/>
		<Delete MinorCivilizationType="MINOR_CIV_EDINBURGH"/>
		<Row>
			<MinorCivilizationType>MINOR_CIV_EDINBURGH</MinorCivilizationType>
			<UnitClassType>UNITCLASS_ARCHER</UnitClassType>
			<UnitType>UNIT_ENGLISH_LONGBOWMAN</UnitType>
		</Row>		
	</MinorCivilization_UnitClassOverrides>
</GameData>
- Note that this code has changed an archer class units by a crossbowman class units, the mod does not change the building time of the unit, it's still the archer building time...


2- Merging this mod with yours

Spoiler :

- you need only 2 files : CityStateUU.lua and MinorCivilizationsUUTable.xml
- be sure that MinorCivilizationsUUTable.xml is the first file loaded in the Actions tab of your mod's property section.

CSUU_tut.jpg


- then add your own XML files to define your City States Unique Units (see section 1)

- note that when the mod dependency could be set, merging should be done only if you think that your mod won't be used with other mods using the City States UU feature.


3- Using this mod with R.E.D.

Spoiler :

- R.E.D. already include the graphic definition for the new units of this mod, but the civ5artdefines* files are not compatible between mods, only one can be used.
- To use both mod at the same time, you should delete civ5artdefines_unitmembers.xml and civ5artdefines_units.xml from the City State UU mod folder ("..\My Documents\My Games\Sid Meier's Civilization 5\MODS\City States UU (v 2)\")



Credits & thanx

Deliverator, LoneGamer for their convertions of civ4 units, Walter Hawkwood and Bakuel for the originals units, lemmy101 and CaptainBinky for the tool allowing the convertion.


Version history
Spoiler :

v0.4 (Jun 11, 2011):
- bugfix: only apply CS UU code on new units (no more disembark conversion)

v0.3 (May 08, 2011):
- remove reference to MINOR_CIV_OSLO as it refers to Quebec City since patch 1.0.1.275

v0.2 (Jan 26, 2011):
- remove dependancy to InGame.xml
- convert database entry from xml to sql
- tweak: change highlander move (3 to 2), give amphibious promotion to housecarl
- add: Conquistador and Zulu Impi units
- tweak UU list for CS

v0.1 (Oct 30, 2010) :
- initial release
 
As you've seen in my thread, I was already planning to do the same for my Not Another City States Mod. So would you mind if I borrow from your code to save me some time?

I will leave the vanilla states, as to not compete with your mod. My mod is modular, so easily made compatible with yours (for where the added city states overlap).
Of course, I will also credit you and provide a link in my thread.
 
yep, it's made to be used :)

I thing the best way to use it is to have it activated first, then you just have to put a xml file rule in your mod to overwrite / add vanilla or custom city states UU.

The mod should work fine even if the XML files set UU for a city states that's not present in one of the activated mod.

For exemple, it sets UU for my Yahem and Yagem maps, but if those mod are not activated, it will simply ignore the lines with the non-existing city states.

I'll post a more detailled explanation in the first post later ;)
 
Thanks.
But I would prefer to not have my mod depend on the presence of others, that would cripple its user friendliness.

I have looked into the LUA file and was wondering if it is necessary.
I deciphered 2 of its functions (replacing already present units with the UU versions and being able to donate them). What does it do besides that, and how important are these features? (Does it become incompatible with existing saves? Will the CS be unable to gift any of the UUs?)
 
you can merge it with your's, sure, but I'm afraid of compatibility between CS mods then. (I don't know what will happen when to mod try to create the same table...)

I'm going to release a template version, with just the nedded files to add the UU feature, but nothing else. To bad that the dependencies (or reference, that's more the point here) are not available yet :/
 
I have looked into the LUA file and was wondering if it is necessary.
the XML alone will do nothing (except create a table that won't be used)


I deciphered 2 of its functions (replacing already present units with the UU versions and being able to donate them). What does it do besides that, and how important are these features? (Does it become incompatible with existing saves? Will the CS be unable to gift any of the UUs?)

Each time a unit is created, the LUA check if this unit was created on a city state territory, then it check if this CS has a UU for this class of units, then if available replace this unit by the unique version. That means that if the CS is militaristic, then the created unique unit may happens to be a gift to a player...

Spoiler :
csuu_bhk.jpg
 
Thanks for the explanation and too bad about the dependencies, yes.

But I actually don't think there would be a problem if 2 mods create the same tables, at least not if they are completely identical. Maybe someone with experience in this field could clarify?
If nothing else, I can ask people to delete one of the two.
 
first post edited with more detailled instructions on how to use or merge with other mods.
 
v0.2 without InGame.xml dependancy and 2 new units (Conquistador and zulu Impi), see first post for details.

change log :

v0.2 (Jan 26, 2011):
- remove dependancy to InGame.xml
- convert database entry from xml to sql
- tweak: change highlander move (3 to 2), give amphibious promotion to housecarl
- add: Conquistador and Zulu Impi units
- tweak UU list for CS
 
Maybe remove the Cuzco and Madrid CS as they are capitals in the DLC?

From the Ynaemp city-state mod ?

yes, I will add a check in next version to remove them if a spanish or incan civ is installed.
 
I've been picking the code of the Lua file apart to get some understanding of Lua (thank you for adding comments in the code!) and I now get most of it.
The only thing I don't know is where you got the attributes "playerID" and "unitID" from, I can't find where they are ever defined.

Can you please point me in the right direction?
 
I've been picking the code of the Lua file apart to get some understanding of Lua (thank you for adding comments in the code!) and I now get most of it.
The only thing I don't know is where you got the attributes "playerID" and "unitID" from, I can't find where they are ever defined.

Can you please point me in the right direction?

those are passed by the event "SerialEventUnitCreated"

we don't have access yet to the complete list of arguments from events, and I've not "guessed" them, I've had to search in the vanilla game lua to find example of this event usage first...
 
Thank you, I forgot all about events returning arguments.

Just checked the wiki and it shows a method to find the arguments (if I understood it correctly): making a mods with this in it:
Code:
function Listen(...)

	print(unpack({...}))

end

Events.NameOfEvent.Add(Listen)
 
I'm trying to give Helsinki ski infantry UU from the Danish DLC.

Should I just add the following rows to MinorCivilizationsChange.xml? I tried to test it but so far haven't gotten to the point where city states have riflemen. Also any suggestion how to test the mod faster than playing until riflemen show up?

<Row>
<MinorCivilizationType>MINOR_CIV_HELSINKI</MinorCivilizationType>
<UnitClassType>UNITCLASS_RIFLEMAN</UnitClassType>
<UnitType>UNIT_DANISH_SKI_INFANTRY</UnitType>
</Row>
 
@Torni : using the firetuner you can simply add a normal riflemen on one of Helsinki tiles and see if it's changed to ski infantry

Small update btw :

v0.3 (May 08, 2011):
- remove reference to MINOR_CIV_OSLO as it refers to Quebec City since patch 1.0.1.275
 
Back
Top Bottom