Yes, they are.These are in the code now right?
Yes, they are.These are in the code now right?
That is non trivial considering that the expression can define quite complex combinations.@AIAndy
![]()
Could you have the new code show up in the Req section of the pedia with their images. Here you see a Conquistador that requires Spanish AND Firearms AND Sulphur AND Horse. Only the Sulphur shows above since its in the old code. Could you make the new code also shoe up there too.
Thanks!
If I can get the Mangroves feature working and if we want the Natural Wonders mod included we will need some new tags on features. The NW mod has most but is missing the equivalent to land next to sea and sea next to land. I think these both occur on buildings so the same name for the same thing would be good.
Mangroves need to be on swamp terrain next to tropical or temperate coast for example.
<iGlobalRelationsChange>3</iGlobalRelationsChange>
<iGlobalRelationsChange>-2</iGlobalRelationsChange>
This came up over in my Old Wonders - New Abilities thread. Could we get an <iGlobalRelationsChange> tag for buildings and events? This would be similar to what happens with civics that adjust relations.
For example, a building that grants +3 relations with all leaders would have this:
Code:<iGlobalRelationsChange>3</iGlobalRelationsChange>
This would mean that we wouldn't need Python for Field of the Cloth of Gold and (I think) Taipei 101. Putting the relations tag in an XML would allow the AI to evaluate the effect.
We could also use a negative version as a drawback. The Manhattan Project could have
Code:<iGlobalRelationsChange>-2</iGlobalRelationsChange>
and the builder would get -2 relations with all AI players just for building it. We don't need to have that, but I'm using it as an example.
Good one for ls612 to have a go at. It's relatively self contained and simple, and once you've done one tag request, you pretty much learn most of what you need to know to most others.
Good one for ls612 to have a go at. It's relatively self contained and simple, and once you've done one tag request, you pretty much learn most of what you need to know to most others.
Good idea, I'll try that.
Edit: I've figured out all of the stuff to actually put the tag in the XML, but I can't find the function that figures out what the AI's relation to you is. What function is that?
Not entirely sure what you mean by "the AI's relation to you". If you mean "how does the AI evaluate this tag" the the answer is CvPlayerAI::AI_civicValue() is where you need to add evaluation of this value.
This came up over in my Old Wonders - New Abilities thread. Could we get an <iGlobalRelationsChange> tag for buildings and events? This would be similar to what happens with civics that adjust relations.
For example, a building that grants +3 relations with all leaders would have this:
Code:<iGlobalRelationsChange>3</iGlobalRelationsChange>
This would mean that we wouldn't need Python for Field of the Cloth of Gold and (I think) Taipei 101. Putting the relations tag in an XML would allow the AI to evaluate the effect.
We could also use a negative version as a drawback. The Manhattan Project could have
Code:<iGlobalRelationsChange>-2</iGlobalRelationsChange>
and the builder would get -2 relations with all AI players just for building it. We don't need to have that, but I'm using it as an example.
Not entirely sure what you mean by "the AI's relation to you". If you mean "how does the AI evaluate this tag" the the answer is CvPlayerAI::AI_civicValue() is where you need to add evaluation of this value.
Wait, I thought that Vokarya was asking for a tag on a building that would modify your diplomatic relations with other civs if you built that building. I am stuck on the "finding if a building with a nonzero value of that tag exists, and if yes, changing the AI's relationship numbers accordingly". I'm not certain how that relates to civics.
Oh sorry, I thought it was a civic tag. In that case the routines you need are:
cvCity:rocessBuilding() which adds or removes the effect of that building (as defined by it's tags) when it is built, destroyed, disabled, re-enabled etc. For the AI to evaluate it you need to modify CvCityAI::buildingValueThresholdOriginal() (or something like that - this is from memory) and a sister routine, that does the same thing, but in a way that is much more efficient when you know that multiple queries for different aspects are going to be made (as happens during what to build evaluation). For now, don't worry about the sister routine, and I'll walk over with you how to update it after you do the easy one (which is the one with the name I was approximating/guessing at above)
void CvCity::changeAIAttitude(int iChange)
{
for (int iPlayer = 0; iPlayer < MAX_CIV_PLAYERS; ++iPlayer)
{
if (!isHuman() && !isBarbarian() && isAlive())
{
int iI;
BuildingTypes eLoopBuilding;
for (iI = 0; iI < GC.getNumBuildingClassInfos(); iI++)
{
if (eLoopBuilding != NO_BUILDING)
{
if (GC.getBuildingInfo(eLoopBuilding).getGlobalRelationsModifier != 0)
{
return GC.getBuildingInfo(eLoopBuilding).getGlobalRelationsModifier();
}
else
{
return 0;
}
}
}
else
{
return 0
}
}
}
I am having much trouble getting a building to affect a value on a player, as opposed to a value in a city. Here is what I have done so far, in pseudocode. I've made the following function to return what the change in AI diplomatic relations should be.
PHP:void CvCity::changeAIAttitude(int iChange) { for (int iPlayer = 0; iPlayer < MAX_CIV_PLAYERS; ++iPlayer) { if (!isHuman() && !isBarbarian() && isAlive()) { int iI; BuildingTypes eLoopBuilding; for (iI = 0; iI < GC.getNumBuildingClassInfos(); iI++) { if (eLoopBuilding != NO_BUILDING) { if (GC.getBuildingInfo(eLoopBuilding).getGlobalRelationsModifier != 0) { return GC.getBuildingInfo(eLoopBuilding).getGlobalRelationsModifier(); } else { return 0; } } } else { return 0 } } }
But I can't figure out how to use the value that that function returns.Am I doing this at all right, or am I totally on a wild goose chase?