[SDK/XML REQUEST] Flavored Civics

Grave

1 Goat = 400 Horses
Joined
May 5, 2002
Messages
1,530
Location
Louisiana
Looking for a kind soul to help make this a reality.

I tried taking the <Flavor> tags in the Schema (take your pick... Units, Buildings, etc) and tried sticking them into the Schema file that controls Civilizations and LeaderHeads (can't remember the exact file name right now, sorry).

My thinking was: Since Flavors are already coded into the SDK, if I added Flavor to the Civ/LH Schema, it should work... right?

Wrong.

I kept getting errors upon loading. So what I was wondering was if somebody could make a MODCOMP that would allow Civics to have Flavor tags. I think this would be very useful.

So say Stalin for example is Flavored as Military. If you make Police State heavily flavored for Military, Stalin should be more inclined to select it as a Civic, in addition to his Favorite Civic of State Property.

You could also apply the same thing to Theocracy. Heavily Flavor it to Religion, and LH's like Saladin, Mansa Musa, would be more inclined to select it.

All the Civics then could be Flavored one way or another, which could help eliminate totally off-the-wall Civic combos uncharistic of certain LH's.

Since each LH has at least two Flavors to them, this could make this very interesting to say the least.




Is anybody on board for this?
 
Grave. What you are going to need to do is:

(a) copy & paste all the flavours info you want from CvBuildingInfos, for instance, into CvCivicInfos (in your CvInfos.cpp file).

(b) once all that is done, then you will need to go into CvPlayer.cpp & add all the relevent flavour stuff into the appropriate locations for civics.

(c) go and make the change to your XML files & you should be done.

I reckon it will take you around 1-2 hours to do it-assuming it works first time ;).

Aussie_Lurker.
 
Grave. What you are going to need to do is:

(a) copy & paste all the flavours info you want from CvBuildingInfos, for instance, into CvCivicInfos (in your CvInfos.cpp file).

(b) once all that is done, then you will need to go into CvPlayer.cpp & add all the relevent flavour stuff into the appropriate locations for civics.

(c) go and make the change to your XML files & you should be done.

I reckon it will take you around 1-2 hours to do it-assuming it works first time ;).

Aussie_Lurker.

Thanks man... I'll try this out when I have a little spare time. :goodjob:

If you want to use this idea for your Civics Balance mod... go for it. :goodjob:
 
(b) once all that is done, then you will need to go into CvPlayer.cpp & add all the relevent flavour stuff into the appropriate locations for civics.

OK, I think I got all the stuff for CvInfos.cpp all done... that was actually pretty straight forward and easy.

But what exactly am I looking fo in CvPlayer.cpp? I did a search on "flavor" and nothing came up. :confused:
 
Hmmm, the Civics functions are processed in CvPlayer, but I confess that flavours for buildings, leaderheads & units might be done somewhere else. Check CvUnit.cpp for a flavour function &, failing that, try CvCity or CvLeaderTraits. Thats all I can really suggest without having the C++ files in front of me.

Aussie_Lurker.
 
Actually, I noticed this thread last night and thought "That's not a bad idea". So I've already got it up and running and am planning on putting it into the WW2 1939 mod that's going beta in a little over a week.

When you get to the XML, note that in CIV4GameInfoSchema there is already flavor element stuff down with the SpecialistInfo stuff. You have to move it above the CivicInfo element:

Code:
<ElementType name="FlavorType" content="textOnly"/>
<ElementType name="iFlavor" content="textOnly" dt:type="int"/>
<ElementType name="Flavor" content="eltOnly">
	<element type="FlavorType"/>
	<element type="iFlavor"/>
</ElementType>
<ElementType name="Flavors" content="eltOnly">
	<element type="Flavor" minOccurs="0" maxOccurs="*"/>
</ElementType>
<ElementType name="CivicInfo" content="eltOnly">

...

<element type="WeLoveTheKing"/>
<element type="Flavors"/>

(assuming that you want to put the flavor data at the bottom of each Civic info).

At the player level, one thing you definitely want to do is to change CvPlayerAI::AI_civicValue so that it takes whatever flavors are associated with each civic into account. Something like this:

Code:
for (iI = 0; iI < GC.getNumFlavorTypes(); iI++) 
{
	iValue+=AI_getFlavorValue((FlavorTypes)iI)*GC.getCivicInfo(eCivic).getFlavorValue((FlavorTypes)iI);
}
return iValue;
 
Hmmm, the Civics functions are processed in CvPlayer, but I confess that flavours for buildings, leaderheads & units might be done somewhere else. Check CvUnit.cpp for a flavour function &, failing that, try CvCity or CvLeaderTraits. Thats all I can really suggest without having the C++ files in front of me.

Aussie_Lurker.

I didn't see anything in CvPlayer that would seem to work with this... would CvPlayerAI be the one you mean? :confused:

At the player level, one thing you definitely want to do is to change CvPlayerAI::AI_civicValue so that it takes whatever flavors are associated with each civic into account. Something like this:

Code:
for (iI = 0; iI < GC.getNumFlavorTypes(); iI++) 
{
	iValue+=AI_getFlavorValue((FlavorTypes)iI)*GC.getCivicInfo(eCivic).getFlavorValue((FlavorTypes)iI);
}
return iValue;

I plugged this into CvPlayerAI... is there anything else (besides the Schema), or is that it?
 
Ok, I compiled the DLL without error, I did the Schema and I added the Flavor tags to the CivicInfo XML file.

I go to fire up the mod and get this error:

Code:
Failed Loading XML file XML\GameInfo/CIV4PlayerOptionInfos.xml.

... then when I click 'OK' I get this...


Code:
LoadXML call failed for GameInfo/CIV4PlayerOptionsInfos.xml. Current XML file is:


WTF!?!? I didn't even mess with this file... why is it failing to load!!! :mad: :aargh:
 
Top Bottom