You could check if the civilization is allowed to declare war, and if it is then make them declare war
Code:
if pAttacker.canDeclareWar(iDefender):
pAttacker.declareWar(iDefender, True, -1)
you can also add
Code:
if not pAttacker.isAtWar(iDefender):
if you want to check if they are already at war.
But note that if for example the attack and defender have a peace treaty then it won't declare war, since it is not allowed to.
You can check the API with all python functions for civilization here: http://civ4bug.sourceforge.net/PythonAPI/ and you can just CTRL + F and search for the word war and a lot of functions about war will come up.
EDIT:
I also found a much better method to make 2 civilizations have peace
I expressed myself wrongly, my point was that civilizations should not cause any war between themselves, including the player. (the effect of the war can only be achieved through historical events) @Louis the XIV
I expressed myself wrongly, my point was that civilizations should not cause any war between themselves, including the player. (the effect of the war can only be achieved through historical events) @Louis the XIV
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.