[SDK Component] Unique Great person

Mexico

TR senior programmer
Joined
Dec 2, 2005
Messages
578
Location
Slovakia, Kosice
Unique Great Person SDK component

Version: 0.3w
Released: 19.july.2007
Author: Mexico

support for random / in order name selection, suggested by Chugginator and Gaurav

Version: 0.2w
Released: 5.mar.2007
Author: Mexico

uploaded warlords version (compatible with 2.08) - i forget this
thanx to Gaius Octavius and his Unique Civ-Specific Great People Names mod, where he found this problem

Version: 0.1
Released: 12.oct.2006
Author: Mexico

This component was primary developed by request from Houman for Total realism mod. Now you can set your unique great persons with unique names (like other unique units in game) for each civ - you can have german scientist for germany, American scientists for America, greek artists (aka Homer) for Greek etc..

Download v03w: http://forums.civfanatics.com/uploads/72780/Unique_GP_SDK_component_v0.3w.zip


Instalation:

it is only SDK component - merge files with your own SDK work and recompile
then create unique GP unit for civilization with unique names

for test, there is also compiled DLL for warlords

----------------------------------------
creation of mod was inspired from using
GreatPerson Mod from Patricius
http://forums.civfanatics.com/showthread.php?t=153506

GreatPerson Mod for warlord from Amra
http://forums.civfanatics.com/showthread.php?t=184255

and many others which create GP pictures and now i can't remeber his names (i know about White Rabbit as author of some Great general pictures..)

Note: right now i found a concept of Ethnical diverse GP:
http://forums.civfanatics.com/showthread.php?t=186852
- it look like i do this ideas :)
 
Um, Mexico, you do know that the Great Person Renamer mod already does this right? Is there any reason why you need the SDK for this mod?

Otherwise, :goodjob:
 
TheLopez said:
Um, Mexico, you do know that the Great Person Renamer mod already does this right? Is there any reason why you need the SDK for this mod?

Otherwise, :goodjob:
yes and no - if i am right after studying renamer (and we are using this component too when run out of names), this can generate specific name for civ from pre-defined surnames and familynames. so if you don't set unique names in XML, you got correct names for civilization , but not real. and if you have unique names, this is used for all player regardless to civ

of course, there is possible to set this in this renamer too, byt in python it is more complicated then 3 lines in SDK - and you can set names in XML
my modification uses unique (ethnicaly diverse) great person units
you can set ie UNIT_AMERICAN_SCIENTIST as unique unit UNITCLASS_SCIENTIST for american, which can set only american names (Ie Einstein, Bell, Edison etc...) and UNIT_RUSSIAN_SCIENTIST, which will have unique names Lomonosov, Ciolkovsky etc
and if this names run out, then random generator can be used

Here is part of Civ4unitInfos.xml where is set unique Great generals (for german and american)
Spoiler :

German general:
<UnitInfo>
<Class>UNITCLASS_GREAT_GENERAL</Class>
<Type>UNIT_GERMAN_GREAT_GENERAL</Type>
<UniqueNames>
<UniqueName>Arminius</UniqueName>
<UniqueName>Alarich I</UniqueName>
<UniqueName>Wilhelm I</UniqueName>
<UniqueName>Barbarossa</UniqueName>
<UniqueName>Paul Emil von Lettow-Vorbeck</UniqueName>
<UniqueName>Heinz Guderian</UniqueName>
<UniqueName>Gebhard von Bluecher</UniqueName>
<UniqueName>Erwin Rommel</UniqueName>
<UniqueName>Karl Doenitz</UniqueName>
</UniqueNames>
<Special>SPECIALUNIT_PEOPLE</Special>
<Capture>NONE</Capture>
<Combat>NONE</Combat>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_GENERAL</DefaultUnitAI>

