Suggestions and bug reports.

Yes, me ;)

Please try this.
This bug will be fixed for all with the next update then.

1) Download the file PAE_City.py.txt from this post
2) Change the file extension name of this file to .py only (delete .txt).
3) Replace the file with the original file in [BTS]/Mods/[PAEVI]/Assets/Python/PAE/

it's savegame compatible
 

Attachments

Hello,
We can build a Look-out with our hunters but we have no info that it will cost something.

In CvGameUtils.py, at line 3609, instead of this:
Python:
elif iData2 == 2:
    return CyTranslator().getText("TXT_KEY_BUILD_TURM", ())
You could write:
Python:
elif iData2 == 2:
    text = CyTranslator().getText("[COLOR_HIGHLIGHT_TEXT]", ())
    text += CyTranslator().getText("TXT_KEY_BUILD_TURM", ())
    text += CyTranslator().getText("[COLOR_REVERT]", ())
    text += CyTranslator().getText("TXT_KEY_HUNTER_BUILD_TOWER_HELP", ())
    return text
which implies creating a new text key:
XML:
<TEXT>
    <Tag>TXT_KEY_HUNTER_BUILD_TOWER_HELP</Tag>
    <English>[NEWLINE][ICON_BULLET]+10% Tile Defense[NEWLINE]Cost: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] Turn</English>
    <French>[NEWLINE][ICON_BULLET]D&#233;fense de la case +10%[NEWLINE]Co&#251;t : 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] tour</French>
    <German>[NEWLINE][ICON_BULLET]+10% Gel&#228;ndefeld-Verteidigung[NEWLINE]Kosten: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] Runde</German>
    <Italian>[NEWLINE][ICON_BULLET]+10% difensiva della casella[NEWLINE]Costo: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] Turno</Italian>
    <Spanish>[NEWLINE][ICON_BULLET]+10% a la defensa de la casilla[NEWLINE]Coste: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] turno</Spanish>
</TEXT>

This way it gives the full feeling of an improvement building button.
 
In CvMainInterface.py, at line 2474, there is a button (738) that suggests you can swap 2 resources on a tile (only equivalent resources, ie grain <=> grain or livestock <=> livestock).

How should it work? Let's say I have a cow in my wagon on a tile with a sheep. If I try the swap, in the end:
- the sheep is replaced with the cow on the tile and my wagon is killed (like a normal implantation)
or
- the sheep is replaced with the cow on the tile but my wagon isn't killed and the cow in its cargo has now been replaced with the sheep
?
 
The Sell button is displayed twice for all trade units.

In CvMainInterface.py, at line 2464, you can add a "if" to limit this button to cultivation unit (Trade units have their own button later in the code with different checks):
Python:
elif bCity:
    if iUnitType in L.LCultivationUnits: # DERTUEK
        iPrice = PAE_Trade.calculateBonusSellingPrice(pUnit, pPlot.getPlotCity(), 0)
        screen.appendMultiListButton("BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo(
            "INTERFACE_TRADE_SELL").getPath(), 0, WidgetTypes.WIDGET_GENERAL, 741, int(iPrice), False)
        screen.show("BottomButtonContainer")
        screen.enableMultiListPulse("BottomButtonContainer", True, 0, iCount)
        iCount += 1
 
When you buy a resource with a merchant, you got these datas in unit's scriptData:
  • b (resource code)
  • x and y (coordinates where the resource was bought)
  • originCiv (origin of the seller)

But when you sell, only "b" is removed. So later, if you collect some resource (for example in neutral territory), old infos apply to the new resource loaded.

So everywhere "b" is remove from scriptData, you should also removed the 3 other keys (only for units I think).
Python:
CvUtil.removeScriptData(pUnit, "x")
CvUtil.removeScriptData(pUnit, "y")
CvUtil.removeScriptData(pUnit, "originCiv")

And when you load a resource in neutral territory, you should add/update "x" and "y". Because I'm currently able to sell some dates an outrgeaous price... I load them at 4 tiles from my city 😅
By setting x/y, the price will be far lower (in my case, 16 gold instead of 64).

