Dom Pedro II
Modder For Life
Dynamic Unique Units for Beyond the Sword
The File: Dynamic Unique Units
What it does: This mod allows you the ability to set unique units for different players. Without getting too technical, rather than drawing the player's unique units from the XML, it's now done internally from within the SDK, so you can add and remove them as you please.
New XML Tags
CIV4TechInfos.xml
<FirstUnlockUnit> - This assigns a Unique Unit to be assigned to the first player to research this tech. If the player already has a unique unit in this unit class, it will pass over this player and assign it to the next player to research (or be gifted) this tech. See below for further moddable restrictions...
CIV4BuildingInfos.xml
<UnlockUnit> - This assigns a Unique Unit to be assigned when a player builds a Wonder. If the player already has a unique unit in this unit class, the unit will not be assigned to this player. Players who conquer other players with Wonders that give UUs will get the UUs for themselves. See below for further possible restrictions...
CIV4EventInfos.xml
<UnlockUnit> - This assigns a UU to a player when a particular event occurs. Works just the same as any other event feature. Like the others, if the player already has a unique unit in this unit class slot, the player will not get the unit.
Global Defines
MAX_ASSIGNED_UNIQUE_UNITS - This sets a limit on how many unique units a player can have per game. This value is the most important of the global defines. A value of -1 means unlimited UUs for all players. A value of 0 means no UUs for any player. Once a player has reached the maximum number of UUs, later techs or buildings that unlock UUs will not give anything if you research or build them.
NOTE: The techs give UUs to the first to discover them. If you have a limit on the number of unique units per player, then it's not considered to be "the first" and the next player with a free unique unit slot will get the unit. (This has no effect on any other "first to discover receives" items the tech might give). If there are more than one player on a team, the game will try to assign a unique unit to the discoverer of the tech. If the discoverer is inelligible, it will try with the other teammates.
UPDATE_UNITS_ON_UU_ASSIGNMENT - This causes the game to automatically update all of your default units from the UU unit class (if you have any) to unique units when you unlock a new UU.
LIMIT_UU_WONDER_CONSTRUCTION - This causes you to be unable to train a Wonder that gives a unique unit if you have already reached your maximum number of UUs as defined in the first global definition.
Python
The functions getUniqueUnits(UnitClassTypes eIndex) and setUniqueUnits(UnitClassTypes eIndex, int iUnit) have been exposed to python to allow players to set their own conditions for adding and removing UUs.
Demo: The demo mod included in the zip file removes the unique units for all civilizations and instead makes them acquireable through technologies (and one through a Wonder). I couldn't find tech spaces for all of the units, and it's a little silly to have the Aztecs fighting with Numidian Cavalry, but hey... you go to war with the unique units you've got and not the unique units you wish you had. It's just a proof of concept mod.
From this picture, you can see that we start the game with a regular default warrior. The Quechua has set to be unlocked with the discovery of Meditation.

This is after I've discovered Meditation.

Possible Applications:
I don't like to tell people what to do or not to do with my modcomps, but here's some suggestions that have occurred to me as I was designing this... You could remove all the Civilization Units and instead have 34 non-civ specific UUs or whatever the maximum number of possible players would be in any given game.
You could have a couple of free UUs given for the first person to research techs or get a Wonder. For example, you could create a wonder called Lockheed Skunk Works that would replace the regular Jet Fighter with the F-117. Or make the B-2 a unique unit and give it to the first player to research stealth and some other default stealth bomber for everybody else.
Lots of possibilities even for those who don't want to totally revamp the system but would just like to add a little spice to existing techs, buildings, and events.
Someone good with python could also add UUs that would be assigned when a player gets a particular Resource, adopts a certain Civic, or converts to a particular Religion. You could also have players capture the UUs of other civs when they've conquered them.
Also... if this turns out to be popular (and I hope it does), I'll do the same thing for Unique Buildings.
The File: Dynamic Unique Units
What it does: This mod allows you the ability to set unique units for different players. Without getting too technical, rather than drawing the player's unique units from the XML, it's now done internally from within the SDK, so you can add and remove them as you please.
New XML Tags
CIV4TechInfos.xml
<FirstUnlockUnit> - This assigns a Unique Unit to be assigned to the first player to research this tech. If the player already has a unique unit in this unit class, it will pass over this player and assign it to the next player to research (or be gifted) this tech. See below for further moddable restrictions...
CIV4BuildingInfos.xml
<UnlockUnit> - This assigns a Unique Unit to be assigned when a player builds a Wonder. If the player already has a unique unit in this unit class, the unit will not be assigned to this player. Players who conquer other players with Wonders that give UUs will get the UUs for themselves. See below for further possible restrictions...
CIV4EventInfos.xml
<UnlockUnit> - This assigns a UU to a player when a particular event occurs. Works just the same as any other event feature. Like the others, if the player already has a unique unit in this unit class slot, the player will not get the unit.
Global Defines
MAX_ASSIGNED_UNIQUE_UNITS - This sets a limit on how many unique units a player can have per game. This value is the most important of the global defines. A value of -1 means unlimited UUs for all players. A value of 0 means no UUs for any player. Once a player has reached the maximum number of UUs, later techs or buildings that unlock UUs will not give anything if you research or build them.
NOTE: The techs give UUs to the first to discover them. If you have a limit on the number of unique units per player, then it's not considered to be "the first" and the next player with a free unique unit slot will get the unit. (This has no effect on any other "first to discover receives" items the tech might give). If there are more than one player on a team, the game will try to assign a unique unit to the discoverer of the tech. If the discoverer is inelligible, it will try with the other teammates.
UPDATE_UNITS_ON_UU_ASSIGNMENT - This causes the game to automatically update all of your default units from the UU unit class (if you have any) to unique units when you unlock a new UU.
LIMIT_UU_WONDER_CONSTRUCTION - This causes you to be unable to train a Wonder that gives a unique unit if you have already reached your maximum number of UUs as defined in the first global definition.
Python
The functions getUniqueUnits(UnitClassTypes eIndex) and setUniqueUnits(UnitClassTypes eIndex, int iUnit) have been exposed to python to allow players to set their own conditions for adding and removing UUs.
Demo: The demo mod included in the zip file removes the unique units for all civilizations and instead makes them acquireable through technologies (and one through a Wonder). I couldn't find tech spaces for all of the units, and it's a little silly to have the Aztecs fighting with Numidian Cavalry, but hey... you go to war with the unique units you've got and not the unique units you wish you had. It's just a proof of concept mod.
From this picture, you can see that we start the game with a regular default warrior. The Quechua has set to be unlocked with the discovery of Meditation.

This is after I've discovered Meditation.

Possible Applications:
I don't like to tell people what to do or not to do with my modcomps, but here's some suggestions that have occurred to me as I was designing this... You could remove all the Civilization Units and instead have 34 non-civ specific UUs or whatever the maximum number of possible players would be in any given game.
You could have a couple of free UUs given for the first person to research techs or get a Wonder. For example, you could create a wonder called Lockheed Skunk Works that would replace the regular Jet Fighter with the F-117. Or make the B-2 a unique unit and give it to the first player to research stealth and some other default stealth bomber for everybody else.
Lots of possibilities even for those who don't want to totally revamp the system but would just like to add a little spice to existing techs, buildings, and events.
Someone good with python could also add UUs that would be assigned when a player gets a particular Resource, adopts a certain Civic, or converts to a particular Religion. You could also have players capture the UUs of other civs when they've conquered them.
Also... if this turns out to be popular (and I hope it does), I'll do the same thing for Unique Buildings.