upgrade improvement without city working ?

Gédéon

Chieftain
Joined
Oct 15, 2010
Messages
7
Hello boys
I'd like to get a fort1 upgrade to a fort2 after x turns, but without having it to be worked by a city. I think this is possible, as in FFH, but i've met difficulties implementing it for the dune wars mod.
let me show you what i've got in the CIV4ImprovementInfos.xml :
Spoiler :

<ImprovementInfo>
<Type>IMPROVEMENT_FORT</Type>
<Description>TXT_KEY_IMPROVEMENT_FORT</Description>
<Civilopedia>TXT_KEY_IMPROVEMENT_FORT_PEDIA</Civilopedia>
<ArtDefineTag>ART_DEF_IMPROVEMENT_OUTPOST</ArtDefineTag>
<bActsAsCity>1</bActsAsCity>
<bHillsMakesValid>0</bHillsMakesValid>
<bFreshWaterMakesValid>0</bFreshWaterMakesValid>
<bRiverSideMakesValid>0</bRiverSideMakesValid>
<bNoFreshWater>0</bNoFreshWater>
<bRequiresFlatlands>0</bRequiresFlatlands>
<bRequiresRiverSide>0</bRequiresRiverSide>
<bRequiresIrrigation>0</bRequiresIrrigation>
<bCarriesIrrigation>0</bCarriesIrrigation>
<bRequiresFeature>0</bRequiresFeature>
<bWater>1</bWater>
<bGoody>0</bGoody>
<bPermanent>0</bPermanent>
<bUseLSystem>1</bUseLSystem>
<iAdvancedStartCost>-1</iAdvancedStartCost>
<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
<iTilesPerGoody>0</iTilesPerGoody>
<iGoodyRange>0</iGoodyRange>
<iFeatureGrowth>0</iFeatureGrowth>
<iUpgradeTime>50</iUpgradeTime>
<iAirBombDefense>15</iAirBombDefense>
<iDefenseModifier>15</iDefenseModifier>
<iHappiness>0</iHappiness>
<iPillageGold>25</iPillageGold>
<bOutsideBorders>1</bOutsideBorders>
<!-- JCultureControl Mod Start -->
<bSpreadCultureControl>1</bSpreadCultureControl>
<iCultureBorderRange>1</iCultureBorderRange>
<iCultureControlStrength>10</iCultureControlStrength>
<iCultureControlCenterTileBonus>20</iCultureControlCenterTileBonus>
<!-- JCultureControl Mod End -->
<!-- JImprovementLimit Mod Start -->
<iMakesInvalidRange>2</iMakesInvalidRange>
<ImprovementRequired/>
<!-- JImprovementLimit Mod End -->
<TerrainMakesValids/>
<FeatureMakesValids/>
<BonusTypeStructs>
<BonusTypeStruct>
<BonusType>BONUS_SPICE</BonusType>
<bBonusMakesValid>1</bBonusMakesValid>
<bBonusTrade>1</bBonusTrade>
<iDiscoverRand>0</iDiscoverRand>
<YieldChanges>
<iYieldChange>0</iYieldChange>
<iYieldChange>0</iYieldChange>
<iYieldChange>0</iYieldChange>
</YieldChanges>
</BonusTypeStruct>
</BonusTypeStructs>
<ImprovementPillage></ImprovementPillage>
<ImprovementUpgrade>IMPROVEMENT_FORT2</ImprovementUpgrade>
<TechYieldChanges>
</TechYieldChanges>
<RouteYieldChanges>
</RouteYieldChanges>
<bGraphicalOnly>0</bGraphicalOnly>
</ImprovementInfo>
<ImprovementInfo>
<Type>IMPROVEMENT_FORT2</Type>
<Description>TXT_KEY_IMPROVEMENT_FORT</Description>
<Civilopedia>TXT_KEY_IMPROVEMENT_FORT_PEDIA</Civilopedia>
<ArtDefineTag>ART_DEF_IMPROVEMENT_OUTPOST</ArtDefineTag>
<bActsAsCity>1</bActsAsCity>
<bHillsMakesValid>0</bHillsMakesValid>
<bFreshWaterMakesValid>0</bFreshWaterMakesValid>
<bRiverSideMakesValid>0</bRiverSideMakesValid>
<bNoFreshWater>0</bNoFreshWater>
<bRequiresFlatlands>0</bRequiresFlatlands>
<bRequiresRiverSide>0</bRequiresRiverSide>
<bRequiresIrrigation>0</bRequiresIrrigation>
<bCarriesIrrigation>0</bCarriesIrrigation>
<bRequiresFeature>0</bRequiresFeature>
<bWater>1</bWater>
<bGoody>0</bGoody>
<bPermanent>0</bPermanent>
<bUseLSystem>1</bUseLSystem>
<iAdvancedStartCost>-1</iAdvancedStartCost>
<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
<iTilesPerGoody>0</iTilesPerGoody>
<iGoodyRange>0</iGoodyRange>
<iFeatureGrowth>0</iFeatureGrowth>
<iUpgradeTime>50</iUpgradeTime>
<iAirBombDefense>30</iAirBombDefense>
<iDefenseModifier>30</iDefenseModifier>
<iHappiness>0</iHappiness>
<iPillageGold>25</iPillageGold>
<bOutsideBorders>1</bOutsideBorders>
<!-- JCultureControl Mod Start -->
<bSpreadCultureControl>1</bSpreadCultureControl>
<iCultureBorderRange>2</iCultureBorderRange>
<iCultureControlStrength>50</iCultureControlStrength>
<iCultureControlCenterTileBonus>100</iCultureControlCenterTileBonus>
<!-- JCultureControl Mod End -->
<!-- JImprovementLimit Mod Start -->
<iMakesInvalidRange>2</iMakesInvalidRange>
<ImprovementRequired/>
<!-- JImprovementLimit Mod End -->
<TerrainMakesValids/>
<FeatureMakesValids/>
<BonusTypeStructs>
<BonusTypeStruct>
<BonusType>BONUS_SPICE</BonusType>
<bBonusMakesValid>1</bBonusMakesValid>
<bBonusTrade>1</bBonusTrade>
<iDiscoverRand>0</iDiscoverRand>
<YieldChanges>
<iYieldChange>0</iYieldChange>
<iYieldChange>0</iYieldChange>
<iYieldChange>0</iYieldChange>
</YieldChanges>
</BonusTypeStruct>
</BonusTypeStructs>
<ImprovementPillage>IMPROVEMENT_FORT</ImprovementPillage>
<ImprovementUpgrade>IMPROVEMENT_FORT3</ImprovementUpgrade>
<TechYieldChanges>
</TechYieldChanges>
<RouteYieldChanges>
</RouteYieldChanges>
<bGraphicalOnly>0</bGraphicalOnly>
</ImprovementInfo>