In PAE_Cultivation.py, in doCollectBonus4Cultivation:
Python:
# Bonusgut in den Karren laden
CvUtil.addScriptData(pUnit, "b", eBonus)
# Dertuek: Update the coordinates where the resource have been loaded
CvUtil.addScriptData(pUnit, "x", pPlot.getX())
CvUtil.addScriptData(pUnit, "y", pPlot.getY())
# Dertuek: Remove potential infos from the previous cargo
CvUtil.removeScriptData(pUnit, "originCiv")
 
Hi Dertuek!! Great to read from you and thanks for those helpful notes.


Hello,
We can build a Look-out with our hunters but we have no info that it will cost something.

In CvGameUtils.py, at line 3609, instead of this:
Python:
elif iData2 == 2:
    return CyTranslator().getText("TXT_KEY_BUILD_TURM", ())
You could write:
Python:
elif iData2 == 2:
    text = CyTranslator().getText("[COLOR_HIGHLIGHT_TEXT]", ())
    text += CyTranslator().getText("TXT_KEY_BUILD_TURM", ())
    text += CyTranslator().getText("[COLOR_REVERT]", ())
    text += CyTranslator().getText("TXT_KEY_HUNTER_BUILD_TOWER_HELP", ())
    return text
which implies creating a new text key:
XML:
<TEXT>
    <Tag>TXT_KEY_HUNTER_BUILD_TOWER_HELP</Tag>
    <English>[NEWLINE][ICON_BULLET]+10% Tile Defense[NEWLINE]Cost: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] Turn</English>
    <French>[NEWLINE][ICON_BULLET]D&#233;fense de la case +10%[NEWLINE]Co&#251;t : 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] tour</French>
    <German>[NEWLINE][ICON_BULLET]+10% Gel&#228;ndefeld-Verteidigung[NEWLINE]Kosten: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] Runde</German>
    <Italian>[NEWLINE][ICON_BULLET]+10% difensiva della casella[NEWLINE]Costo: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] Turno</Italian>
    <Spanish>[NEWLINE][ICON_BULLET]+10% a la defensa de la casilla[NEWLINE]Coste: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] turno</Spanish>
</TEXT>

This way it gives the full feeling of an improvement building button.

Sure. I will just change the TXT_KEY_BUILD_TURM text, that should do it too:
Python:
 <TEXT>
  <Tag>TXT_KEY_BUILD_TURM</Tag>
  <English>[COLOR_HIGHLIGHT_TEXT]Build a [LINK=IMPROVEMENT_TURM]Look-out[\LINK][COLOR_REVERT][NEWLINE][ICON_BULLET]+10% tile defense[NEWLINE]Cost: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] turn</English>
  <French>[COLOR_HIGHLIGHT_TEXT]Construire un [LINK=IMPROVEMENT_TURM]poste d'observation[\LINK][COLOR_REVERT][NEWLINE][ICON_BULLET]D&#233;fense de la case +10%[NEWLINE]Co&#251;t : 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] tour</French>
  <German>[COLOR_HIGHLIGHT_TEXT][LINK=IMPROVEMENT_TURM]Sp&#228;hturm[\LINK] bauen[COLOR_REVERT][NEWLINE][ICON_BULLET]+10% Gel&#228;ndefeld-Verteidigung[NEWLINE]Kosten: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] Runde</German>
  <Italian>[COLOR_HIGHLIGHT_TEXT]Costruisci un [LINK=IMPROVEMENT_TURM]posto d'osservazione[\LINK][COLOR_REVERT][NEWLINE][ICON_BULLET]+10% difensiva della casella[NEWLINE]Costo: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] turno</Italian>
  <Spanish>[COLOR_HIGHLIGHT_TEXT]Construir un [LINK=IMPROVEMENT_TURM]vig&#237;a[\LINK][COLOR_REVERT][NEWLINE][ICON_BULLET]+10% a la defensa de la casilla[NEWLINE]Coste: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] turno</Spanish>
 </TEXT>


In CvMainInterface.py, at line 2474, there is a button (738) that suggests you can swap 2 resources on a tile (only equivalent resources, ie grain <=> grain or livestock <=> livestock).

