No war in game until certain date, turn or event?

wotan321

Emperor
Joined
Oct 25, 2001
Messages
1,228
Location
NC, USA
Is there a mod, or python script, that prevents any war until a certain date, turn, tech, or is triggered by an event?

I saw The_J's mod that launches a war or peace this way, and other mods that turn on permanentwar or permanentPeace, but they don't allow for permanentPeace being turned off so normal relations can resume, which may lead to war.

This is for the 1939 WW2 mod, I want just peace until a certain event, then regular diplomatic activity.

Any help is greatly appreciated.
 
Thanks keldath, I downloaded Platyping's improved WarNPeace script. I will test it out.

From the look of it, I should be able to launch Permanent Peace at the beginning of the game, and turn it off later. My only concern is that this uses the built in GAMEOPTION_ALWAYS_PEACE which from what I have read, cannot be turned off.

I will report back on my findings.
 
It doesn't seem to do anything.... I merged the Platyping WarNPeace v.2 into the mod, and I can look at the log files and see it loaded in python and xml, but nothing in the game ever occurs.
 
Keldath, thanks again for your reply. I downloaded your mod and see where you used the WarNPeace mod very well in your mod.

You use it bring a war between two civs for a number of turn.

I need it to prevent all civs from being at war until a certain turn, and I was unable to get that to work still. I am not even sure this mod can do that.

If anyone can provide a mod or script to do what I am asking about, I would be grateful.
 
I don't think that what you ask is possible, at least not without C++ coding (unfortunately - I would love to be contradicted). But with Python you can force peace or war as you wish, it is simply not the best solution. I mean that if a war is dclared before 1939, you can immediately force peace the next turn and vice-versa, that's it.
 
Just add some codes to CvGameUtils for candeclarewar or whatever it is
 
True - never realised that there was one. Thank you for contradicting me! ;)

PS/Edit: you will need to activate the Python Callback for that: USE_CAN_DECLARE_WAR_CALLBACK.
 
Thanks for this information. I am not educated on Python but will get busy looking through threads and in some of the Mods to see how this is done. Any more information would be appreciated.

Again, thanks.
 
What exactly should trigger the "can now declare war"?

An event (random event), a specific turn or a year? If it's a scenario on WWII, it might be easier to select a turn.
 
Yes, isenchine, I agree, just a turn trigger would be enough.

Your feedback is wonderful, I am grateful. I did not know that bit of python "canDeclarWar" existed.

I would like the game to start with no one able to declare war, and at a certain game turn, everyone able to declare war (but not automatically at war).

Again, many thanks.
 
Here is the code then for CvGameUtils.py (arbitrarily set at turn 8):
Code:
	def canDeclareWar(self,argsList):
		iAttackingTeam, iDefendingTeam = argsList
		if CyGame().getGameTurn() <= 8:
			return False
		else:
			return True
There could be variations in case needed.

As I said, it implies activating Python callback in the PythonCallbackDefines.xml (located directly under XML directory in case you wonder) as such:
Code:
	<Define>
		<DefineName>USE_CAN_DECLARE_WAR_CALLBACK</DefineName>
		<iDefineIntVal>1</iDefineIntVal>
	</Define>

Try it. :)
 
That works. One small addition, since the mod I am using incorporates the BUG mod, I had to go to the BugGameUtils.py file and rem out the particular line seen below.

# self._setDefault("canDeclareWar", True)

Impressively easy solution, I was worried about much more code being involved. Thanks so much.

I'm especially impressed that a game this old still has considerate users hanging about to save the day. My hat is off to everyone who stepped in to help out. :goodjob:
 
It worked out for me in a big way. I got my code, renewed my faith in mankind, AND got introduced to your Empire of Liberty Mod which I will wade into soon. Thanks to all.
 
Back
Top Bottom