Unfortunately i'm new to civ modding, sorry if anything seems stupid.
Cheers!
 
Welcome to CFC :).

The problem here is, that this stuff is not done via XML (okay, not only).
XML does only contain data, it doesn't say the game how to use this data.
So you might have changed something in the XML, but the game doesn't know how to use it.

To make the game know about it, the stuff has to be programed into the CvGameCoredll (-> C++ coding).
You need to have a look at the .cpp files in the CvGameCoreDll folder and find the needed changes, then make the code compatible for the mod you use, and then you have to compile the .dll (tutorial for compiling the dll).
 
Thanks!
Well i guess i'll have to beg those FFH guys to give me a hint, i can't think of having anything to do with this sdk stuff for the moment. Thanks anyway!
Still, an outpost capable of expanding culture would be a nice addition to Dune Wars (spice! more spice!!); actually i won't play another game without it. So if you genius modders out there have any idea of how to get this done, please tell!
 
Gédéon;9779511 said:
So if you genius modders out there have any idea of how to get this done, please tell!
Yeah, as the "genius" said above - you need to know C++ programming. For this also.
 
Ach, maybe python could help simulate the behaviour i'm looking for : An event fires on completion of the first fort, and sets a feature on the plot ; some turns later a new tech unlocks a second fort which can only be built on this feature.
I think of two problems with this method : destroyed forts leaving the tile with a feature that shouldn't be there (unless it can be removed by event too), and more importantly, the AI propensity to 'upgrade' its forts manually, out of any city working radius.
 
It may be possible to do in Python. If you wan to do it, it's worth a try anyway.

Set up the XML like it is for the hamlet upgrade to a cottage for the 2nd level of fort.

In onBeginPlayerTurn you loop over every plot in the map. If the plot is owned by the current player (using PyPlot.getOwner()) then check if there is the level 1 fort on the plot (PyPlot.getImprovementType()). If there is one, check to make sure that it is NOT being worked (PyPlot.getWorkingCity() should not return a valid value in this case) since if it is, the upgrade progress is already adjusted by the DLL. If it is not then manually bump up the upgrade progress (PyPlot.changeUpgradeProgress(1)).

Or something like that. It sounds good in theory, but I haven't tried it.
 
Hey, it does sound good ! But i can't possibly write the right code, and i don't even know where to put it. I've found 'def onBeginPlayerTurn' in multiple files in the mod i'm working on, including CvEventManager.py, which, in the still enchanted world i live in, looks like the right stuff to me :p.
By the way, i've read a post which i believe comes from you. Sounds good too ! And same problem : i seem to be unable to find a right place for the code.. I'll look deeper when i have time.
Thanks indeed for your help !
 
If it doesn't hurry and if you learn how to compile a new DLL I will show you the needed code parts from CCV. What you need is almost a new XML tag (bUpgradeNotWorked in CCV) and new function for doTurn in CvPlot
Spoiler :

PHP:
// Thomas SG - Tree Nursery START
void CvPlot::doImprovementUpgradeNotWorked()
{
    ImprovementTypes eImprovement = getImprovementType();

    if (eImprovement != NO_IMPROVEMENT)
    {
        ImprovementTypes eImprovementUpgrade = ((ImprovementTypes)GC.getImprovementInfo(eImprovement).getImprovementUpgrade());

        if (eImprovementUpgrade != NO_IMPROVEMENT)
        {
            if (GC.getImprovementInfo(eImprovement).isUpgradeNotWorked())
            {
                changeUpgradeProgress(1);
                
                if (getUpgradeProgress() >= GC.getGameINLINE().getImprovementUpgradeTime(eImprovement))
                {
                    setImprovementType(eImprovementUpgrade);
                }
            }
        }
    }
}
// Thomas SG - Tree Nursery END


and a small modification of doImprovementUpgrade because improvements of the UpgradeNotWorked type must be ignored by this function. Oh, and a small modification of CvGameTextMgr would be useful to show the right information in the plot help.

You see it's just a small job if you learn how to compile a new DLL. The needed code is already there...
 
Sorry for the late reply, i'm far from home. I'll check dll compiling as soon as i can, thanks for your help !
 
Back
Top Bottom