Tsentom1 Python Wonders

Your consistent and neat method of demarking your parts in the python with comments and putting your XML part at the end of the file make your stuff easy to use. I just put the Andromeda unit and the Eden project together in a mod I am making and it works great. I also like the way you include just what's needed for the modification at hand, staying on point.

Thanks, I'm glad you've been able to combine them easily. I try to make them as easy as possible but python tends to confuse some people.

Sadly, I think some of my older stuff aren't as well labeled and I need to go back and re-do them. I just never seem to find the time, but if you are anyone finds difficulty and needs help feel free to PM me.
 
Yeah, Happy New Year Arian and everyone else!


~~


Actually, I think next I'm going to either make some python based promotions, or finally update my units.
 
Just got the following:

PHP:
File CvEventInterface, line 23 in onEvent
File CvEventManager, line 193 in handleEvent
File CvEventManager, line 370 in onBeginGameTurn
File CvEventManager, line 1767 in doChooseNewStarAlignment
File CvEventManager, line 1914 in doStarReligionBonus

NameError: global name 'iMissionary7' is not defined

Any obvious things to look for?

Bumping this. Any ideas? FWIW, it happened once mid-game, then never again.
 
Just finished the game with these, am incorporating the new wonders and trying to fix some things before the next one. The biggest issue is the movies playing twice. I assume it is because the cvEventManager.py contains both of the following code snippets:

Spoiler :
if ((not gc.getGame().isNetworkMultiPlayer()) and (pCity.getOwner() == gc.getGame().getActivePlayer()) and isWorldWonderClass(gc.getBuildingInfo(iBuildingType).getBuildingClassType())):
# If this is a wonder...
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
popupInfo.setData1(iBuildingType)
popupInfo.setData2(pCity.getID())
popupInfo.setData3(0)
popupInfo.setText(u"showWonderMovie")
popupInfo.addPopup(pCity.getOwner())

if ((pCity.getOwner() == gc.getGame().getActivePlayer())):
# If this is a wonder...
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
popupInfo.setData1(iBuildingType)
popupInfo.setData2(pCity.getID())
popupInfo.setData3(0)
popupInfo.setText(u"showWonderMovie")
popupInfo.addPopup(pCity.getOwner())

My assumption is the second bit of code is missing the test for being only a National Wonder, but I'm not sure. The first, I think, is original and the second is from one of the Tsentom1 wonders.
 
Bumping this. Any ideas? FWIW, it happened once mid-game, then never again.

I must have missed when you first posted that, sorry. Busy lately.

My only guess is that I had a typo when defining iMissionary7. I would simply search the python file for "iMissionary7" slightly above wherever I use that there should be a list where I define all the missionaries. Check if I have a missionary 7 even listed there.

As for the wonder movie code, you can actually just delete your entire first section.

The first section is the default code which basically says only play a movie if it is a world wonder and not multiplayer.

The second is my edited code which says play a movie as long as a national wonder or world wonder is built.
 
In cvEventManager, the code reads

PHP:
iMissionary1 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_JEWISH_MISSIONARY')
iMissionary2 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_CHRISTIAN_MISSIONARY')
iMissionary3 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_HINDU_MISSIONARY')
iMissionary4 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_BUDDHIST_MISSIONARY')
iMissionary5 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_CONFUCIAN_MISSIONARY')
iMissionary6 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_TAOIST_MISSIONARY')
iMissionary8 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_ISLAMIC_MISSIONARY')

References elsewhere are to iMissionary7. Changed the 8 to a 7, assume that will fix it. Thanks!

Commented out the other movie code. Again, thanks. I'll update the combined files shortly.
 
In cvEventManager, the code reads

PHP:
iMissionary1 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_JEWISH_MISSIONARY')
iMissionary2 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_CHRISTIAN_MISSIONARY')
iMissionary3 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_HINDU_MISSIONARY')
iMissionary4 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_BUDDHIST_MISSIONARY')
iMissionary5 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_CONFUCIAN_MISSIONARY')
iMissionary6 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_TAOIST_MISSIONARY')
iMissionary8 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_ISLAMIC_MISSIONARY')

