Advertisement
Civilization Fanatics' Center  

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - SDK/Python

Reply
 
Thread Tools
Old Sep 20, 2006, 08:12 AM   #1
Grave
1 Goat = 400 Horses
 
Grave's Avatar
 
Join Date: May 2002
Location: Louisiana
Posts: 1,530
[SDK REQUEST] Multipule Favorite Civics for Leaders

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
__________________
HISTORY IN THE MAKING II
A Modpack for CIVILIZATION V: Brave New World


HISTORY IN THE MAKING
A Modpack for CIVILIZATION IV: Beyond the Sword
Grave is offline   Reply With Quote
Old Sep 23, 2006, 07:08 AM   #2
Grave
1 Goat = 400 Horses
 
Grave's Avatar
 
Join Date: May 2002
Location: Louisiana
Posts: 1,530
T T T

... for such a novel idea.
__________________
HISTORY IN THE MAKING II
A Modpack for CIVILIZATION V: Brave New World


HISTORY IN THE MAKING
A Modpack for CIVILIZATION IV: Beyond the Sword
Grave is offline   Reply With Quote
Old Sep 23, 2006, 10:28 AM   #3
Grave
1 Goat = 400 Horses
 
Grave's Avatar
 
Join Date: May 2002
Location: Louisiana
Posts: 1,530
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! 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>
__________________
HISTORY IN THE MAKING II
A Modpack for CIVILIZATION V: Brave New World


HISTORY IN THE MAKING
A Modpack for CIVILIZATION IV: Beyond the Sword

Last edited by Grave; Sep 23, 2006 at 11:02 PM.
Grave is offline   Reply With Quote
Old Sep 23, 2006, 11:00 AM   #4
Lord Olleus
Deity
 
Lord Olleus's Avatar
 
Join Date: Oct 2005
Location: England
Posts: 5,083
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.
__________________
Most zealously I seek for erudition. Much do I know, but to know all is my ambition.
-Faust
Lord Olleus is offline   Reply With Quote
Old Sep 23, 2006, 06:43 PM   #5
Grave
1 Goat = 400 Horses
 
Grave's Avatar
 
Join Date: May 2002
Location: Louisiana
Posts: 1,530
Quote:
Originally Posted by Lord Olleus
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.
__________________
HISTORY IN THE MAKING II
A Modpack for CIVILIZATION V: Brave New World


HISTORY IN THE MAKING
A Modpack for CIVILIZATION IV: Beyond the Sword
Grave is offline   Reply With Quote
Old Sep 25, 2006, 08:27 AM   #6
Grave
1 Goat = 400 Horses
 
Grave's Avatar
 
Join Date: May 2002
Location: Louisiana
Posts: 1,530
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.
__________________
HISTORY IN THE MAKING II
A Modpack for CIVILIZATION V: Brave New World


HISTORY IN THE MAKING
A Modpack for CIVILIZATION IV: Beyond the Sword

Last edited by Grave; Sep 25, 2006 at 08:31 AM.
Grave is offline   Reply With Quote
Old Nov 30, 2006, 10:16 PM   #7
Grave
1 Goat = 400 Horses
 
Grave's Avatar
 
Join Date: May 2002
Location: Louisiana
Posts: 1,530
I'm gonna bump this again, as I'm still working on this and would need some assistance.
__________________
HISTORY IN THE MAKING II
A Modpack for CIVILIZATION V: Brave New World


HISTORY IN THE MAKING
A Modpack for CIVILIZATION IV: Beyond the Sword
Grave is offline   Reply With Quote
Old Dec 27, 2006, 02:07 PM   #8
Grave
1 Goat = 400 Horses
 
Grave's Avatar
 
Join Date: May 2002
Location: Louisiana
Posts: 1,530
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?
__________________
HISTORY IN THE MAKING II
A Modpack for CIVILIZATION V: Brave New World


HISTORY IN THE MAKING
A Modpack for CIVILIZATION IV: Beyond the Sword
Grave is offline   Reply With Quote
Old May 24, 2007, 06:48 PM   #9
ripple01
Emperor
 
Join Date: Mar 2006
Location: New York City
Posts: 1,202
Sorry for the thread necromancy, but has anyone attempted to add Flavor tags to the civics as Grave describes here? Does it require a SDK change, and if so is it a drastic one?

Cheers,
ripple01
ripple01 is offline   Reply With Quote
Old May 24, 2007, 07:39 PM   #10
Vrenir
King
 
Vrenir's Avatar
 
Join Date: Oct 2006
Location: Washington State
Posts: 820
Grave did it, I believe. You should be able to find his work in the Components forum under the title Grave's Flavored Civics.
Vrenir is offline   Reply With Quote
Old May 25, 2007, 03:12 PM   #11
Gaius Octavius
Deity
 
Gaius Octavius's Avatar
 
Join Date: Jul 2006
Posts: 4,016
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.
Gaius Octavius is offline   Reply With Quote
Old May 27, 2007, 06:09 PM   #12
Emperor2
Capitalist Missionary
 
Emperor2's Avatar
 
Join Date: Dec 2006
Location: Capitalist Paradise
Posts: 916
How come you can't just XML

<FavoriteCivic>CIVIC_REPRESENTATION</FavoriteCivic>
<FavoriteCivc>CIVIC_FREE_MARKET</FavoriteCivc>
etc, etc
Emperor2 is offline   Reply With Quote
Old May 28, 2007, 10:13 AM   #13
Dom Pedro II
Modder For Life
 
Dom Pedro II's Avatar
 
Join Date: Apr 2002
Location: Exit 16, New Jersey
Posts: 6,811
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.
__________________
Dynamic Unique Units Modcomp : Announcing Dom Pedro II's Civilization 4: Test of Time : Dom Pedro II's Mod Helper for Python Modders and those who would like to be

One night I dreamt of wondrous things. When I awoke, I made a mod.
Dom Pedro II is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - SDK/Python > [SDK REQUEST] Multipule Favorite Civics for Leaders

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SDK/XML REQUEST] Flavored Civics Grave Civ4 - Creation & Customization 13 Feb 10, 2008 10:57 AM
Leaders' Favorite Civics and other notes Runner Civ4 - Strategy & Tips 6 Jun 26, 2007 08:26 AM
[SDK REQUEST] Favorite Religion for Leaders? Grave Civ4 - Creation & Customization 26 Sep 29, 2006 09:30 AM
[REQUEST] Multipule Favorite Civics & Favorite Religion Grave Civ4 - Creation & Customization 1 May 20, 2006 11:50 AM
Multipule 'Favorite Civics' for leaders? Grave Civ4 - Creation & Customization 6 Jan 08, 2006 02:26 PM


Advertisement

All times are GMT -6. The time now is 05:45 PM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
This site is copyright Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR