[python] problems when I try to kill a player...

Fabrysse

Charming-snake learner
Joined
Sep 11, 2006
Messages
430
Location
Toulouse - France
At a turn "t", I want a player "A" to be killed and his cities acquired by other players : "B", "C", "D",...
So, I have a loop that takes all the cities of "A" one by one, and I say for instance PlayerB.acquireCity(theCity, False, False)
I tried PlayerB.acquireCity(theCity, True, False) : same result
:cry:

Sometimes it runs, sometimes not. And I don't exactly know why (I have an unidentifiable C++ exception on this line in the python logs, and nothing more).
When I look at the map after my loop (that crashed), I see that Player A still have only one city.
So my question is : Do I have to do something before killing this player ?

If you have any idea, please tell it, I'll try....


While I write this, I think that the problem could be that my Player A is the human player (in a game "single player only"). Could it be the problem ?
 
Just an idea to check your bug . I've taken a look at the cpp file , but i'm not good enough to understand where the bug can occur . Perhaps you should try this , begin by killing all units APlayer.killUnits() and then make a try: except: ( make the list of building , ... to check if there is a common thing when that crash ) . Another possibility is to store every city attributes ( building , name ,location , etc .. ) use APlayer.killCities() to check if you still have the bug with this function then recreate the cities for each player .

Hope this can help , but i have no idea of what happened .

Tcho !
 
Just an idea to check your bug . I've taken a look at the cpp file , but i'm not good enough to understand where the bug can occur . Perhaps you should try this , begin by killing all units APlayer.killUnits() and then make a try: except: ( make the list of building , ... to check if there is a common thing when that crash ) . Another possibility is to store every city attributes ( building , name ,location , etc .. ) use APlayer.killCities() to check if you still have the bug with this function then recreate the cities for each player .

Thanks for your help. I'll try.

Hope this can help , but i have no idea of what happened .

Tcho !

The python logs are so usefull in 99% of bugs, that when we don't have them, the problems become harder !
 
The Road to War mod uses this to change France into Vichy. You could take a look at the codes for that as it works perfectly.
 
Back
Top Bottom