References elsewhere are to iMissionary7. Changed the 8 to a 7, assume that will fix it. Thanks!

Commented out the other movie code. Again, thanks. I'll update the combined files shortly.

yeah, that should do it
 
I have combined all of the wonders, except the Peace Ray, the Eden Project, Cheomseomgdae (b/c Copernicus is there), and the three new religious ones (Crusade, Malleus, Inquisition) into a single mod.

You can download it here.

The new wonders are not play-tested, but the mod loads without error, so it's at least parsing correctly.
 
Good Job

As I said earlier, I have a few other things planned before I go back to making some wonders, perhaps even going back to redo my units.
 
Good Job

As I said earlier, I have a few other things planned before I go back to making some wonders, perhaps even going back to redo my units.

Any hints, what you're planning :)?

Re-doing the andromeda-code would be nice, i can't see, what you've added :(.
 
First question (others will come later this day):
Do you have an older version of the school of confucius on your hdd?
I would need the old effect, because i want to attach the effect to a wonder in the late game (-> so it has to be more expensive, and have a bigger effect).

Would be real nice, if you can help me :).
 
Good morning Tsentom,

I have a few ideas for future wonders/projects.

*Dissolution Of The Monasteries--Henry VIII made a ton of money because of this...Perhaps the benefit to the player would be a certain amount for each Monastery a player has...or to trade in the Monasteries for cash.

*Finding of the Rosetta Stone/Translation of the Rosetta Stone--Perhaps give the player a certain amount of Knowledge/Cash/Culture for any of the early wonders he may have.

*Magna Carta--Ripple has a version of this in his mod...
 
First question (others will come later this day):
Do you have an older version of the school of confucius on your hdd?
I would need the old effect, because i want to attach the effect to a wonder in the late game (-> so it has to be more expensive, and have a bigger effect).

Would be real nice, if you can help me :).

Do you mean it having give 2 Great People instead of 1?

It's actually just a simple edit of the code. Basically you copy and past the whole last section so it's repeated twice (from the get random number to the end of the great people) but add a 2 to the irandompeoplenumber (or change the getrandomnumber people name some other way).

That probably doesn't sound simple. I'll post the code when I get to my home computer later today, as I don't have it off hand.

~~~

@Edward The Big

interesting ideas...
 
Thanks, that's what i wanted to know :).
And i understand it, is not necessary to post the code :).


Next Question:
Eden Project seems to me to powerfull, and would cause some problems with my mod, because i want to change the terrain to water (this is not the problem).
So i want to change the effect, so that only the terrain around the city, where it is built, is affected (not necessarily the FC, maybe 2 or 3 fields in every direction).
Will changing the 50 to 2 or 3 in
PHP:
for iXLoop in range(iX - 50, iX + 50, 1):
    for iYLoop in range(iY - 50, iY + 50, 1):
do this?
(yes, i could try it, but i'm sure, i would try some stupid things and the pc would crash).

And what could i do with:
PHP:
if ( pPlot.getFeatureType()!=gc.getInfoTypeForString( 'FEATURE_JUNGLE' )):	
									pPlot.setFeatureType(gc.getInfoTypeForString( "FEATURE_FOREST" ), 1)
?
Okay, i would have to copy it, and do the same with forest, but is there anything like "FEATURE_NOTHING"?

And could it be done, that also the improvements/resources change?
I see the line
PHP:
ImprovementType()!=gc.getInfoTypeForString( 'IMPROVEMENT_COTTAGE' )) etc
That there is no argument at the beginning, does it say, that it shall stay, what it is? Then it would be easy, but i'm not sure.



I really hope, that you can help me again :).
 
Code:
			for iXLoop in range(iX - 2, iX + 3, 1):
				for iYLoop in range(iY - 2, iY + 3, 1):
					pPlot = CyMap().plot(iXLoop, iYLoop)
					if ( pPlot.getTeam()==pTID ):


~~

if ( pPlot.getFeatureType() == -1 )

