[MOD] GreatPersonMod with RenamerMod

Patricius,

Checking back re: possible bug with no religious movies. I started two games with only your mod loaded. Game one, I got Buddhism and no movie. Game two, Hinduism and no movie.

Can anyone else verify this bug? I like this mod and will still use version 1.6 even with the pink screens when the names run out (but it would be nice to say goodbye to them) :D
 
Amra,

Thats really interesting. I am going to check and see if I get the same result, but your test looks pretty convincing. I will look at the code, but I can't think of any reason that would interfere with religion movies.

The only code that was changed is in the bolded text. All other changes were simply fixing the file names of the different greatpeople. I can't see how that simple line would change anything.
Code:
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005

from CvPythonExtensions import *
import CvUtil
import PyHelpers
import CvEventManager
import sys
import CvGreatPersonScreen
	
gc = CyGlobalContext()

PyPlayer = PyHelpers.PyPlayer

# globals
###################################################
class CvCustomEventManager(CvEventManager.CvEventManager):

	def __init__(self):
		# initialize base class
		self.parent = CvEventManager.CvEventManager
		self.parent.__init__(self)

	# GreatPerson Mod -------- begin
	def onGreatPersonBorn(self, argsList):
		'Great Person Born'
		pUnit, iPlayer, pCity = argsList
		player = PyPlayer(iPlayer)

		# Tell parent:
		self.parent.onGreatPersonBorn(self, argsList)
		
		# Check if we should even show the popup:
		if pUnit.isNone() or pCity.isNone():
			return
[B]		if not pUnit.getNameNoDesc()
			return[/B]
		#Show fancy lil popup if *we* got the great person:
		iActivePlayer = CyGame().getActivePlayer()
		if iActivePlayer == iPlayer:
			CvGreatPersonScreen.CvGreatPersonScreen().interfaceScreen(pUnit, pCity)
	# GreatPerson Mod -------- end

Argh, and I thought I had finally fixed it for good.:blush:

Is anyone else having this problem? I will take a good look into this and will have an answer for you tommarrow.
Patricius
 
The Chuang Tzu pic is not popping up,, I think its because you have it spelled Chang Tzu in the directory...:rolleyes:
 
Patricius,

I think I found somewhat of a fix for the pink screen when all names have been used. Unfortunately it involves a little editing of the Civ4UnitInfos.xml file on a per user basis.

I noticed that you included generic .dds files for Great Artist, Great Prophet, etc. but the python coding was still not displaying them when all names were used. So, as a test, I added the (bolded) line in the following code immediately after the last <UniqueName> under UNIT_ARTIST in the Civ4UnitInfos.xml file.
Code:
        <UnitInfo>
            <Class>UNITCLASS_ARTIST</Class>
            <Type>UNIT_ARTIST</Type>
            <UniqueNames>
                <UniqueName>TXT_KEY_GREAT_PERSON_HOMER</UniqueName>
                [B]<UniqueName>Great Artist</UniqueName>[/B]
            </UniqueNames>
Obviously, I deleted all but one of the original names for the test so that I could reach the end of the list sooner. Anyway, when I did, your generic Great Artist.dds displayed as intended. See below.

Amra_GPMod_pic1.jpg


Therefore, if anyone really wants to rid themselves of the dreaded pink screen, they can add enough <UniqueName> entries at the end of the lists for each type of Great Person in the Civ4UnitInfos.xml file. Just make sure the new name matches the name of the .dds file in the GreatPeople folder.

I plan on trying this with my mod.
 
I have re-released the mod, with all the fixed name, but I did not include the pink-screen fix. It is v2.01 Thanks amra for your idea on fixing the pink-screen. Do you know if it will repeat that unique name again, if you get another generic Great Artist. I believe that the computer will only use a unique name once.

Anyway, sorry for all this trouble..After I thought I had fixed it. ;)

Sincerely,
Patricius
 
Patricius said:
...Thanks amra for your idea on fixing the pink-screen. Do you know if it will repeat that unique name again, if you get another generic Great Artist. I believe that the computer will only use a unique name once.

You know, I was so happy to get the 1st popup that I didn't try for a second.
Must... Do... More... Testing :whipped:

I'll let you know. Worse case, I can always create more unique text tags & then make the names the same within them. :D
 
Amra said:
You know, I was so happy to get the 1st popup that I didn't try for a second.
Must... Do... More... Testing :whipped:

I'll let you know. Worse case, I can always create more unique text tags & then make the names the same within them. :D
Let us know how the testing goes but the impression I got is that you just make 20-30 more unique names that actually have the same name ("Great Artist") and that's it.