American general:
<UnitInfo>
<Class>UNITCLASS_GREAT_GENERAL</Class>
<Type>UNIT_AMERICAN_GREAT_GENERAL</Type>
<UniqueNames>
<UniqueName>Winfield Scott</UniqueName>
<UniqueName>Samuel Houston</UniqueName>
<UniqueName>Ulysses S. Grant</UniqueName>
<UniqueName>Robert E. Lee</UniqueName>
<UniqueName>Thomas J. Jackson</UniqueName>
<UniqueName>George Patton</UniqueName>
<UniqueName>Dwight D. Eisenhower</UniqueName>
<UniqueName>Douglas MacArthur</UniqueName>
<UniqueName>Norman Schwarzkopf</UniqueName>
</UniqueNames>
<Special>SPECIALUNIT_PEOPLE</Special>



and here is corresponding info in Civ4CivilizationInfos.xml :
Spoiler :

<CivilizationInfo>
<Type>CIVILIZATION_AMERICA</Type>
<Description>TXT_KEY_CIV_AMERICA_DESC</Description>
<ShortDescription>TXT_KEY_CIV_AMERICA_SHORT_DESC</ShortDescription>
<Adjective>TXT_KEY_CIV_AMERICA_ADJECTIVE</Adjective>
<Civilopedia>TXT_KEY_CIV_AMERICA_PEDIA</Civilopedia>
<DefaultPlayerColor>PLAYERCOLOR_BLUE</DefaultPlayerColor>
<ArtDefineTag>ART_DEF_CIVILIZATION_AMERICA</ArtDefineTag>
<ArtStyleType>ARTSTYLE_EUROPEAN</ArtStyleType>
<bPlayable>1</bPlayable>
<bAIPlayable>1</bAIPlayable>
<Cities>
<City>TXT_KEY_CITY_NAME_WASHINGTON</City>
.......removed just for shortened info
</Cities>
<Buildings>
<Building>
<BuildingClassType>BUILDINGCLASS_SUPERMARKET</BuildingClassType>
<BuildingType>BUILDING_AMERICAN_MALL</BuildingType>
</Building>
</Buildings>
<Units>
<Unit>
<UnitClassType>UNITCLASS_INFANTRY</UnitClassType>
<UnitType>UNIT_INFANTRY_AMERICAN</UnitType>
</Unit>
<Unit> <UnitClassType>UNITCLASS_GREAT_GENERAL</UnitClassType>
<UnitType>UNIT_AMERICAN_GREAT_GENERAL</UnitType>
</Unit>

<Unit>
<UnitClassType>UNITCLASS_SETTLER</UnitClassType>
<UnitType>UNIT_AMERICAN_SETTLER</UnitType>
</Unit>
<Unit>
</Units>
 
So what exactly does your sdk code change? In vanilla all units can already have unique names listed in the xml, Fraxis just didn't use them for most units other then GPs. Why couldn't you have done this without any SDK changes?
 
Jeckel said:
So what exactly does your sdk code change? In vanilla all units can already have unique names listed in the xml, Fraxis just didn't use them for most units other then GPs. Why couldn't you have done this without any SDK changes?
no, this system was not working for GP - game engine don't check for unique units - let's say if you have defined unique great prophet units, game pick unit randomly
try this:
set maybe unique great prophet for american with unique names, different from defaullt unit and play as american - you will see that you got great prophet with name from default unit (oh, sometime you can get from your own pool - as i say, game pick unit randomly)

here is code from standard C++:
Code:
		for (iI = 0; iI < GC.getNumUnitInfos(); iI++)
		{
			if (iGreatPeopleUnitRand < getGreatPeopleUnitProgress((UnitTypes)iI))
			{
[B]				eGreatPeopleUnit = ((UnitTypes)iI);[/B]
				break;
			}
			else
			{
				iGreatPeopleUnitRand -= getGreatPeopleUnitProgress((UnitTypes)iI);
			}
		}
		if (eGreatPeopleUnit != NO_UNIT)
		{
			for (iI = 0; iI < GC.getNumUnitInfos(); iI++)
			{
				setGreatPeopleUnitProgress(((UnitTypes)iI), 0);
			}
			
[B]			createGreatPeople(eGreatPeopleUnit, true, false);[/B]
		}

bold is line, where unit is selected and used - where is check if this ID is unique unit for civilization???? getNumUnitInfos() return number of ALL units defined in XML

