[SDK REQUEST] Multipule Favorite Civics for Leaders

Grave

1 Goat = 400 Horses
Joined
May 5, 2002
Messages
1,530
Location
Louisiana
Can one of you C++ savy types allow Leaders to have multipule Favorite Civics?

This way if a player would like to have a Leader have 2 or more Favorite Civics we could just add them to the XML file at will. I think it would help define certain Leaders characteristics and how the AI would rule their civilizations a little more 'historically accurate'.

And of course if a player would like to keep the game with one Favorite Civic per leader, all they'd have to do is leave the file be... or if they would like two or more Favorite Civics, all they'd need to do is tweak the LeaderHead XML file. It just adds for more customability of the game. :)


Anyway, if somebody could look into this, that'd be awesome. Please PM me if you are interested in doing some work on this.

Thanks,

Grave
 
Ok... I'm trying to take a stab at this. Any of you SDK guys, chime in and tell me if I'm warm.

I'm looking in the CvInfos.cpp file, under "CvLeaderHeadInfo"

Code:
m_iFavoriteCivic(NO_CIVIC),

and...

Code:
int CvLeaderHeadInfo::getFavoriteCivic() const
{
	return m_iFavoriteCivic;


and...

Code:
pXML->GetChildXmlValByName(szTextVal, "FavoriteCivic");
	m_iFavoriteCivic = pXML->FindInInfoClass(szTextVal, GC.getCivicInfo(), sizeof(GC.getCivicInfo((CivicTypes)0)), GC.getNumCivicInfos());

Is it one of these that needs changed? And if so, how do I change it to allow more than one civic?

I'm trying to learn... really I am! :lol: But I never messed with C++ until this morning.

------------------------------------------------------------
*EDIT*

BTW... this is what I'm trying to achieve:

Code:
<FavoriteCivics>
	<FavoriteCivic>CIVIC_FREE_SPEECH
	</FavoriteCivic>
	<FavoriteCivic>CIVIC_FREE_RELIGION
	</FavoriteCivic>
</FavoriteCivics>
 
What you have to do is instead of having favorite civic saved as an enum (an enum is a list of words and you refer to the word by its position on the list), you need it to be saved as an array. This will also require you to change the .xml schema as well as all the functions above and a function called something like ::applyfavoritecivic() in CvDiploparametres.
 
Lord Olleus said:
What you have to do is instead of having favorite civic saved as an enum (an enum is a list of words and you refer to the word by its position on the list), you need it to be saved as an array. This will also require you to change the .xml schema as well as all the functions above and a function called something like ::applyfavoritecivic() in CvDiploparametres.

Ok, so far all I changed was the CIV4CivilizationsSchema.xml and added this:

Code:
<ElementType name="FavoriteCivic" content="textOnly"/>
<ElementType name="AndFavoriteCivic" content="eltOnly">
	<element type="FavoriteCivic" minOccurs="0" maxOccurs="*"/>
</ElementType>

So you're saying I've identified *all* the tags that are needed to be changed in order to add a second Favorite Civic? How would I get it to show up on the Civilopedia? Is that python related?


Also, what do you mean an "array"? I'm afraid you'll have to break these C++ terms down into a level a 5-year could understand. ;)
 
Ok, I've found the array you were talking about. I tried compiling everything, only one error came up, something about not being able to find the link.cpp file (even though it's right were it should be... odd).

I don't know how to edit the Leaderhead screen in the Civilopedia, since I'm python illiterate, to see if I did this right or not. Ugh... this is totally kicking my ass!

To do this mod though... instead of trying to manually create a whole set of code for this, would it be easier for an illiterate C++ guy (me) to find a set of existing code in the game, like a Tech that has a PreReqTech and an AND PreReqTech:

EXAMPLE: Steel (Requires Iron Working AND Chemistry)

If I copied this coding structure, and applied it to civics so that I could get an "AND" Civic, would that work?

Or another copy n' paste idea: Since each Leader has two traits, if I copied the code structure for traits, and modified it to use civics instead, would this be a better approach?


FYI.. I tried the latter idea in what little time I had available this weekend. It compiled with no errors (except for the one I stated in the top of this post). But since I'm also python illiterate, I don't know if it's actually working or not.
 
OK, scrap the Multipule Favorite Civics idea....



... but how about adding Flavor tags to the Civics? Looking into the GameInfoSchema, the Flavor tags are already there. So I figured I could just add them to the Civics portion of that Schema file, and add the Flavor tags to the CivicsInfo file.

But that's not working.

Is there a way to do this without doing any SDK work, since Flavor already exists for Units, Buildings, LeaderHeads, etc? It's already in the GameInfoSchema, so what would it get Civics to have Flavor?
 
Grave did it, I believe. You should be able to find his work in the Components forum under the title Grave's Flavored Civics.
 
I still would like to see multiple favorite civics. It would be very interesting to have Roosevelt pressure you to adopt Universal Suffrage / Free Market / Free Religion, while Stalin wants Police State / State Property. But I guess you can achieve the same thing (almost) using Grave's flavored civics.
 
How come you can't just XML

<FavoriteCivic>CIVIC_REPRESENTATION</FavoriteCivic>
<FavoriteCivc>CIVIC_FREE_MARKET</FavoriteCivc>
etc, etc
 
Because while it would be technically correct in the XML, the game doesn't store all the information. It only has space alotted for one value.

What you would need to do is create an array.

Best and easiest way to do this would be to have a new set of XML tags like this:
Code:
<FavoriteCivics>
  <FavoriteCivic>
    <CivicType>CIVIC_FREE_RELIGION</CivicType>
    <bFavorite>1</bFavorite>
  </FavoriteCivic>
  <FavoriteCivic>
    <CivicType>CIVIC_FREE_MARKET</CivicType>
    <bFavorite>1</bFavorite>
  </FavoriteCivic>
</FavoriteCivics>

So then in the code, we go through all the civics and if it's a favorite, the civ will pick it, and the attitude will change for anybody else who has those civics.
 
Top Bottom