Fabrysse
Charming-snake learner
First : I don't know SDK at all. So I have to use only python.
What do I want to do ?
At turn 'N', I want the civ with ID '0' to split in 2 civs.
What is already done ?
in XML files I have defined a civ (with leader, and all needed elements) that is not playable and not included on the map.
How did I try to do that ?
The result is :
Why doesn't it run ?
Is it because I don't have defined a Leader for the new civ ? There is only one available for this civ... If that is the problem : how will I do that ?
Is it something else ?
Is it possible to do that like that ?
Should I use this other way (with hide dead civs) :
Could you help me please ?...
What do I want to do ?
At turn 'N', I want the civ with ID '0' to split in 2 civs.
What is already done ?
in XML files I have defined a civ (with leader, and all needed elements) that is not playable and not included on the map.
How did I try to do that ?
Code:
#I create a new player (calling it with id 2, I suppose It'll point the third civ in the xml file...) :
NewPlayerIdx = 2
newPlayer = gc.getPlayer(NewPlayerIdx)
#The player who will loose cities
py = PyPlayer(0)
#I make a test on 1 city in list of player '0' :
apCityList = py.getCityList()
for pCity in apCityList:
#Try it for 'Burgos'
if (pCity.getName() == 'Burgos'):
#Give this city to newPlayer
[COLOR="Red"]newPlayer.acquireCity( pCity.GetCy(), False, False )[/COLOR]
#Set this new player
newPlayer.setAlive( True )
The result is :
- I have an error in logs, on the red line
- Burgos is destroyed
- The list of civs (bottom right of main screen) desappears
- when I click the "next turn" button, I have nothing (not really a crash, but nothing can be done)
Why doesn't it run ?
Is it because I don't have defined a Leader for the new civ ? There is only one available for this civ... If that is the problem : how will I do that ?
Is it something else ?
Is it possible to do that like that ?
Should I use this other way (with hide dead civs) :
- On map : create 1 settler for the new civ
- atBeginGame : destroy this settler (should kill the civ)
- at turn 'N' : use the function 'reviveActivePlayer()'
Could you help me please ?...