TC01 just read your post and i am aa touch confused, my apologies.
I currently only have a knowledge of XML stuff not python.
Would your idea refer to a map reference, so one tile of that grid reference. Or would it be possible to define as a particular tile bonus e.g. iron or ruins?
Sorry I don't fully understand you like I said its a lack of understanding of the Python coding and mechanics.
But am I understanding that you would need python to achieve my aim?
Yeah, I meant to show the code, but I forgot and had to look up the functions. Sorry.
To make it so that a special settler unit can settle only on a certain plot, you'd have to use python, as well as XML.
First, you'd need to go into Assets/XML/PythonCallbackDefines.xml and change "USE_CANNOT_FOUND_CITY_CALLBACK" from 0 to 1. If it is set to 0, the game will never run this function. (As a note, if you do something in python and it doesn't do anything in game, you should check this file and make sure the function you are messing with isn't listed here with a "0".)
Then, you'd need to go into Assets/Python/CvGameUtils.py, search for cannotFoundCity, and change it into something like this...
Code:
def cannotFoundCity(self,argsList):
iPlayer, iPlotX, iPlotY = argsList
pPlot = CyMap().plot(iPlotX, iPlotY)
for i in range(pPlot.getNumUnits()):
pUnit = pPlot.getUnit(i)
if pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_COPPER_SETTLER'):
if pPlot.getBonusType() == gc.getInfoTypeForString('BONUS_COPPER'):
return False
return True
return False
What this does is:
1. Sets "pPlot" to the coordinates (iPlotX, iPlotY). The lines above are the default function, everything below I've added.
2. The next two lines count all the units on pPlot and store them as a variable, pUnit, which is not one single unit but rather every unit on the plot at once. (I can do something similar to get all the plots on the map.)
3. The next line is an if-statement: if one of the units on the map has the Type UNIT_COPPER_SETTLER, a nonexistant unit that can only settle on Copper. If it does, it does the steps indented below it. Else, it simply returns False, meaning you can build a city.
4. The next line only triggers if the if statement above it is true. It asks whether the plot UNIT_COPPER_SETTLER is on has the Bonus (resource) Copper. If it does, it returns False (can build), but if it doesn't, it returns True (can't build).
If I wanted, I could change the "if pPlot.getBonusType()" line to "if pPlot.isHill", or "if pPlot.getImprovementType()", or "pPlot.getFeatureType()", allowing for other conditions.
You also need to create a "UNIT_COPPER_SETTLER", I didn't in a quick test I ran. However, using the normal Settler, I can still build cities anywhere I want, even with this code in the game. It might not work for UNIT_COPPER_SETTLER, though... if you can't get it to work, just ask.
(If someone sees a reason why this code won't work, please tell me- I'm not that great at python either...)