Great Person error

Normally if it cannot find the picture for the specific person it should show a generic picture for the type of GP born. It doesn't seem to even find those. Are there any Python errors in PythonErr.log when this happens?
 
Normally if it cannot find the picture for the specific person it should show a generic picture for the type of GP born. It doesn't seem to even find those. Are there any Python errors in PythonErr.log when this happens?

Nope not a single one, thats probably because it IS showing a pic, just not the right ONE?

Just the generic one.

Spoiler :
Code:
#
# GreatPersonMod BTS
# CvGreatPersonModEventManager
# 

from CvPythonExtensions import *

import CvUtil
import CvEventManager
import sys
import PyHelpers
import CvGreatPersonScreen
import RandomNameUtils
import CvConfigParser
# Change the value to enable or disable the features from the Great Person Mod.
# Default value is true
g_bGreatPersonModFeaturesEnabled = true

gc = CyGlobalContext()

PyPlayer = PyHelpers.PyPlayer

g_iCount = 0     # autoincrement global used as the primary key for dictionary
g_dict = dict()  # holds information transferred from here to CvGreatPersonScreen.py

class CvGreatPersonModEventManager:

	def __init__(self, eventManager):

		GreatPerson(eventManager)

class AbstractGreatPerson(object):

	def __init__(self, eventManager, *args, **kwargs):
		super(AbstractGreatPerson, self).__init__(*args, **kwargs)

class GreatPerson(AbstractGreatPerson):

	def __init__(self, eventManager, *args, **kwargs):
		super(GreatPerson, self).__init__(eventManager, *args, **kwargs)

		eventManager.addEventHandler("greatPersonBorn", self.onGreatPersonBorn)

		self.eventMgr = eventManager

		# Begin Test Code
		""" # Uncomment this block to enable test code
		eventManager.addEventHandler("kbdEvent", self.onKbdEvent)

	# Test (ok cheat...) code to make sure that we can go through the vanilla great person
	# names and test the random names.
	## Changed event from just clicking mouse to hitting ALT-SHIFT-G. Test code not multiplayer compatible.
	## def onMouseEvent(self, argsList):
	def onKbdEvent(self, argsList):
		eventType,key,mx,my,px,py = argsList

		if(not g_bGreatPersonModFeaturesEnabled):
			return

		if ( eventType == self.eventMgr.EventKeyDown ):
			theKey=int(key)
			
			# Check if ALT + Shift + G was hit
			if (theKey == int(InputTypes.KB_G) and self.eventMgr.bAlt and self.eventMgr.bShift):	
				gc.getActivePlayer().getCapitalCity().createGreatPeople(gc.getInfoTypeForString("UNIT_GENERAL"), False, False)
				return 1
			
			# Check if CTRL + Shift + G was hit
			if (theKey == int(InputTypes.KB_G) and self.eventMgr.bCtrl and self.eventMgr.bShift):	
				gc.getActivePlayer().getCapitalCity().createGreatPeople(gc.getInfoTypeForString("UNIT_GREAT_SPY"), False, False)
				return 1
		return 0
		"""
		# End Test Code


	def onGreatPersonBorn(self, argsList):
		'Great Person Born'

		if(not g_bGreatPersonModFeaturesEnabled):
			return
		
		pUnit, iPlayer, pCity = argsList
		player = gc.getPlayer(iPlayer)
        
		# Check if we should even show the popup:
		if pUnit.isNone() or pCity.isNone():
			return
		
		#CvUtil.pyPrint("Great Person Born: Name:<%s> Player:<%s> City:<%s>"%(pUnit.getNameNoDesc(), player.getName(), pCity.getName()))
		    
		#If Person doesn't have unique name, give him a random one
		if(len(pUnit.getNameNoDesc()) == 0):
			iCivilizationType = player.getCivilizationType()
			pUnit.setName(RandomNameUtils.getRandomCivilizationName(iCivilizationType))

		#Show fancy lil popup if a human got the great person:
		if player.isHuman():
		
			global g_dict
			global g_iCount
			
			g_dict[g_iCount] = (pUnit, iPlayer, pCity)
			
			#CvUtil.pyPrint("Great Person Born 2: Name:<%s> iPlayer:<%d> City:<%s>"%(g_dict[g_iCount][0].getNameNoDesc(), g_dict[g_iCount][1], g_dict[g_iCount][2].getName()))
			
			popupInfo = CyPopupInfo()
			popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
			popupInfo.setData1(g_iCount)
			g_iCount += 1
			popupInfo.setText(u"showGreatPersonScreen")
			popupInfo.addPopup(iPlayer)
 
Still waiting for help on the :

Traceback (most recent call last):

File "CvScreensInterface", line 200, in showGreatPersonScreen

File "CvGreatPersonScreen", line 58, in interfaceScreen

KeyError: 'pop(): dictionary is empty'
ERR: Python function showGreatPersonScreen failed, module CvScreensInterface
 
OK here's what i finally resorted to:

I erased MY files of the same as the Great Person mod, and replaced all of them with my old one, and it STILL does not give me the correct GP dds??

I copy and pasted the XML for GP, i copy and pasted the dds folder.

what is going on here???:mad:
 
Go to where you have the art stored

Code:
Assets/
  Art/
    GreatPeople/

What are the names of the first three files in that folder?
 
Go to where you have the art stored

Code:
Assets/
  Art/
    GreatPeople/

What are the names of the first three files in that folder?

_GP_Template, Abraham, Abu Bakr, Adam Smith.
 
Weird. Are you able to install and use the GP mod on its own without any other modified code present?
 
Weird. Are you able to install and use the GP mod on its own without any other modified code present?

Yes it works just like its supposed to when i put it there by itself, but as soon as i merge it, EXACTLY, it doesnt work correctly, i always get the default.dds
 
Use the top one (CvCustomEventManager) and convert ModEvents to use it. You can have only one dispatching event manager pointed at by CvEventInterface, but CvCEM calls the objects that it works with event managers as well.
 
In Python, the first "return" statement encountered will cause the function to exit and the value after "return" to be sent back to the caller. Since the function exits, your second "return" is not seen.

You must hook in ModEvents to the CvCustomEventManager module--not CvEventInterface. There should be instructions on how to do this in CvCEM. You can follow the pattern that the Great Person Mod uses.

Again I highly recommend that you take a few days to go through a Python tutorial. You can learn it, and you'll be so much more productive not needing to wait for others to fix the problems you encounter. It's time to learn to fish, my friend.
 
What do you mean it works but it crashes? Please be as specific as possible like you were before with stack traces. BTW, you only need to show the code for the last line of the stack trace; the other lines may help but usually aren't necessary.
 
OK here's what i have finally resorted to, i took ALL my python out completely, and replaced it with ONLY the GP stuff. I also copy pasted FROM the GP XML files to my mod. Even renamed my mod to GreatPersonMod BTS, and even replaced the Config Settings to GP, and it STILL does not work correctly?? Anybody have any ideas???
 
Look in GreatPersonScreen.py for the interfaceScreen() function. A few lines into it szArtPath is set. My copy has this:

Code:
szArtPath = CvPath.getPath(os.path.join("art","GreatPeople"), "Great Person.dds")

Is that what yours looks like? That won't work because this needs to be the path to the folder as below this line it adds the person's name to it. If you have the above, change it to this:

Code:
szArtPath = CvPath.getPath("art", "GreatPeople")
 
Back
Top Bottom