• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Quick Modding Questions Thread

So I turned to the AI again for help:


Well, I think I prefer Option B.



I think I only need to do the first part here because I have a BASE + WorldSize + Extend thing.
Am I right?
I'm still waiting for some reassurance/correction on this :blush:
 
Hello all,
.
The spiritual trait allows double production speed of temples. If I check civ4traitinfos, I don't see any reference to temples under the spiritual trait. I want to add monasteries and cathedrals to allow for double production speed. Where can this be done? What am I missing?
 
Hello all,
.
The spiritual trait allows double production speed of temples. If I check civ4traitinfos, I don't see any reference to temples under the spiritual trait. I want to add monasteries and cathedrals to allow for double production speed. Where can this be done? What am I missing?
Look for ProductionTraits tag in CIV4BuildingInfos and CIV4SpecialBuildingInfos
 
In XML/Buildings/CIV4SpecialBuildingInfos.xml there is a <ProductionTraits> property, you should be able to replicate what is already defined for temples.
 
Hi! What to edit to make custom maps have more terrain bonuses? Like for example 4x more?
It depends on if the map has it's own procedure for that, like Smart Map. Otherwise you would need to edit Bonusinfos.xml
 
It depends on if the map has it's own procedure for that, like Smart Map. Otherwise you would need to edit Bonusinfos.xml
Thanks for the answer. I tried changing <iConstAppearance>20</iConstAppearance> to 100 in CIV4BonusInfos.xml but I don't think it worked. Maybe there is minimal distance between bonuses in Python scripts generating map but that's beyond my skill.
 
Thanks for the answer. I tried changing <iConstAppearance>20</iConstAppearance> to 100 in CIV4BonusInfos.xml but I don't think it worked. Maybe there is minimal distance between bonuses in Python scripts generating map but that's beyond my skill.
You need iTilesPer, maybe iPlayer.
 
