Problem with onUnitCreated

somebody_else2

Chieftain
Joined
Dec 22, 2007
Messages
10
Hello,

I've been modding FinalFrontier for some while now and want to add some new event handlers. I have added the following code to the CvFinalFrontierEvents class in CvFinalFrontierEvents.py
Code:
	#MOD START
	def onUnitLost(self, pUnit):
		print "onUnitLost"
		self.parent.onUnitLost(pUnit)
		AI.doUnitDie(pUnit)
		
	def onUnitCreated(self, pUnit):
		print "onUnitCreated"
		self.parent.onUnitCreated(pUnit)
		AI.doUnitBirth(pUnit)
	#MOD END
The problem is that that code is not even called. onUnitLost/onUnitCreated do not appear in PythonDbg.log nor does creating a unit in the world builder seem to have any effect.

Do I have to enable each event somewhere before it is dispatched to Python or what am I doing wrong?
 
I have now tried editing the CvEventManager.py file in the BTS assert folder. The events are not dispatched as it seems.

onUnitBuilt/onUnitKilled however work like a charm. I have BTS 3.13 could somebody with the same version please check if he can get either onUnitCreated or onUnitLost to work. I'm starting to believe that this is a BTS bug and not one in my code.

I couldn't find the code which dispatches the events in the SDK code. Have I just overlooked it or is it in the closed source code?
 
you should check PythonCallbackDefines.xml .

tcho !
 
Back
Top Bottom