cfkane
Emperor
- Joined
- Feb 7, 2006
- Messages
- 1,196
I've already posted this question in the main modding forum, but I thought I'd get a more direct answer here, since I'm asking about a particular python function that's used in FFH2.
I'm working on a mod of my own right now, and I was planning on including one or two special units that automatically create buildings when stationed in a city, the way that Loki or a Gypsy Camp does.
My mod is going to have a Sherlock Holmes unit that creates a Baker St. building whenever he's in a city owned by the civ that controls him. Here's the code I've been using:
I'm also planning on making a Fu Manchu unit that creates Limehouse when he's in a foreign city.
How do I code this? I think I've found the python function in FFH that governs this attribute (under OnDefCityDoTurn), and I've tried to copy it into my own mod, but it doesn't seem to be working. How do I adapt the code to do what I'm trying to get it to do?
I'm working on a mod of my own right now, and I was planning on including one or two special units that automatically create buildings when stationed in a city, the way that Loki or a Gypsy Camp does.
My mod is going to have a Sherlock Holmes unit that creates a Baker St. building whenever he's in a city owned by the civ that controls him. Here's the code I've been using:
Code:
ef onCityDoTurn(self, argsList):
'City Production'
pCity = argsList[0]
iPlayer = argsList[1]
CvAdvisorUtils.cityAdvise(pCity, iPlayer)
if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_2241B_BAKER_ST')):
for i in range(pPlot.getNumUnits()):
pUnit = pPlot.getUnit(i)
if (pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_SHERLOCK_HOLMES')):
if pUnit.getOwner() != pCity.getOwner():
pCity.setNumRealBuilding(gc.getInfoTypeForString(' BUILDING_2241B_BAKER_ST'), 1)
gc.getPlayer(pUnit.getOwner()).changeGold(1)
I'm also planning on making a Fu Manchu unit that creates Limehouse when he's in a foreign city.
How do I code this? I think I've found the python function in FFH that governs this attribute (under OnDefCityDoTurn), and I've tried to copy it into my own mod, but it doesn't seem to be working. How do I adapt the code to do what I'm trying to get it to do?