OrionVeteran
Deity
Well, I've been playing with my latest effort for the last few days and have run into a problem with making the CvEventManager functions to run calling another Python file from a CvCustomEventManager.py. I'm using the CvCustomEventManager.py file from the Better BTS AI Mod. But, no matter what I do, the following functions will not execute, as they did originally in the CvEventManager.py file:
def onModNetMessage(self, argsList):
def onGameStart(self, argsList):
Do you have any suggestions as to how I can get just a simple message to display from these two functions? If you can suggest a way to get me that far, I think I can take it the rest of the way. The functions are in a file called file called InquisitionEvents and appear here in exactly the same way the are in the CvEventManager.py file:
Respectfully,
Orion Veteran
def onModNetMessage(self, argsList):
def onGameStart(self, argsList):
Do you have any suggestions as to how I can get just a simple message to display from these two functions? If you can suggest a way to get me that far, I think I can take it the rest of the way. The functions are in a file called file called InquisitionEvents and appear here in exactly the same way the are in the CvEventManager.py file:
Spoiler :
Code:
# InquisitionEvents
from CvPythonExtensions import *
import CvScreenEnums
import CvTopCivs
import CvUtil
import PyHelpers
import Popup as PyPopup
# Inquisition Mod
import pickle
import Inquisition
# End Inquisition Mod
# globals
gc = CyGlobalContext()
PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo
game = CyGame()
localText = CyTranslator()
# Inquisition Mod By Orion Veteran
# Modular Python to eliminate Merging
class InquisitionEvents:
def onModNetMessage(self, argsList):
'Called whenever CyMessageControl().sendModNetMessage() is called - this is all for you modders!'
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Message 2!','AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/TerrainFeatures/Forest.dds',ColorTypes(8),0,0,False,False)
iData1, iData2, iData3, iData4, iData5 = argsList
print("Modder's net message!")
CvUtil.pyPrint( 'onModNetMessage' )
# Inquisition Mod
iMessageID = iData1
#Inquisitor's Effect on a City
if ( iMessageID == self.m_iNetMessage_Inquisitor ):
iPlotX = iData2
iPlotY = iData3
iOwner = iData4
iUnitID = iData5
pPlot = CyMap( ).plot( iPlotX, iPlotY )
pCity = pPlot.getPlotCity( )
pPlayer = gc.getPlayer( iOwner )
pUnit = pPlayer.getUnit( iUnitID )
Inquisition.doInquisitorPersecution( pCity, pUnit )
if iData1 == 200:
iHPlayer = gc.getGame().getActivePlayer()
iPlayer = iData2
#iStateReligion = gc.getPlayer(iPlayer).getStateReligion()
if iHPlayer != iData2:
if iHPlayer.isHuman():
# Get the state religion of the Human Player - Theocracy
iHStateReligion = gc.getPlayer(iHPlayer).getStateReligion()
if iHStateReligion == iData3:
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON)
popupInfo.setData1(iHPlayer)
popupInfo.setData2(iHStateReligion)
popupInfo.setText(CyTranslator().getText("Godless infadels have destroyed our Holy City. Will you stand with your brothers in faith and declare war against the infidel? WARNING! Failure to declare war will result in a state of war between you and any AI player that has theocracy Civic and shares your state religion",()))
popupInfo.setOnClickedPythonCallback("TheocracyHolyWaronClickedCallback")
popupInfo.addPythonButton(CyTranslator().getText("Yes, Declare War!", ()), "")
popupInfo.addPythonButton(CyTranslator().getText("No, I will not Declare War!", ()), "")
popupInfo.addPopup(iHPlayer)
if iData1 == 252:
# DawnOfMan Popup
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
popupInfo.setText(u"showDawnOfMan")
popupInfo.addPopup(iData2)
return
# End Inquisition Mod
def onGameStart(self, argsList):
'Called at the start of the game'
# ###############################################
# Orion's Game Options Status
# ###############################################
iPlayerNum = 0
iHumanCount = 0
if (gc.getGame().getGameTurnYear() == gc.getDefineINT("START_YEAR") and not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_ADVANCED_START)):
for iPlayer in range(gc.getMAX_PLAYERS()):
player = gc.getPlayer(iPlayer)
if player.isAlive():
iPlayerNum = iPlayerNum + 1
if player.isHuman():
iHumanCount = iHumanCount + 1
if iHumanCount == 1:
# Orion's Game Options Status Popup
Inquisition.DisplayOCCStatus(iPlayer)
# DawnOfMan Popup
CyMessageControl().sendModNetMessage(252, iPlayer, -1, -1, -1)
break
# End Orion's Game Options Status popup
else:
CyInterface().setSoundSelectionReady(true)
if gc.getGame().isPbem():
for iPlayer in range(gc.getMAX_PLAYERS()):
player = gc.getPlayer(iPlayer)
if (player.isAlive() and player.isHuman()):
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_DETAILS)
popupInfo.setOption1(true)
popupInfo.addPopup(iPlayer)
CvAdvisorUtils.resetNoLiberateCities()
Respectfully,
Orion Veteran