Small bug fixes

Joined
Sep 21, 2007
Messages
4,878
Before Rhye comes back from Japan, here's a couple fixes for the most annoying "bugs":

1. Wheat, sheep and cow will no longer appear on mountains (changed RFCUtils.py)
2. No more native conquerors (somehow Rhye thought to make the natives old world--changed Consts.py)
3. Ethiopia, Mali, Maya now have their old number of settlers to allow possible UHV. (changed RiseandFall.py)

Obviously, I'm no expert, so use at your discretion. (I can't upload .py files, so I rarred them).

If somebody can generate code for RFCUtils.py to randomly add either a stone or marble to the 3000BC civs that usually have it in RFC, that would be great.


Edit: I'm deleting my files in favor of onedreamer's correct fixes: see below.
 
Thanks!
About the resource placement, how does it work exactly? Does it just remove resources from mountains, or does it place them somewhere near?
 
No, apparently the code checks if you're a medieval European civ, and then checks around your spawn site and if it's a grassland or plains without a bonus, it puts a cow there (or wheat for Netherlands). All I did was to add the criterion not to put anything on mountains. There's still a conflict though: once it puts the cow there, the Dutch or Portuguese can't get wheat on that tile.

I think the other problem about occupying core areas is that Rhye seems not to have changed the constants in const.py regarding core areas (in fact they shouldn't be constants anymore since core areas should be random), and hence if you spawn in the "right" areas (e.g. I spawned south of China as Mongolia) you get your criterion fulfilled automatically.
 
thanks AP. Downloading now to try it out.
 
This may sound like a dumb question, but how do I add this code? Do I replace the original?
 
@Umarth

I replaced the python files with your files, and loaded up a game. Egypt and Babylon have no stone or marble anywhere near them. In fact Babylon starts in the middle of a desert.
 
Yeah... I appear to have broken something. I played a game with it and nobody else spawned, I wonder how that happened.
 
Umarth what are your changes about ? You didn't post a word or a readme >_<
Are they supposed to randomly add stone/marble to early civs as asked by AP ?
 
Does the new code work?
 
Umarth what are your changes about ? You didn't post a word or a readme >_<
Are they supposed to randomly add stone/marble to early civs as asked by AP ?
Yes, but they don't work. Sorry, I forgot to take out the file when I edited my post.
 
AP that fix for the Maya worked and I completed the first 2 UHV's thanks to the extra settler (by 1 turn for the Temple!). Still took me a ton of restarts till I managed it but now im well on my way to surviving conquistadores thanks to my Longbows. Thanks for your efforts dude.
 
Umarth, are you sure that the function to improve starting location is called for the 3000 BC civs ? I suspect it isn't.
 
Good to hear Corm. I debated whether to reverse the Khmer handicap, but I think one more city is just going to make average city size smaller. What is needed is a massive overhaul of resource/civ placement a la the original world map.
 
Úmarth;7108804 said:
Possibly not. That wouldn't explain why it stopped everyone else from spawning though.

well, since the function is called when new civs spawns, it seems connected. Looking at Rhye's code, it seems there could be a problem of brackets (from AP's code onwards), but I don't know Python so I'm just speculating. If the function doesn't return a correct value that could stop a new civ from spawning.
 