Although, now that I think about it, maybe you can do a workaround in Python (if it won't automatically reuse the last unique name). You could do a simple check for the name and if it's the generic one then you just set some flag and every following name will use the same pic. You might have to though figure out a way to remember the flag's state for saved games.
 
Tested it more and it worked just by adding the extra unique names (all the same) at the end of each list. In my test, I deleted all but one of the original names then added about a bunch of the same lines for each.

I was able to reach the new entries very quickly and both the Great Prophet & Great Scientist screens came up 3 more times each. Bear in mind, when the new Great person is active, his name will be silly; ie: "Great Prophet (Great Prophet)" and "Great Scientist (Great Scientist)" but that is much better than the PSOD (Pink screen of death).

I would think that if I was to add about 30 or 40 more lines to each GP unit in Civ4UnitInfos that it would be enough. Just copy & paste! :goodjob:
 
HI Guys,
I was just talking with TheLopez and we are thinking about using his random names generator to create an infinite list of names once all the unique names have been used up...Each would use the generic pic, but would add a little zest to this mod and keep the PSOD from destroying the universe. ;)
What do you guys think of a feature like that being added to the next version?

Sincerely,
Patricius
 
So, you keep the original unique names AND add random names afterwards. Well, that seems to be a good idea! :)
CellKu
 
I'm using the Mod and I have not gotten any "going to the next Age" pop-ups..can't figure out why ?
 
It could be because both of the popups are set to be immediately shown, without minimization for later, immediately once the turn begins. They might conflict if they both happened on the same turn. Did you get a greatperson on the same turn or is it all era changes?

Patricius
 
Sorry if this has been asked before..........

Is it easy to incoporate this mod with other mods?

For instance, I like SevoMod and would like to add this mod in as well.

Thanks in advance...


T
 
Hi Talisein,

It depends what mod you want to merge it with. With SevoMod, you will have to see whether or not he changes CvCustomEventManageror CvEventInterface, which are the two files I include that are not unique to The GreatPersonMod. If he has not modified either of these, you can place all of the GPMod in Sevo's mod, keeping in mind they must stay in the same directories. For Example: (C:\Documents and Settings\Owner\My Documents\My Games\Sid Meier's Civilization 4\MODS\GreatPersonMod\Assets\Python) on my computer for CvCustomEventManager.
However, if he has modified either of those files, then you will have to manually edit the file with the Python program. You can downloa the program for free at http://www.python.org/. You must then open both files and copy and paste the unique code from my files over to Sevo's. If you need help with this PM me with the names of the files that need merged and I can upload the merged files to you.

Hope this helps,
Patricius
 
Patricius said:
I am posting these files for the generic Great People if anyone wants to do what Amra did. For the latest version, for some reason I took them out.

I split them up so I could fit them under the 500 Kb limit

I love the mod, and I played with some stuff a bit, and I think that I have things working for the generic great people once the XML files run out of names, completely in Python, without having to modify the XML files.

Try adding the following to your code, and check it out. It should automatically detect when there is no unit name, then change the unit type "UNIT_PROPHET" to the string "Great Prophet", which just happens to be the name of the image file you have.

This should be robust to new unit types (e.g. UNIT_GENERAL) so long as it is added "properly" with its unit type set to UNIT_GENERAL. It would be great if someone who knows python better than me could also add a check to see if the file for the name to be used exists or not, and then you would never get the Pink Screen, unless there is a new Great person type and no "Great General" .dds file.

Code:
	def interfaceScreen (self, pUnit, pCity):
		szPersonName = pUnit.getNameNoDesc()

		# szUnitType will be UNIT_PROPHET, UNIT_MERCHANT,   UNIT_ARTIST, etc.
		szUnitType = gc.getUnitInfo(pUnit.getUnitType()).getType()

	    # if the name is the empty string, then create a new, generic name from the unit type.
		if szPersonName == "" :
			szPersonName = "Great " + szUnitType[5:].capitalize()

		szPicturePath = str(self.PICTURE_BASE %(szPersonName))
 
I just wanted to mention that the Python fix that I added above would be easy to incorporate with the random names mod; if szPersonName == "", then generate a new unique name, but use the szPersonName as the file name of the image to load.

That is, you'd have szPersonName and szImageFileName, and normally, you'd just set szImageFileName = szPersonName, but if we run out of hard-coded names, you'd use:

Code:
if szPersonName == "":
     szImageFileName = "Great " + szUnitType[5:].capitalize()
     szPersonName = GENERATE_RANDOM_NAME_CALL()

and then you'd be good to go. I haven't looked at the random names mods, but assuming that you can just call them from this point in the code, that should work out.

I'd still love to know how to check whether the imagefile exists or not before trying to display it; that would enable you to display the actual picture for the name if there is one present, and otherwise display the generic picture for the unit type.
 
Hey Scottcstoness,
First of all welcome to civfanatics!
I will try out your ideas tonight and see if they work. They look good, though...This is one thing that has been nagging me with this mod for quite a while so thankyou very much for your input. I will reply later with the results.

Again, welcome to the community.

Patricius
 
Back
Top Bottom