Simple Python Things

You can easily modify the invisible dummy techs modcomp for that.
If you look at the modcomp, you can find this line here:
PHP:
if gc.getTechInfo(techsList[iI][1]).getGridX()<=0 or gc.getTechInfo(techsList[iI][1]).getGridY()<=0:

change it to:
PHP:
if gc.getTechInfo(techsList[iI][1]).isDisable:

Do it for the other file in an analog way.


btw, i've rated your files now a bit with A+, to get rid of one stars, but it's not enough yet.
 
You can easily modify the invisible dummy techs modcomp for that.
If you look at the modcomp, you can find this line here:
PHP:
if gc.getTechInfo(techsList[iI][1]).getGridX()<=0 or gc.getTechInfo(techsList[iI][1]).getGridY()<=0:

change it to:
PHP:
if gc.getTechInfo(techsList[iI][1]).isDisable:

Do it for the other file in an analog way.

:thanx:

btw, i've rated your files now a bit with A+, to get rid of one stars, but it's not enough yet.


Let me say it like this: THANK YOU
 
OK back to the Espionage Modcomp

Traceback (most recent call last):
File "BugEventManager", line 361, in _handleDefaultEvent
File "Espionage", line 109, in onCombatResult

Spoiler :
Code:
elif iResearch >= 25:
				myteam.changeResearchProgress(pPlayer.getCurrentResearch (),int(iResearchStolen),pWinner.getOwner())
				otherteam.changeResearchProgress(otherplayer.getCurrentResearch (),-int(iResearchStolen),pLoser.getOwner())
				message = 2
			else:
				[B]myteam.changeResearchProgress(pPlayer.getCurrentResearch (),1,pWinner.getOwner())[/B]
				otherteam.changeResearchProgress(otherplayer.getCurrentResearch (),-1,pLoser.getOwner())
				message = 3

RuntimeError: unidentifiable C++ exception
 
Can't really say anything :dunno:.
The line says just, that in your team the beakers of the current research project should be increased by 1 for the owner of the winner.
As long as:
- The team
- the player
- and the research project
are valid, there can't happen anything.
For the team and the player, the only problem could be barbarians and minor states, and i think, i caught the first one.
Also not assigned research projects i caught.

There was no minor state involved in that fight, right?
 
Had this weird error happen, that never happened before, it might have been a fluke?

In the Militia Mod:

Traceback (most recent call last):
File "BugEventManager", line 361, in _handleDefaultEvent
File "Militia", line 39, in onImprovementBuilt
AttributeError: 'NoneType' object has no attribute 'isCivic'

Spoiler :
Code:
if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_FARM'):
                        charity = gc.getInfoTypeForString( "CIVIC_CHARITY" )
                        iPlayer = pPlot.getOwner()
                        pPlayer = gc.getPlayer(iPlayer)
                        [B]if (pPlayer.isCivic(charity)==True):[/B]
                                era = pPlayer.getCurrentEra ()
                                if (era == gc.getInfoTypeForString( "ERA_MEDIEVAL" )):

I also get a saying when in the Classical era that a Militia has appeared (even none are there) but as soon as the Medieval era arrives everything is ok, HUH:confused:
 
I guess i see the problems:
- Can farms in your mod be build outside of national borders?

If yes:
Change:
PHP:
if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_FARM'):

to:

PHP:
if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_FARM') and pPlot.getOwner()>-1:


The message problem:
I think i've been a bit lazy there, and did not consider that people might change the modcomp. The message is everytime send when you have the specified civic, because in the modcomp it has not been possible to have vassalage and not being in the medieval era.
In your case, you have the civic and it's in an era, where no militia unit is assigned to.
:think: mmhh...the easiest way, without changing to much and so that you don't have to mess around with the indentation, is to change this:

PHP:
                        if (pPlayer.isCivic(charity)==True):

to:
PHP:
                        if (pPlayer.isCivic(charity)==True) and pPlayer.getCurrentEra ()>=gc.getInfoTypeForString( "ERA_MEDIEVAL" ):




If i don't forget it, i'll add the fixes this weekend.
 
I guess i see the problems:
- Can farms in your mod be build outside of national borders?

If yes:
Change:
PHP:
if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_FARM'):

to:

PHP:
if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_FARM') and pPlot.getOwner()>-1:


The message problem:
I think i've been a bit lazy there, and did not consider that people might change the modcomp. The message is everytime send when you have the specified civic, because in the modcomp it has not been possible to have vassalage and not being in the medieval era.
In your case, you have the civic and it's in an era, where no militia unit is assigned to.
:think: mmhh...the easiest way, without changing to much and so that you don't have to mess around with the indentation, is to change this:

PHP:
                        if (pPlayer.isCivic(charity)==True):

to:
PHP:
                        if (pPlayer.isCivic(charity)==True) and pPlayer.getCurrentEra ()>=gc.getInfoTypeForString( "ERA_MEDIEVAL" ):




If i don't forget it, i'll add the fixes this weekend.


Yeppers, that worked perfect, thx.;);)
 
Reuploaded with these changes :).

I've also uploaded a small example, how a popup is done after the game start (here), because it has several times been asked for.

And i've added 4 new effects to the tech tree:
techtree_newicons_C2U.jpg


Download here.


