Also, here is the code that works with the above code to force workboats to build fishing boats, and goes in the CvEventManager file:
print("Begin Game Turn")
myMap = gc.getMap()
myUnitNumber = gc.getInfoTypeForString("UNIT_WORKBOAT")
fishPlot1 = myMap.plot(26,50)
fishPlot2 = myMap.plot(28,48)
fishPlot3 = myMap.plot(70,21)
fishPlot4 = myMap.plot(70,27)
fishPlot5 = myMap.plot(80,45)
fishPlot6 = myMap.plot(78,48)
fishPlot7 = myMap.plot(100,54)
fishPlot8 = myMap.plot(31,22) #Lake Titicaca for Settler'sEarthBasemap
myFishingBoats = gc.getInfoTypeForString("BUILD_FISHING_BOATS")
myBoatsImprovement = gc.getInfoTypeForString("IMPROVEMENT_FISHING_BOATS")
oilPlot1 = myMap.plot(79,46)
oilPlot2 = myMap.plot(80,49)
myOffshorePlatform = gc.getInfoTypeForString("BUILD_OFFSHORE_PLATFORM")
myPlatformImprovement = gc.getInfoTypeForString("IMPROVEMENT_OFFSHORE_PLATFORM")
myPlots = [fishPlot1, fishPlot2, fishPlot3, fishPlot4, fishPlot5, fishPlot6, fishPlot7, fishPlot8, oilPlot1, oilPlot2]
for myPlot in myPlots: #Cycle through all freshwater resources not connected to coast
myUnit = myPlot.getUnit(0)
myTeam = myUnit.getTeam()
print(myUnit.getUnitType())
if(myUnit.getUnitType() == myUnitNumber):
print("is workboat")
if(myPlot.getImprovementType() < 0 and myPlot.getBonusType(myUnit.getTeam()) > 0):
print("has bonus")
if(myUnit.canBuild(myPlot, myFishingBoats, True)):
print("canBuild")
myPlot.setImprovementType(myBoatsImprovement) #Manually set the improvements
print("set boats")
myUnit.kill(True, myTeam) #Manually kill the workboats
print("killed fishing workboat")
elif(myUnit.canBuild(myPlot, myOffshorePlatform, True)):
print("canBuild platform")
myPlot.setImprovementType(myPlatformImprovement)
print("set platform")
myUnit.kill(True, myTeam)
print("killed oil workboat")
elif(myPlot.getImprovementType() >= 0):
myUnit.kill(True, myTeam)
print("killed workboat, existing improvement")
cityOLakesPlot1 = myMap.plot(27,48) #This is Detroit, which is connected to two isolated freshwater lakes with bonuses, so separate code is needed for Lake Erie
cityOLakesPlot2 = myMap.plot(28,49) #Add more code later for this maize plot north of Lake Erie, which only matters in Settler's Earth Basemap
myCityOLakesPlots = [cityOLakesPlot1, cityOLakesPlot2]
myUnit = cityOLakesPlot1.getUnit(0)
myTeam = myUnit.getTeam()
myMission = MissionTypes.MISSION_MOVE_TO
myMissionAI = MissionAITypes.NO_MISSIONAI
print(myUnit.getUnitType())
if(myUnit.getUnitType() == myUnitNumber):
print("is workboat")
myGroup = myUnit.getGroup()
print("units in group: ", myGroup.getNumUnits())
print(myGroup.canMoveInto(fishPlot2, False))
myGroup.pushMission(myMission, 28, 48, 1, False, True, myMissionAI, cityOLakesPlot1, myUnit) #This may not work on all computers, so manually sets improvements and kills boats later
print("mission pushed")
print(fishPlot2.getUnit(0).getUnitType())
myGroup.pushMoveToMission(28, 48)
print("mission pushed")
print(fishPlot2.getUnit(0).getUnitType())
fishPlot2.setImprovementType(myBoatsImprovement)
print("set boats")
myUnit.kill(True, myTeam)
print("killed fishing workboat")
However note this code works directly with the map. If you wanted to use it with a custom map instead of the ones in my mod, you'd need to rewrite the coordinates for each resource.