How should it work? Let's say I have a cow in my wagon on a tile with a sheep. If I try the swap, in the end:
- the sheep is replaced with the cow on the tile and my wagon is killed (like a normal implantation)
or
- the sheep is replaced with the cow on the tile but my wagon isn't killed and the cow in its cargo has now been replaced with the sheep
?
hm... I do not swap things, I replace them. For livestock it would fit, but for grain... that's why I just replace it and kill the unit to keep it easy.

what would be better? to swap it but only for livestock?
but then there are some more help texts necessary....

The Sell button is displayed twice for all trade units.

In CvMainInterface.py, at line 2464, you can add a "if" to limit this button to cultivation unit (Trade units have their own button later in the code with different checks):
Python:
elif bCity:
    if iUnitType in L.LCultivationUnits: # DERTUEK
        iPrice = PAE_Trade.calculateBonusSellingPrice(pUnit, pPlot.getPlotCity(), 0)
        screen.appendMultiListButton("BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo(
            "INTERFACE_TRADE_SELL").getPath(), 0, WidgetTypes.WIDGET_GENERAL, 741, int(iPrice), False)
        screen.show("BottomButtonContainer")
        screen.enableMultiListPulse("BottomButtonContainer", True, 0, iCount)
        iCount += 1
ah, ok. thanks! changed/added.

When you buy a resource with a merchant, you got these datas in unit's scriptData:
  • b (resource code)
  • x and y (coordinates where the resource was bought)
  • originCiv (origin of the seller)

But when you sell, only "b" is removed. So later, if you collect some resource (for example in neutral territory), old infos apply to the new resource loaded.

So everywhere "b" is remove from scriptData, you should also removed the 3 other keys (only for units I think).
Python:
CvUtil.removeScriptData(pUnit, "x")
CvUtil.removeScriptData(pUnit, "y")
CvUtil.removeScriptData(pUnit, "originCiv")
And when you load a resource in neutral territory, you should add/update "x" and "y". Because I'm currently able to sell some dates an outrgeaous price... I load them at 4 tiles from my city 😅
By setting x/y, the price will be far lower (in my case, 16 gold instead of 64).

In PAE_Cultivation.py, in doCollectBonus4Cultivation:
Python:
# Bonusgut in den Karren laden
CvUtil.addScriptData(pUnit, "b", eBonus)
# Dertuek: Update the coordinates where the resource have been loaded
CvUtil.addScriptData(pUnit, "x", pPlot.getX())
CvUtil.addScriptData(pUnit, "y", pPlot.getY())
# Dertuek: Remove potential infos from the previous cargo
CvUtil.removeScriptData(pUnit, "originCiv")
ok, thanks. changed/added.
 
Hi Dertuek!! Great to read from you and thanks for those helpful notes.
10 years ago... I feel old :old:

Sure. I will just change the TXT_KEY_BUILD_TURM text, that should do it too:
Oh yeah, of course! Why I wanted to make it complicated 🤨
hm... I do not swap things, I replace them. For livestock it would fit, but for grain... that's why I just replace it and kill the unit to keep it easy.

what would be better? to swap it but only for livestock?
but then there are some more help texts necessary....
I just wanted to understand first but I finally understood it like just a "replace" (I read swap from a translation from German).

There are few things to say.
1/ When my wagon is loaded with livestock/grain, anywhere I go on my own territory, the cultivation button is displayed, greyed and the help text says "Only an empty wagon can load goods.". In my opinion, I should see that only when my wagon is over a collectable resource. So it would mean in CvMainInterface.py, at line 2472, check if there is a resource on the plot.
Python:
elif ePlotBonus != -1 and pPlot.getOwner() == iUnitOwner:
instead of just:
Python:
elif pPlot.getOwner() == iUnitOwner:

2/ The replace doesn't work, at least not everytime. For a simple reason. The normal Cultivation function is called. And this function checks the grain/livestock limit of the city (1 for Settlement, 2 for village, 3 for city, ...).
In my case, I wanted to replace my sheep by a most wanted cow. But my city was a village so I was limited to 2 grain/livestock and I had already in the city's radius, the sheep... but also some oat. So the limit was reached. The cultivation button was displayed but when I clicked on it, nothing happened. For what I understand, I should able to replace a resource by another one whatever this limit, no?

