Ambreville
Deity
Have you ever considered learning Python?
Shqype, are you trying to tell me something here?
(But to answer your question, yes... and got totally confused. I'm not much of a coder I guess).
Have you ever considered learning Python?
It is often times better to get things done your way when you do them yourself, instead of relying on other people.
Granted, not all of us are coders, but if you've tried then that counts for something. As long as you're not one of those lazy people that don't try to do anything for themselves and expect others to do everything for them.
But I would recommend giving it another shot, assuming you've got the patience. There are some good tutorials on the forums that can help get you started.
I'll let you know if I get tired of getting tons of credit for your ideas HeHe. lol
I think I've got the "Thumbtack" ability workin g I'll get it up tomorrow.
I'll start working on the promo idea as an expansion for zPromotions.
...
def onGreatPersonBorn(self, argsList):
'Great Person Born'
pUnit, iPlayer, pCity = argsList
player = PyPlayer(iPlayer)
infoUnit = pUnit.getUnitClassType()
# Check if we should even show the popup:
if pUnit.isNone() or pCity.isNone():
return
if(len(pUnit.getNameNoDesc()) == 0):
iCivilizationType = player.player.getCivilizationType()
pUnit.setName(NameUtils.getCivilizationName(iCivilizationType, infoUnit))
...
if (infoUnit == gc.getInfoTypeForString("UNITCLASS_PROPHET")):
if(len(civilizationNameHash[strCivilizationType]["GP"]) > 0):
strGP = civilizationNameHash[strCivilizationType]["GP"][gc.getGame().getMapRand().get(len(civilizationNameHash[strCivilizationType]["GP"]), "Random Name")]
strName = string.capwords(strGP)
return strName
At first I thought it was in the comparison check, but that seems to work.
unitType = pUnit.getUnitType()
...
if (unitType == gc.getInfoTypeForString("UNIT_PROPHET")):
...
if (...):
self.debug("Profit!!!")
nameList = civilizationNameHash[strCivilizationType]["GP"]
if (nameList):
self.debug("Found %d names" %len(nameList))
rand = gc.getGame().getMapRand().get(len(nameList), "Random Name")
self.debug("Got random # %d" %rand)
strGP = nameList[rand]
self.debug("Chose name %s" %strGP)
strName = string.capwords(strGP)
return strName
player.player.getCivilizationType()
player = PyPlayer(iPlayer)
player = gc.getPlayer(iPlayer)
Actually, I'm not looking to change the UnitType, just the individual name, e.g. so a Great Scientist born to England will be named Isaac Newton, Stephen Hawking and so on, instead of Plato or other non-English.
I'll try to fiddle around with it some more today and once it's working I'll post it here. This has lots of possibilities outside of great people. Suppose you wanted to give any unit a unique name. Normally, you'd just add the names in the <UniqueName> tag in XML. But this isn't civ-specific--suppose you want to have ship names like the Yamato or Nagato for the Japanese, and the Arizona and Missouri for America. You can't do that in XML, because any name will go for any civ.
BTW, Ambreville, there is a way to get around this problem in XML only... just create a bunch of new units like "French Battleship" and give them the civ-specific names. Of course, this'll add about 100 new units to the game... You can see why I'm eager to switch to Python.
I've had a lot of problems renaming units in worldbuilder, too. In my WWII mod, I originally had all the units named, but once I saved it they all disappeared.
Unfortunately, in Warlords, there is no way to make sure that units will have the "correct" name, as they are assigned randomly from the <uniquenames> list when they are built. Mexico also developed a mod that goes back to Vanilla's sequential ordering (meaning the first one in the list is the first to be used, and so on) but I don't know if that will solve your problem.
The unit renamer now works, but it does not rename the event message in the upper left corner, "Great Scientist has been born in Washington!"
What we really need is an index of Python functions in Civ 4.