Merging Event Managers. How can you do it?

Louis the XIV

Sun King
Joined
Jun 23, 2020
Messages
837
Location
Court of Versailles
There are 2 components that I want to use in a mod. The Spawn A Civ and War N Peace. They both have 3 parts: EventManager.py, WarNPeace.py or SpawnACivUtil.py, and the Custom Xml folder. The problem is in the Event Manager. I tried merging them, creating a custom event manager, creating a custom assets folder in the modules folder, and copying the parts I need from the Event Managers to a custom python file. None Worked:(! All advice appreciated:)!
Link to the WarNPeace: https://forums.civfanatics.com/resources/warnpeace-script.18546/
Link to the Spawn A Civ: https://forums.civfanatics.com/threads/spawn-a-civ.658359/#post-15858599
PS. The Spawn a civ basis was created by @The_J, this spawn a civ is just the edited version by @Hutma to make it work.
 
In theory, simply merging the right parts into one file should work.
The tricky part can be that for python files the amount of spaces/tabs in the file really matters, and normal text editors like notepad will sometimes mess it up.

If you have the merged file still, then upload it here, I can have a look if this is the cause.
(I can't test it though, I got rid of all my games a couple of years ago).

Also @Leoreth @Rob (R8XFT), this thread belongs into the main Civ4 C&C forum.
 
Here is the file. It only reads the Spawn a civ. I haven't really payed attention to the spaces and tabs so that might be the problem, and I'm using notepad.
 
Seconding WinMerge. The EventManager files should have a bunch of methods that are named
Code:
def on<some event>(argsList)
The important part is to make sure that all code that is in that method for the two original files is also in that method in the merged files. WinMerge probably helps you get there most of the way. However, it may still mess up because it isn't aware of this meaning of the code. So you may have to manually adjust some of that. I would do this copy/paste work in WinMerge too, you can refresh with F5 and it will align the matches based on your changes, often producing a much more helpful result.
 
In theory, simply merging the right parts into one file should work.
The tricky part can be that for python files the amount of spaces/tabs in the file really matters, and normal text editors like notepad will sometimes mess it up.

If you have the merged file still, then upload it here, I can have a look if this is the cause.
(I can't test it though, I got rid of all my games a couple of years ago).

Also @Leoreth @Rob (R8XFT), this thread belongs into the main Civ4 C&C forum.
Oh sorry I just realized that I didn't post the file!!!
 

Attachments

  • CvEventManager.txt
    40.4 KB · Views: 39
Yeah I checked multiple times. I thought it might be easier if I just create my civ spawning but a bit more like in RFC. I checked a lot of RFC python files and got the hang of it a bit, only problem is that I never saw the coordinates defining where the civ will spawn. Maybe you know?
 
Ok but I have 2 things to say.
I found a thread for a mod that was cancelled called Modern World and you helped a lot with the python, you already created a EventManager that was merged with the WarNPeace and the Spawn a unit. (Though not the Spawn a Civ)
Second I can't upload the whole mod I have been working on cause the size is 1.15 Gigabites.
 
Top Bottom