I've recently also coded something for hrochland, but i will not upload it, because the AI would not be very good at it.
I've also looked into my maps mod this weekend, but i haven't found out, how to make it compatible to the advanced start :(. Will need more time.
But i'm out of modding for 2,5 - 3 weeks, because semester holidays have begun and i'll visit my parents for time, so don't expect a fix for that in the next time. :(.
 
About the adding of the new effects to technologies (I need some posts here ;) :

What do you mean by:
- I do not recommend to use or to add any "first player gets" effects to the tech tree, because the AI does not understand the effect and will not try to get the tech first

So the AI is not trying to get banking for the money?

Because as far as I can understand normally there should be no difference between free great persons or a religion or money ;)
 
So the AI is not trying to get banking for the money?

Right, because:

Because as far as I can understand normally there should be no difference between free great persons or a religion or money ;)

yes, there is no difference in the importance, but in the technical setup.
The AI does only understand an effect, if it has been programmed into the CvGameCoreDll. But this here is only Python, and the .dll is not changed, so the AI has no idea, that this effect is even present in the game.

So i do not recommend using something, which will favour a special playing stile.
To get the free golden age from music, you have to race for music, because only the first player will get it. The AI does not know that, and will not race for music.

For the "everyone" effects, that's not a problem. The AI will somewhen research banking, no way, that it will not do so. So somewhen the AI will get the bonus, and is therefore not that handicaped like for the first time effects.


But technically it's the same for most of the python stuff here: The AI is handicaped. At some points more, at some points less. But e.g. for the wonders, you have some tools to influence the AI, but not for the techs :/.
 
Well, but it is defined for great persons, so if I would at an effect to a tech and add a great person to it the possibility that the AI researches it with a higher priority is higher :D

..or considering the free tech feature:

What if I change it to a free tech (maybe a dummy tech) that gives the AI the money or the free golden age? Higher priority?

..or simply put:

The two or three triggers for the AI (in order to research a tech) are: Great Person, free tech (and high military factor)?
 
Good ideas, but with some problems:

Well, but it is defined for great persons, so if I would at an effect to a tech and add a great person to it the possibility that the AI researches it with a higher priority is higher :D

mmhh...only for the first one here. If you have an "everyone effect", the priority will decrease after the first one has researched it.
Additionally, you would have to kill the GP afterwards, because else you'll give the researcher a double benefit.

..or considering the free tech feature:

What if I change it to a free tech (maybe a dummy tech) that gives the AI the money or the free golden age? Higher priority?

You can't influence, which tech the AI picks after researching a tech :/.

..or simply put:

The two or three triggers for the AI (in order to research a tech) are: Great Person, free tech (and high military factor)?

It would be easier, to set the FLAVOUR values in the XML higher ;), but also only for the "everyone effects", not for the first time effects.
Your solution would need some more programming, i guess.
But still some good thoughts :).
 
Hey, The J. Just to tell you. I merged in your Spawn a Civ into my mod. The merge was very easy, as always with your stuff, and it worked on the first try!
 
I've only tested the city spawning on small maps as yet. Cities seem to spawn all over the continent, as your ReadMe also states. So I'm looking forward to the update that will perhaps make them spawn closer. For now, I can really live with it, because I put the first civ to spawn as a barbarian civ of skeletons.

The second is called The Black Banner. They will spawn later according to my game lore as well. They are not barbarian, but i might turn them into that. i need to test it out more and see how it goes.

Thanks for your work on this! I really wanted something like this in my mod! :)
 
Sorry, saw your email to late (PM works in most times better here), and my internet hat incredible problems yesterday.

I have no real idea, where the problem could be.
Are you using BUG?
Could you show me the merged code?

Yes using BUG

Code:
	def onCityAcquiredAndKept(self, argsList):
		'City Acquired and Kept'
		iOwner,pCity = argsList
#### messages - wonder captured start ####		
		NumWonders = pCity.getNumWorldWonders		
		if NumWonders ()>0:
			Counter = 0
			for i in range(gc.getNumBuildingInfos ()):
					thisbuilding = gc.getBuildingInfo (i)
					if pCity.getNumBuilding(i)>0:
							iBuildingClass = thisbuilding.getBuildingClassType ()
							thisbuildingclass = gc.getBuildingClassInfo (iBuildingClass)
							if thisbuildingclass.getMaxGlobalInstances ()==1:
									ConquerPlayer = gc.getPlayer(pCity.getOwner())
									iConquerTeam = gc.getPlayer(pCity.getOwner()).getTeam()
									ConquerName = ConquerPlayer.getName ()
									WonderName = thisbuilding.getDescription ()
									iX = pCity.getX()
									iY = pCity.getY()
									for iPlayer in range (gc.getMAX_CIV_PLAYERS ()):
											ThisPlayer = gc.getPlayer(iPlayer)
											iThisTeam = ThisPlayer.getTeam()
											ThisTeam = gc.getTeam(iThisTeam)
											if ThisTeam.isHasMet(iConquerTeam):
													if iPlayer == pCity.getOwner():
															CyInterface().addMessage(iPlayer,False,15,CyTranslator().getText("TXT_KEY_YOU_CAPTURED_WONDER",(ConquerName,WonderName)),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), iX, iY, True,True)																	
													else:
															CyInterface().addMessage(iPlayer,False,15,CyTranslator().getText("TXT_KEY_CAPTURED_WONDER",(ConquerName,WonderName)),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_RED")), iX, iY, True,True)
#### messages - wonder captured end ####
 
Can't see anything wrong so.
At the moment i'm just wondering, for what i used the counter variable :think:.


Does the bug appear in all possible constellations?
- You captured a city with a wonder
- AI captured one of your cities with a wonder
- And AI captured AI city with a wonder
 
Back
Top Bottom