Here is how I changed that:

In CvMainInterface.py, I changed iData2 value for the 2 cultivation (738) buttons:
- at line 2475: 738, 738 => 738, 1
- at line 2487: 738, 738 => 738, 0
(meaning 1 = replace, 0 = normal cultivation)

At line 7325, I passed the iData2 to the modNetMessage (last argument... -1 => iData2)
Python:
# iData2: 1 = replace enabled, 0 = replace disabled
CyMessageControl().sendModNetMessage(738, iOwner, iUnitID, iIsCity, iData2)

In CvEventManager.py, at line 1760, I passed a new argument to the doCultivateBonus function:
Python:
PAE_Cultivation.doCultivateBonus(pPlot, pUnit, eBonus, iData5==1)

And finally, in PAE_cultivation.py, I added a new argument to doCultivateBonus:
Python:
def doCultivateBonus(pPlot, pUnit, eBonus, replace=False):

And at line 293, I inhibited the check in the case of the "replace".
Python:
bCanCultivate = replace or _isBonusCultivationChance(iPlayer, pPlot, eBonus, bOnlyVisible, None)
 
When you build a trade post on a resource with a trade unit, a trail is automatically built on the plot. But if the plot already had a route, it is replaced by the trail.

In PAE_Unit.rpy, in doBuildHandelsposten function, you can check if a road already exists:
Python:
if pPlot.getRouteType() == RouteTypes.NO_ROUTE:
    pPlot.setRouteType(0)

Note: You need to import RouteTypes from CvPythonExtensions at the very beginning of the file.
 
Yep, we're getting old.....

distribution 1 and 2: Ok yes, I'll implement your codes. looks great!

Tradepost: thanks, I didn't mention that.... but I will just add if pPlot.getRouteType() == -1 so there is no need to import the RouteTypes to keep loading as fast as possible.
 
I would have, if I would not have added more things in the pedia and the main interface.
stuff like necessary cults are missing in civ and in bug.
stuff like unit food cost is not available.
stuff like bonus ressource on which terrain is not shown in BUG.
etc...
this is more important for me that any graphical changes.
but I can have a look, now that PAE goes SDK, I will do so.
 
In fact, I already play a merged version of BUG + modified PAE 😅
I certainly forgot things here and there. Probably more on the interface. In fact, I'd need a advanced save of PAE in order to compare 🤔

What do you mean about the SDK? You won't try to kkep compatibility with Mac? I meant just BUG, not necessarily BULL. But I have also (at least) some minor improvements about on the dll that wouldn't break the compatibility with Mac.
 
In the PAE Eurasia XXXL 52 CIVs scenario, could you replace the "Knossos" civilization tag with "Minoer" ones? (Team 50)
Code:
Team=50
LeaderType=LEADER_MINOS
LeaderName=TXT_KEY_CIV_POLIS_KNOSSOS1
CivDesc=TXT_KEY_CIV_MINOER_DESC
CivShortDesc=TXT_KEY_CIV_MINOER_SHORT_DESC
CivAdjective=TXT_KEY_CIV_MINOER_ADJECTIVE
(Or create dedicated tags but not just one for all civ desc/short/adj)
 
In lots of concepts pedia entries, there are 3 tabulation at the beginning of each lines. You can see them in xml files but they're not present on your online tool. Is there a problem with file generation? 🤔
 
In the PAE Eurasia XXXL 52 CIVs scenario, could you replace the "Knossos" civilization tag with "Minoer" ones? (Team 50)
Code:
Team=50
LeaderType=LEADER_MINOS
LeaderName=TXT_KEY_CIV_POLIS_KNOSSOS1
CivDesc=TXT_KEY_CIV_MINOER_DESC
CivShortDesc=TXT_KEY_CIV_MINOER_SHORT_DESC
CivAdjective=TXT_KEY_CIV_MINOER_ADJECTIVE
(Or create dedicated tags but not just one for all civ desc/short/adj)
Could you do the same with byzantine civilization (Team 49 in xxxl 52 civs map)?

