View Full Version : Python Mod Combining Question


ERLoft
Nov 26, 2005, 02:28 AM
Ok, I'm not ever likely to release this, as very little of it is my own work, and I'd need the individual permission of each mod maker, but I'm trying to combine a number of mods, including, but not limited to:

Realism
Lost Units
Lost Wonders
Forestry
Great People

I've been using Compare It! and jEdit to work on the XML files, which I think I'm getting set up correctly (won't know until I try to load the mod, now will I?). But I have a question regarding Python files.

I already have a CvEventInterface python file from Realism in the EntryPoints directory, which is a bit different than the CvEventInterface python file from the Great People mod. Here's the two files:

####################################
#### Civilizations 4 Realism Mod ###
#### by jaynus ###
####################################
#
# Events Engine Overwite interface file
#


import CvUtil
import CvRealismEventManager
from CvPythonExtensions import *

eventManager = CvRealismEventManager.CvRealismEventManager()

def getEventManager():
return eventManager

def onEvent(argsList):
'Called when a game event happens - return 1 if the event was consumed'
return getEventManager().handleEvent(argsList)

def applyEvent(argsList):
context, playerID, netUserData, popupReturn = argsList
return getEventManager().applyEvent(argsList)

def beginEvent(context, argsList=-1):
return getEventManager().beginEvent(context, argsList)

and

# Sid Meier's Civilization 4
# Copyright Firaxis Games 2005
#
# CvEventInterface.py
#
# These functions are App Entry Points from C++
# WARNING: These function names should not be changed
# WARNING: These functions can not be placed into a class
#
# No other modules should import this
#
import CvUtil
import CvGreatPersonEventManager
from CvPythonExtensions import *

greatPersonEventManager = CvGreatPersonEventManager.CvGreatPersonEventManage r()

def getEventManager():
return greatPersonEventManager

def onEvent(argsList):
'Called when a game event happens - return 1 if the event was consumed'
return getEventManager().handleEvent(argsList)

def applyEvent(argsList):
return getEventManager().applyEvent(argsList)

def beginEvent(context, argsList=-1):
return getEventManager().beginEvent(context, argsList)


So, can these two be combined by simply taking the items in bold from the Great Person Mod and inserting them into the Realism CvEventInterface? And as the def getEventManager(): ?function? returns different items in each of the two examples, how should I go about resolving this? (Sorry, not a programmer, just decent with computers...)

Thanks for any help!

BaneBlade
Nov 26, 2005, 03:30 AM
There's another great Mod, improved domestic advisors on a german forum, seems down atm, when it works again i'll post the url here so you may have a look at it.
And btw, is somebody already working on something like the Great People Mod but for Units/Techs/Wonders? I mean ingame historical descriptions?

snarko
Nov 26, 2005, 04:23 AM
So, can these two be combined by simply taking the items in bold from the Great Person Mod and inserting them into the Realism CvEventInterface? And as the def getEventManager(): ?function? returns different items in each of the two examples, how should I go about resolving this? (Sorry, not a programmer, just decent with computers...)

Thanks for any help!

You don't need to merge those two files. They point to a file containing a part of CvEventManager.py. In the first case CvRealismEventManager.py and the second CvGreatPersonEventManager.py. Choose one of the two EventInterface and merge the two EventManager files into the *EventManager.py file that the EventInterface.py file points to.