if pPlayer.getAlignment() != gc.getInfoTypeForString('ALIGNMENT_GOOD'):
cf.doTurnPaladin(iPlayer)
if pPlayer.getAlignment() != gc.getInfoTypeForString('ALIGNMENT_NEUTRAL'):
cf.doTurnDruid(iPlayer)
if pPlayer.getAlignment() != gc.getInfoTypeForString('ALIGNMENT_EVIL'):
cf.doTurnEidolon(iPlayer)
I made a function that will dismiss Eidola, Druids and Paladins if the owner is not Evil/Neutral/Good. I did it with these :
in CvEventManager.py
Spoiler :Code:if pPlayer.getAlignment() != gc.getInfoTypeForString('ALIGNMENT_GOOD'): cf.doTurnPaladin(iPlayer) if pPlayer.getAlignment() != gc.getInfoTypeForString('ALIGNMENT_NEUTRAL'): cf.doTurnDruid(iPlayer) if pPlayer.getAlignment() != gc.getInfoTypeForString('ALIGNMENT_EVIL'): cf.doTurnEidolon(iPlayer)
Is there any way to make these more resources friendly? Suppose, is there any command to check whether a civ has just changed alignment? Thus, I can make the code run only after a specific civ changed its alignment, not on every turn.
Thanks.
CvCityAI.cpp and AI_chooseproduction in cvgameutils.py
OK. A couple of more questions.
I'm looking for the section of code where the AI decides the following (preferably in Python as I have no tools or knowledge for dealing with the C++ code):
1) When/where to settle new cities
2) When to go into and out of ConquestMode
Also, in the cvgameutils.py file, I have several variables that I want to access from, the ChooseProduction, ChooseTech and AIUpdate functions. Currently I'm just recreating the variables in each function. Is there one central spot where I can create these variables? And is it a good idea to do so or would it be better to keep them within the functions?
try newUnit.setDuration(iTurns)
don't know of a python function that allows you to modify the basemoves, but you could use the same promotion that keeps Acheron in his City.
1.) both calculation for which plots to settle and orders for settlers are done in the DLL. In general very difficult to change.
2.) AI will never leave Conquestmode. Code to enter Conquestmode is in techacquired event in CvEventmanager.py
It very difficult to save values in python. What you can do is to create a function CalculateYValue and then have that function return YValue and call the function whenever you need it.
The AI seems very reluctant to settle on marginal coastline, which really hinders it on Archipelago maps and other times where it gets stuck on an island chain.
I am trying (and failing) to acces terain features via python.
In perticular, I want a code that equates to:
If(improvement(x,y) == forest)
do something
Any advice on how to do that?
iFeature = pPlot.getFeatureType()
if iFeature == -1:
return
if (iFeature == gc.getInfoTypeForString('FEATURE_FOREST')):
do Something
pPlot.setFeatureType(gc.getInfoTypeForString('FEATURE_FOREST_NEW'), 1)