Edit: And Samarkand (Team 51)
Thx
 
Again in XXXL 52 civs map, you used the Jutes for the team 12. I think that a more ancient people, the Cimbri, should be used. BTW, the leader used, Boiorix, was king of the Cimbri.
 
I think the PAEGameText_Misc.xml file should be removed from XML/Misc. It is already present in XML/Text (its right location).
 
Is it normal that Seer unit has:
XML:
<bMilitaryHappiness>1</bMilitaryHappiness>
?

It triggers a bug in PAE_City.doSupplyUnit.
First, the number of units that could suffer of starvation takes into account only "Military happiness" units.
Then a list of units that will suffer starvation is built. In this list, UNITCOMBAT_HEALER are excluded.

Problem: Seers are both "Military happiness" and UNITCOMBAT_HEALER so it may end in a bug depending on the whole number of units in the city.

When building the list (lUnitsAll), I think the code should be:
Python:
                        if pLoopUnit.getUnitCombatType() != -1 and pLoopUnit.getOwner() == iPlayer:
                                if pLoopUnit.getUnitType() == gc.getInfoTypeForString("UNIT_SUPPLY_WAGON"):
                                        iExtraSupply = PAE_Unit.getSupply(pLoopUnit)
                                        if iExtraSupply <= iMaintainUnits:
                                                iMaintainUnits -= iExtraSupply
                                                iExtraSupply = 0
                                        else:
                                                iExtraSupply -= iMaintainUnits
                                                iMaintainUnits = 0
                                        # set new supply tickets
                                        PAE_Unit.setSupply(pLoopUnit, iExtraSupply)
                                elif pLoopUnit.isMilitaryHappiness():
                                        lUnitsAll.append(pLoopUnit)

PS: I'm not sure Seers should have "Military happiness" in any case.
 
Sure. I will just change the TXT_KEY_BUILD_TURM text, that should do it too:
Python:
 <TEXT>
  <Tag>TXT_KEY_BUILD_TURM</Tag>
  <English>[COLOR_HIGHLIGHT_TEXT]Build a [LINK=IMPROVEMENT_TURM]Look-out[\LINK][COLOR_REVERT][NEWLINE][ICON_BULLET]+10% tile defense[NEWLINE]Cost: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] turn</English>
  <French>[COLOR_HIGHLIGHT_TEXT]Construire un [LINK=IMPROVEMENT_TURM]poste d'observation[\LINK][COLOR_REVERT][NEWLINE][ICON_BULLET]D&#233;fense de la case +10%[NEWLINE]Co&#251;t : 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] tour</French>
  <German>[COLOR_HIGHLIGHT_TEXT][LINK=IMPROVEMENT_TURM]Sp&#228;hturm[\LINK] bauen[COLOR_REVERT][NEWLINE][ICON_BULLET]+10% Gel&#228;ndefeld-Verteidigung[NEWLINE]Kosten: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] Runde</German>
  <Italian>[COLOR_HIGHLIGHT_TEXT]Costruisci un [LINK=IMPROVEMENT_TURM]posto d'osservazione[\LINK][COLOR_REVERT][NEWLINE][ICON_BULLET]+10% difensiva della casella[NEWLINE]Costo: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] turno</Italian>
  <Spanish>[COLOR_HIGHLIGHT_TEXT]Construir un [LINK=IMPROVEMENT_TURM]vig&#237;a[\LINK][COLOR_REVERT][NEWLINE][ICON_BULLET]+10% a la defensa de la casilla[NEWLINE]Coste: 4 [ICON_GOLD][NEWLINE][COLOR_HIGHLIGHT_TEXT]1[COLOR_REVERT] turno</Spanish>
 </TEXT>
1723988572188.png


Finally I didn't do that for nothing. The TXT_KEY_BUILD_TURM key isn't used only by Hunters. If you write everything in this tag, you'll see the whole in place you don't want to (take a look at the Work Elephant in the pedia).
 
Back
Top Bottom