would be nothing, if you're looking to check if the tile has no feature.

pPlot.setFeatureType(-1, 0)

if you're looking to remove all features from a tile.


~~

The long list of getting all the improvements is just so it doesn't spawn a forest on say a cottage tile which you can't normally do. I couldn't just put a don't spawn forest if improvement because some improvements like the fort and camp allow forest and jungles.
 
Thank you very much :).

Next question (don't hit me, is the last [i hope]):
I've said (somewhere here), that a terraforming-weapon would be nice for my mod.
So i tried
PHP:
if iEffectType == gc.getInfoTypeForString('EFFECT_ICBM_NUCLEAR_EXPLOSION'):
to attach the effect to an ICBM, but that doesn'nt work.
iEffect is right, the effect too, but it dosn't work (also on my own terrain).
Any ideas?
 
Thank you very much :).

Next question (don't hit me, is the last [i hope]):
I've said (somewhere here), that a terraforming-weapon would be nice for my mod.
So i tried
PHP:
if iEffectType == gc.getInfoTypeForString('EFFECT_ICBM_NUCLEAR_EXPLOSION'):
to attach the effect to an ICBM, but that doesn'nt work.
iEffect is right, the effect too, but it dosn't work (also on my own terrain).
Any ideas?

Ask as many questions as you need, I'm glad to help.

I'm unsure what you're trying to do here. Do you mean have the nucleur explosion graphic effect play when you use your weapon?

EFFECT_ICBM just means that big mushroom cloud when the bomb explodes. It's only graphical.

If you're trying to make your thing fire the same time as a Nuclear explosion it's probably best to use:

Code:
def onNukeExplosion(self, argsList):
		'Nuke Explosion'
		pPlot, pNukeUnit = argsList
		CvUtil.pyPrint('Nuke detonated at %d, %d'
			%(pPlot.getX(), pPlot.getY()))

Function in the EventManager file. Then if it's only to fire in your territory run a check of the plot owner, since pPlot is conveniently already in the argslist
 
Ask as many questions as you need, I'm glad to help.

A kiss-smiley would be usefull here :D.

I'm unsure what you're trying to do here. Do you mean have the nucleur explosion graphic effect play when you use your weapon?

EFFECT_ICBM just means that big mushroom cloud when the bomb explodes. It's only graphical.

If you're trying to make your thing fire the same time as a Nuclear explosion it's probably best to use:

The last thing is what i wanted to do.

What i wanted to try, is to use the ICBM_EFFECT as trigger, because this seemed to be the easiest way (not, because i want to use the effect, but it seemed, that i would only have to change 2 things to get it work)

If you're trying to make your thing fire the same time as a Nuclear explosion it's probably best to use:
Code:
def onNukeExplosion(self, argsList):
		'Nuke Explosion'
		pPlot, pNukeUnit = argsList
		CvUtil.pyPrint('Nuke detonated at %d, %d'
			%(pPlot.getX(), pPlot.getY()))

Function in the EventManager file. Then if it's only to fire in your territory run a check of the plot owner, since pPlot is conveniently already in the argslist

:worship: I'll try it out tomorrow (here it's 10:40 PM, no time today :D)
 
All python-components are working :goodjob:.

The alternative school of confucius was no problem.

The eden-project, which converts terrain into water, caused some trouble, because if you convert the city-plot into water, the city is destroyed.
But adding
Code:
and is not pPlot.isCity()
to an if-clause worked :).

Negative: All units on the converted plots are destroyed too, but this is realistic.
There are also some ugly graphical effects, when converting hills/peaks into water, but this is not a real problem :).


Creating the terraforming-ICBM was after this no real problem (...okay, it was, but now i have a real better unterstanding of the civ-python :)).
At the moment, the t-ICBM destroys the whole enemy city, the city-plot and the plots around it are converted to water.
I think i have to limit them, because now you can really destroy whole civilizations with an "terraforming first strike".

Will you release it (it's your code) as a unit?
I think, Maniac would be very happy about a true "planet-breaker-missile".
 
Back
Top Bottom