Combining Two Mods - Python Problem

SneoplesGov

Chieftain
Joined
Apr 25, 2016
Messages
11
Hi! So I'm attempting to do a mod that would combine the 'Better BUG AI' mod by Fuyu with The_J's 'WarNPeace' script. This would allow me to create a mod with scripted war and peace events while maintaining the excellence of the BTS Unaltered Gameplay and Better AI mods.

This is where my problem comes in. Both the WarNPeace Script and the Better BUG AI mod have EventManager.py files. Whenever I simply add CvEventManager.py (WarNPeace) to the BUG mods Python file (which holds BUGEventManager.py), the WarNPeace script does not work correctly. I know absolutely nothing about Python, so I couldn't combine these two files if I tried.

If anyone would know how to do this (or even be kind enough to do it), I would be eternally grateful :D.

Below are the two Python files.
 

Attachments

Easiest way to do something like this is to take the "easy" one, in this case there is no question its the WarNPeace that have the fewest modifications. Then WinMerge against the original BtS and see what changes have been made. It was only 3 places. Shouldnt be a problem adding these to their respective places ;)

Edit. Oh btw, you need the CvEventmanager, not the BugEventManager.

PHP:
###WarNPeace part 1 start###
import WarNPeace
###WarNPeace part 1 end###
PHP:
	def onLoadGame(self, argsList):
		CvAdvisorUtils.resetNoLiberateCities()
		###WarNPeace part 2 start###
		WarNPeace.loadEvents("Mods/WarNPeaceScript/Assets/XML/CustomXML/WarNPeace.xml")
		###WarNPeace part 2 end###
		return 0

	def onGameStart(self, argsList):
		'Called at the start of the game'
		###WarNPeace part 3 start###
		WarNPeace.loadEvents("Mods/WarNPeaceScript/Assets/XML/CustomXML/WarNPeace.xml")        
                ###WarNPeace part 3 end###

PHP:
	def onBeginGameTurn(self, argsList):
		'Called at the beginning of the end of each turn'
		iGameTurn = argsList[0]
		###WarNPeace part 4 start###
		WarNPeace.triggerEvents(iGameTurn)        
                ###WarNPeace part 4 end###		
		CvTopCivs.CvTopCivs().turnChecker(iGameTurn)
 
Edit. Oh btw, you need the CvEventmanager, not the BugEventManager.

There is no CvEventmanager in full BUG installations. BUG allows modular python for easier modding by many modders. There is documentation on how to do it.

Anyway attached is a quick and dirty conversion that I have not tested and wont get to for a couple of days.

It should work just dropped in except you need to do 2 things

1) change the name of the mod folder in the python file WarNPeace_EM.py to the name of your mod.

2) in Assets/Config/init.xml add the following line after BUFFY

Code:
	<!-- BUFFY -->
	
	<load mod="BUFFY"/>
	[B]<load mod="WarNPeace_EM"/>[/B]

gah, I haven't made a compressed file of it yet. back soon.
 

Attachments

Oh my goodness, thank you thank thank you thank you!

This really makes my stuff a lot easier to work on, believe me. Thank you so much!
 
Back
Top Bottom