I think I misplaced a parenthesis in the England/Japan part (I corrected it in the 450 AD and 900 AD euro civs part but didn't do it for the sheep):

"and" apparently trumps "or" in logic.

if (iCiv == con.iEngland or iCiv == con.iJapan):
if (( CyMap().plot( startX, startY ).area().getID() != self.getEurasiaInfo(4) and CyMap().getSeaLevel() <= 1) or (CyMap().plot( startX, startY ).area().getNumTiles() <= 120 and CyMap().getSeaLevel() == 2)): #on island
for x in range(startX-2, startX+3):
for y in range(startY-2, startY+3):
pCurrent = CyMap().plot( x%CyMap().getGridWidth(), y%CyMap().getGridHeight() )
if (pCurrent.getTerrainType() != con.iTerrainPeak) and (pCurrent.getTerrainType() == con.iGrass or pCurrent.getTerrainType() == con.iPlains):
if (pCurrent.getBonusType(-1) == -1 and pCurrent.getFeatureType() == -1):
pCurrent.setBonusType(con.iSheep)
break
break


The 450 AD code could easily be modified to provide the 3000 BC civs with stone or marble if somebody knows how to choose randomly a tile to place it in. (my python coding experience so far has been to do very simple things that one can deduce from the code itself.)
 
AP, I had already "fixed" that problem (it's the one I was speaking about, and since Umarth probably copy-pasted from the last line, he carried it over to his new lines) and tested along with Umarth's code, but it seems it wasn't really a problem, or THE problem, since the "Rise" of new civs still doesn't work.

From my understanding -of a complete ignorant in Python-, the code you posted is already one to add a resource randomly in the fat cross of a city... the problem is that this is only the function that does it, but then the one that calls it should probably be adjusted to do it also for the 3000 BC civs. That one is in the Rhyes and Fall file, but I don't understand anything of it ^^
 
All of the plot improvements are part of the "improveStartingLocation" function which is already run. I did manage to add Stone to the starting civs, and for the sake of balance, marble to the classical civs (Greece, Rome, Persia, Carthage) since otherwise they're really the only ones to not get anything, and it helps with at least Greece. The problem I ran into is that the current code adds the stone to ALL Desert and Plains tiles within the city radius that doesn't already have a bonus type on it. As with most of us, I only do what I can deduce from the current code, and trying to make it loop once and randomly choose a single plot eludes me. But adding things in is possible.

I currently have it set so that only Babylon and Egypt get the stone, as China tends (on my attempts, anyway) to be all on Grasslands so won't get it anyway, and India doesn't really need it as badly. And only Greece and Rome get the Marble. Which doesn't overpower Rome so much as they tend to spawn similar to China with mostly grasslands anyway

I make no promise that this works, but for anyone who wants it....

Spoiler :


if (iCiv in con.lCivGroups[2] and con.tBirth[iCiv] < con.i2250BC): #Setting tBirth to = i3000BC hangs game
for x in range(startX-1, startX+2):
for y in range(startY-1, startY+2):
pCurrent = CyMap().plot( x%CyMap().getGridWidth(), y%CyMap().getGridHeight() )
if ((pCurrent.getTerrainType() != con.iTerrainPeak) and (pCurrent.getTerrainType() == con.iDesert or pCurrent.getTerrainType() == con.iPlains)):
if (pCurrent.getBonusType(-1) == -1):
pCurrent.setBonusType(con.iStone)
break
break

if (iCiv in con.lCivGroups[0] and con.tBirth[iCiv] < con.i650BC): #Setting tBirth to = i3000BC hangs game
for x in range(startX-1, startX+2):
for y in range(startY-1, startY+2):
pCurrent = CyMap().plot( x%CyMap().getGridWidth(), y%CyMap().getGridHeight() )
if ((pCurrent.getTerrainType() != con.iTerrainPeak) and (pCurrent.getTerrainType() == con.iDesert or pCurrent.getTerrainType() == con.iPlains)):
if (pCurrent.getBonusType(-1) == -1):
pCurrent.setBonusType(con.iMarble)
break
break



I have this inserted after the forest/tundra edits, prior to the cow spawning. (RFCUtils.py inserted at line 1753)

It works for me, but I have some other minor tweaks in Python, so it might not work perfectly. If anyone knows how to randomly choose a plot from the range extracted by the x and y start range, feel free to share. =)
 
How about changing gold/gems or elephant to stone for Egypt and Babylon, and gold/gems/elephant to marble for Greece and Rome, just around the spawn sites. In that way you just get one marble, and not all marble on desert tiles.
 
Top Bottom