so i added this modification - check if selected unit has unique alternative for player and if has, chage selction to this:
Code:
		if (eGreatPeopleUnit != NO_UNIT)
		{
			for (iI = 0; iI < GC.getNumUnitInfos(); iI++)
			{
				setGreatPeopleUnitProgress(((UnitTypes)iI), 0);
			}
			
[I]			// Unique Great People by Mexico, 12.oct.06
			UnitClassTypes eUnitClass = (UnitClassTypes)GC.getUnitInfo(eGreatPeopleUnit).getUnitClassType();
			UnitTypes iUniqueUnit = (UnitTypes)GC.getCivilizationInfo((CivilizationTypes)GET_PLAYER(getOwnerINLINE()).getCivilizationType()).getCivilizationUnits((int)eUnitClass);
			eGreatPeopleUnit = (UnitTypes)((iUniqueUnit != NO_UNIT) ? iUniqueUnit : eGreatPeopleUnit);
			// END
[/I]			createGreatPeople(eGreatPeopleUnit, true, false);
		}
 
Could you be a little more step by step in your instructions for installing this for newbs like me? :D
 
Mexico, may I request another single component that only changes the order in which Great People appear in, for Warlords? It would involve an XML global define switch between ordered and random, so that the great people will appear in what order they are listed in the CIV4UnitInfos.xml file instead of randomly from that list.
This would be really helpful as I can't stand getting a modern great person (like Albert Einstein if you're playing as America) as your first great person in the ancient or classical era.
Anyway, hope you consider it, thanks.

Chuggy
 
Mexico, may I request another single component that only changes the order in which Great People appear in, for Warlords? It would involve an XML global define switch between ordered and random, so that the great people will appear in what order they are listed in the CIV4UnitInfos.xml file instead of randomly from that list.
This would be really helpful as I can't stand getting a modern great person (like Albert Einstein if you're playing as America) as your first great person in the ancient or classical era.
Anyway, hope you consider it, thanks.

Chuggy

interesting idea, i will do this
 
I'd like to see a way for the SDK to fork to alternate Unit Names without having multiple UU for every civ. The name lists for each Civ could be placed either on the CivilizationInfo.xml or on a new file.
 
There's a way to do that, Impaler[WrG].

For me, it was actually very simple because I used TheLopez's renamer mod as a base. I just added a tag to the Python renaming utility to check the unit type, and it then makes the appropriate civ-specific selection. Of course, this isn't in SDK, which is what you really wanted... :)
 
This modcomp looks very interesting - in fact soviet union getting Einstein or Guderian or USA getting Zukhov is one of the eysore in civ4.

I have just one question.
How it looks in Civilopedia?
Does it create many Generals / Propets / Scientists /.... in Civilopedia ?
 
This modcomp looks very interesting - in fact soviet union getting Einstein or Guderian or USA getting Zukhov is one of the eysore in civ4.

I have just one question.
How it looks in Civilopedia?
Does it create many Generals / Propets / Scientists /.... in Civilopedia ?

yes, this is small issue - create too much entries
 
Mexico, may I request another single component that only changes the order in which Great People appear in, for Warlords? It would involve an XML global define switch between ordered and random, so that the great people will appear in what order they are listed in the CIV4UnitInfos.xml file instead of randomly from that list.
This would be really helpful as I can't stand getting a modern great person (like Albert Einstein if you're playing as America) as your first great person in the ancient or classical era.
Anyway, hope you consider it, thanks.

Chuggy

interesting idea, i will do this

Any updates.........?

If not could you do it for BtS instead when they release the code?
 
If this mod does make a lot of new units in a Civilopedia, you can install Gaurav's Sevopedia 2.2a, which can hide duplicate units like that.

You don't even need to do that--it's literally a two line code in XML to hide pedia entries: one in Schema, and one in the UnitInfos file.

Mexico, I have successfully developed the basic Python version to implement this without over 100 UUs, but there is one problem: when the Great Person gets renamed, the new name is not passed to the event log, so you get "Great [] has been born in []!" instead of "Isaac Newton has been born in []!" Is there an easy way to mod out the existing SDK event notification so that we can define a new one in Python?
 
Top Bottom