Can someone tell me what's wrong with this code, please?
Python:
    def placeNaturalWonders(self):
        map = CyMap()

        def hasRiverToNorth(pPlot):
            y = pPlot.getY()
            if y + 1 >= map.getGridHeight(): return False
            pNorth = map.plot(pPlot.getX(), y + 1)
            return pNorth.isRiverNS() and pNorth.getRiverNSDirection() == CardinalDirectionTypes.CARDINALDIRECTION_SOUTH

        def hasRiverToEast(pPlot):
            return pPlot.isRiverWOfPlot() and pPlot.getRiverWEDirection() == CardinalDirectionTypes.CARDINALDIRECTION_WEST

        def hasRiverToWest(pPlot):
            x = pPlot.getX()
            if x - 1 < 0: return False
            pWest = map.plot(x - 1, pPlot.getY())
            return pPlot.isRiverWOfPlot() and pPlot.getRiverWEDirection() == CardinalDirectionTypes.CARDINALDIRECTION_EAST

        for iFeature in xrange(gc.getNumFeatureInfos()):
            FeatureInfo = gc.getFeatureInfo(iFeature)
            sType = FeatureInfo.getType()
            if sType.find("FEATURE_PLATY_") == -1: continue
            if random.randint(1, 100) >= self.iPlaceChance: continue

            # === FEATURE_PLATY_EVEREST ===
            if sType == "FEATURE_PLATY_EVEREST":
                ValidPeakPlots = []
                for i in range(map.numPlots()):
                    pPlot = map.plotByIndex(i)
                    if not pPlot.isPeak(): continue
                    iX, iY = pPlot.getX(), pPlot.getY()
                    iPeakCount = 0
                    for dx in range(-2, 3):
                        for dy in range(-2, 3):
                            if dx == 0 and dy == 0: continue
                            pLoop = map.plot(iX + dx, iY + dy)
                            if not pLoop.isNone() and pLoop.isPeak():
                                iPeakCount += 1
                    if iPeakCount >= 5:
                        ValidPeakPlots.append(pPlot)
                if ValidPeakPlots:
                    iRand = CyGame().getSorenRandNum(len(ValidPeakPlots), "Everest")
                    ValidPeakPlots[iRand].setFeatureType(iFeature, 0)
                continue

            # === FEATURE_PLATY_VICTORIA_FALLS ===
            elif sType == "FEATURE_PLATY_VICTORIA_FALLS":
                for i in xrange(map.numPlots()):
                    pPlot = map.plotByIndex(i)
                    if pPlot.isWater() or pPlot.getFeatureType() != FeatureTypes.NO_FEATURE:
                        continue
                    if hasRiverToNorth(pPlot) and hasRiverToEast(pPlot):
                        pPlot.setFeatureType(iFeature, 0)
                        break
                continue

            # === FEATURE_PLATY_GRAND_CANYON ===
            elif sType == "FEATURE_PLATY_GRAND_CANYON":
                for i in xrange(map.numPlots()):
                    pPlot = map.plotByIndex(i)
                    if pPlot.isWater() or pPlot.getFeatureType() != FeatureTypes.NO_FEATURE:
                        continue
                    if hasRiverToNorth(pPlot) and hasRiverToWest(pPlot):
                        pPlot.setFeatureType(iFeature, 0)
                        break
                continue

            # === Default Wonder Placement ===
            WonderPlot = []
            for i in xrange(map.numPlots()):
                pPlot = map.plotByIndex(i)
                if pPlot.getBonusType(-1) > -1: continue

                ## Nearby Plot Check ##
                bUnsuitable = False
                iRadius = self.iNoNearbyRadius
                bAdjacentPlot = True
                if sType in self.lBigWonder:
                    iRadius += 1
                    bAdjacentPlot = False

                for x in xrange(pPlot.getX() - iRadius, pPlot.getX() + iRadius + 1):
                    for y in xrange(pPlot.getY() - iRadius, pPlot.getY() + iRadius + 1):
                        pAdj = map.plot(x, y)
                        if pAdj.getFeatureType() > -1 and gc.getFeatureInfo(pAdj.getFeatureType()).getType().find("FEATURE_PLATY_") > -1:
                            bUnsuitable = True
                            break
                        if not bAdjacentPlot and pAdj.canHaveFeature(iFeature):
                            if abs(pAdj.getX() - pPlot.getX()) > 1: continue
                            if abs(pAdj.getY() - pPlot.getY()) > 1: continue
                            if pAdj.getBonusType(-1) > -1: continue
                            bAdjacentPlot = True
                    if bUnsuitable: break
                if bUnsuitable: continue

                ## Latitude Check ##
                if sType in self.lLatitude:
                    if pPlot.getLatitude() < self.lLatitude[sType][0] or pPlot.getLatitude() > self.lLatitude[sType][1]:
                        continue

                if pPlot.canHaveFeature(iFeature) and bAdjacentPlot:
                    WonderPlot.append(pPlot)

            bWonder = False
            while WonderPlot:
                iWonderPlot = random.randint(0, len(WonderPlot) - 1)
                pPlot = WonderPlot[iWonderPlot]

                if sType in self.lBigWonder:
                    AdjacentPlot = []
                    for x in xrange(pPlot.getX() - 1, pPlot.getX() + 2):
                        for y in xrange(pPlot.getY() - 1, pPlot.getY() + 2):
                            if x == pPlot.getX() and y == pPlot.getY(): continue
                            pAdj = map.plot(x, y)
                            if pAdj.getBonusType(-1) > -1: continue
                            if pAdj.canHaveFeature(iFeature):
                                AdjacentPlot.append(pAdj)
                    if not AdjacentPlot:
                        del WonderPlot[iWonderPlot]
                        if WonderPlot:
                            continue
                        else:
                            break
                    pAdj = AdjacentPlot[random.randint(0, len(AdjacentPlot) - 1)]
                    pAdj.setFeatureType(iFeature, 0)
                    for yieldType in [YieldTypes.YIELD_FOOD, YieldTypes.YIELD_PRODUCTION, YieldTypes.YIELD_COMMERCE]:
                        CyGame().setPlotExtraYield(pAdj.getX(), pAdj.getY(), yieldType, random.randint(0, self.iMaxYield))
                    bWonder = True
                    break

                bWonder = True
                break

            if bWonder:
                pPlot.setFeatureType(iFeature, 0)
                for yieldType in [YieldTypes.YIELD_FOOD, YieldTypes.YIELD_PRODUCTION, YieldTypes.YIELD_COMMERCE]:
                    CyGame().setPlotExtraYield(pPlot.getX(), pPlot.getY(), yieldType, random.randint(0, self.iMaxYield))

                sNature = sType[sType.find("_PLATY_") + 7:]
                sBuildingType = "BUILDING_" + sNature
                iBuilding = gc.getInfoTypeForString(sBuildingType)
                if iBuilding == -1: continue
                lNaturalCity = self.addSuitableCity(pPlot, -1, [])
                if sType in self.lBigWonder:
                    lNaturalCity = self.addSuitableCity(pAdj, -1, lNaturalCity)
                if lNaturalCity:
                    pLuckyCity = lNaturalCity[random.randint(0, len(lNaturalCity) - 1)]
                    pLuckyCity.setNumRealBuilding(iBuilding, 1)
        return

I want to place Grand Canyon and Victoria falls next to rivers but they aren't placed. Everything else works.
 
Anyone know what to edit to get more small rivers?
That's handled either by CvMapGeneratorUtil.py or by chosen mapscript. In Smart Map there's an extraRiverPct parameter for it, I also add extra river spawn triggers from mountains and hills in MapScriptTools.py.
 
Is there any non-SDK/non-dll way to enable airstrikes against the parked air units? If Domain Land and Sea can be targets why not Domain Air , when not airborne?
 
Back
Top Bottom