1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

[SDK REQUEST] Multipule Favorite Civics for Leaders

Discussion in 'Civ4 - SDK/Python' started by Grave, Sep 20, 2006.

  1. Grave

    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
     
  2. Grave

    Grave 1 Goat = 400 Horses

    Joined:
    May 5, 2002
    Messages:
    1,530
    Location:
    Louisiana
    T T T

    ... for such a novel idea. ;)
     
  3. Grave

    Grave 1 Goat = 400 Horses

    Joined:
    May 5, 2002
    Messages:
    1,530
    Location:
    Louisiana
    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>
    
     
  4. Olleus

    Olleus Warlord

    Joined:
    Oct 30, 2005
    Messages:
    6,132
    Location:
    England
    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.
     
  5. Grave

    Grave 1 Goat = 400 Horses

    Joined:
    May 5, 2002
    Messages:
    1,530
    Location:
    Louisiana
    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. ;)
     
  6. Grave

    Grave 1 Goat = 400 Horses

    Joined:
    May 5, 2002
    Messages:
    1,530
    Location:
    Louisiana
    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.
     
  7. Grave

    Grave 1 Goat = 400 Horses

    Joined:
    May 5, 2002
    Messages:
    1,530
    Location:
    Louisiana
    I'm gonna bump this again, as I'm still working on this and would need some assistance.
     
  8. Grave

    Grave 1 Goat = 400 Horses

    Joined:
    May 5, 2002
    Messages:
    1,530
    Location:
    Louisiana
    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?
     
  9. ripple01

    ripple01 Chieftain

    Joined:
    Mar 7, 2006
    Messages:
    1,241
    Location:
    New York City
    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
     
  10. Vrenir

    Vrenir Chieftain

    Joined:
    Oct 11, 2006
    Messages:
    826
    Location:
    Maryland
    Grave did it, I believe. You should be able to find his work in the Components forum under the title Grave's Flavored Civics.
     
  11. Gaius Octavius

    Gaius Octavius Chieftain

    Joined:
    Jul 28, 2006
    Messages:
    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.
     
  12. Emperor2

    Emperor2 Capitalist Missionary

    Joined:
    Dec 27, 2006
    Messages:
    916
    Location:
    Capitalist Paradise
    How come you can't just XML

    <FavoriteCivic>CIVIC_REPRESENTATION</FavoriteCivic>
    <FavoriteCivc>CIVIC_FREE_MARKET</FavoriteCivc>
    etc, etc
     
  13. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    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.
     

Share This Page