Water Tile worked = iDiscoverRand?

Duuk

Doom-Sayer
Supporter
Joined
Dec 16, 2005
Messages
1,979
Location
Detroit, Michigan, USA
I'm trying to add a small chance for worked water tiles to randomly spawn one of the water bonuses. The problem is it doesn't seem to be working. I managed to add the ability for farms to randomly spawn corn or wheat, and that works fine.

But water tiles seem to resist me...

See code in spoiler:
Spoiler :

Code:
    <ImprovementInfo>
            <Type>IMPROVEMENT_WATER_WORKED</Type>
            <Description>TXT_KEY_IMPROVEMENT_WATER_WORKED</Description>
            <Civilopedia>TXT_KEY_IMPROVEMENT_WATER_WORKED_PEDIA</Civilopedia>
            <ArtDefineTag>ART_DEF_IMPROVEMENT_WATER_WORKED</ArtDefineTag>
            <bActsAsCity>0</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>0</bWater>
            <bGoody>0</bGoody>
            <bPermanent>0</bPermanent>
            <iAdvancedStartCost>-1</iAdvancedStartCost>
            <iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
            <iTilesPerGoody>0</iTilesPerGoody>
            <iGoodyRange>0</iGoodyRange>
            <iFeatureGrowth>0</iFeatureGrowth>
            <iUpgradeTime>0</iUpgradeTime>
            <iAirBombDefense>-1</iAirBombDefense>
            <iDefenseModifier>0</iDefenseModifier>
            <iHappiness>0</iHappiness>
            <iPillageGold>0</iPillageGold>
            <bOutsideBorders>0</bOutsideBorders>
            <TerrainMakesValids/>
            <FeatureMakesValids/>
            <BonusTypeStructs>
                <BonusTypeStruct>
                    <BonusType>BONUS_CLAM</BonusType>
                    <bBonusMakesValid>1</bBonusMakesValid>
                    <bBonusTrade>1</bBonusTrade>
                    <iDiscoverRand>100</iDiscoverRand>
                    <YieldChanges>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                    </YieldChanges>
                </BonusTypeStruct>
                <BonusTypeStruct>
                    <BonusType>BONUS_FISH</BonusType>
                    <bBonusMakesValid>1</bBonusMakesValid>
                    <bBonusTrade>1</bBonusTrade>
                    <iDiscoverRand>100</iDiscoverRand>
                    <YieldChanges>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                    </YieldChanges>
                </BonusTypeStruct>
                <BonusTypeStruct>
                    <BonusType>BONUS_CRAB</BonusType>
                    <bBonusMakesValid>1</bBonusMakesValid>
                    <bBonusTrade>1</bBonusTrade>
                    <iDiscoverRand>100</iDiscoverRand>
                    <YieldChanges>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                    </YieldChanges>
                </BonusTypeStruct>
            </BonusTypeStructs>
            <ImprovementPillage/>
            <ImprovementUpgrade/>
            <TechYieldChanges/>
            <RouteYieldChanges/>
            <WorldSoundscapeAudioScript/>
            <bGraphicalOnly>0</bGraphicalOnly>
        </ImprovementInfo>


According to the documentation, (yeah I know) that should work. However... it doesn't. (note that the "100" for the iDiscoverRand is low on purpose for testing. I normally use 10000, which is the normal).

Suggestions?

Note: The above code loads fine in the xml. It just doesn't seem to do anything.
 
i guess water_worked plots already have a bonus, or?
maybe you could make fishing boats to build on every watertile, then set the DiscoverRand.
its a try worth.
 
:think: good idea.

But i'm sure, water_worked + land_worked are very special, because they are not really improvements, and that there's something hardcoded.

So, first other check: Does any change in water_worked have an effect?
Maybe set iHappiness to 1 or 2, and then see, if it works.
 
Your approach won't work because only real improvements registered in the plot info are considered when calculating any chance of random appearances - and WATER_WORKED and LAND_WORKED "improvements" aren't registered as real improvements in the individual plot info, but only used for displaying graphical appearance of worked tiles without real improvements.

It is going to take SDK code changes if you want a chance of random appearance on any plot being worked, but it should be fairly easy to set it up so that it is controlled using the WATER_WORKED and LAND_WORKED XML settings.
 
i guess water_worked plots already have a bonus, or?
maybe you could make fishing boats to build on every watertile, then set the DiscoverRand.
its a try worth.

Worked like a champ.

Code:
        <ImprovementInfo>
            <Type>IMPROVEMENT_FISHING_BOATS</Type>
            <Description>TXT_KEY_IMPROVEMENT_FISHING_BOATS</Description>
            <Civilopedia>TXT_KEY_IMPROVEMENT_FISHING_BOATS_PEDIA</Civilopedia>
            <ArtDefineTag>ART_DEF_IMPROVEMENT_FISHING_BOATS</ArtDefineTag>
            <YieldChanges>
                <iYieldChange>1</iYieldChange>
                <iYieldChange>0</iYieldChange>
                <iYieldChange>1</iYieldChange>
            </YieldChanges>
            <bActsAsCity>0</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>
            <iAdvancedStartCost>30</iAdvancedStartCost>
            <iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
            <iTilesPerGoody>0</iTilesPerGoody>
            <iGoodyRange>0</iGoodyRange>
            <iFeatureGrowth>0</iFeatureGrowth>
            <iUpgradeTime>0</iUpgradeTime>
            <iAirBombDefense>5</iAirBombDefense>
            <iDefenseModifier>0</iDefenseModifier>
            <iHappiness>0</iHappiness>
            <iPillageGold>5</iPillageGold>
            <bOutsideBorders>0</bOutsideBorders>
            <TerrainMakesValids>
                <TerrainMakesValid>
                    <TerrainType>TERRAIN_COAST</TerrainType>
                    <bMakesValid>1</bMakesValid>
                </TerrainMakesValid>
            </TerrainMakesValids>
            <FeatureMakesValids/>
            <BonusTypeStructs>
                <BonusTypeStruct>
                    <BonusType>BONUS_CLAM</BonusType>
                    <bBonusMakesValid>1</bBonusMakesValid>
                    <bBonusTrade>1</bBonusTrade>
                    <iDiscoverRand>10000</iDiscoverRand>
                    <YieldChanges>
                        <iYieldChange>2</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                    </YieldChanges>
                </BonusTypeStruct>
                <BonusTypeStruct>
                    <BonusType>BONUS_CRAB</BonusType>
                    <bBonusMakesValid>1</bBonusMakesValid>
                    <bBonusTrade>1</bBonusTrade>
                    <iDiscoverRand>10000</iDiscoverRand>
                    <YieldChanges>
                        <iYieldChange>2</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                    </YieldChanges>
                </BonusTypeStruct>
                <BonusTypeStruct>
                    <BonusType>BONUS_FISH</BonusType>
                    <bBonusMakesValid>1</bBonusMakesValid>
                    <bBonusTrade>1</bBonusTrade>
                    <iDiscoverRand>10000</iDiscoverRand>
                    <YieldChanges>
                        <iYieldChange>3</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                    </YieldChanges>
                </BonusTypeStruct>
            </BonusTypeStructs>
            <ImprovementPillage/>
            <ImprovementUpgrade/>
            <TechYieldChanges/>
            <RouteYieldChanges/>
            <bGraphicalOnly>0</bGraphicalOnly>
        </ImprovementInfo>
 
Back
Top Bottom