one help more, please

hrochland

Prince
Joined
Apr 9, 2006
Messages
2,511
Location
Czech Kingdom
Hi all.
Very please help me
I need a code that will change from improvement_city_ruins to improvement_ancient_ruins when the first player enter era_Classical a second time when the first player enter era_Medeival. first and second time this should happen once and over all the map.

If is this possible, help mw, please
thanks
Hrochland
 
in Python, I think that you would have to check every turn to see if a Player has reached the era. Not very nice. Or to do it via TechAcquired (that starts a new era but it could be complicated depending on your Mod)? Then, you would need to find a method to make it happen only once.

Once this is done, the replacement of the improvement seems doable.
 
Code:
	def onEndGameTurn(self, argsList):
		'Called at the end of the end of each turn'
		iGameTurn = argsList[0]
		for iPlayerX in xrange(gc.getMAX_CIV_PLAYERS()):
			pPlayerX = gc.getPlayer(iPlayerX)
			if pPlayerX.getCurrentEra() == gc.getInfoTypeForString("ERA_CLASSICAL"):
				for i in xrange(CyMap().numPlots()):
					pPlot = CyMap().plotByIndex(i)
					if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_FARM'):
						pPlot.setImprovementType(-1)
						pPlot.setImprovementType(gc.getInfoTypeForString("IMPROVEMENT_TOWN"))

That simple code is repeated every turn (as I said, not very nice). OK, but how to make it unique (otherwise, in this example, all farms are replaced by towns every turn)? I'm invoking a Unicorn...:religion:
 
I think I found a better way: to make it an event, always loaded in game, triggered immediately when the condition is met. A least like that, when the Classical era is reached, it won't check for it anymore, since it's a global one-time event. What do you think?

EDIT: attached, you will find all files needed. They come from BtS, look for your name in each file. Anyway, everything is at the bottom of the files. In EventTriggerInfo, there are two: one for Classical, the other for Medieval. They both activate the same event, if I understood you correctly. The text is... minimal!

Test it and tell me if it works for you. :cool:
 

Attachments

Sorry for the silence and thank you. I also thought about using events ... I'll try it and let you know
thank you very much :)
Hroch
 
I'm glad to read that. Have fun! :cool:
 
1) Start a modern era start game and test it.
2) Test New ruins created
 
1) done
2) could not be done

1) try less κρυπτικός
2) try more helpful

:)
 
Still happy to read that! :)

Since I don't understand what is the problem mentioned by Platyping, it will have to stay that way. I don't know about you but me, personally, I never use Advanced Start anyway.
 
Didn't bother to read the codes.
But if you are just triggering an event when any player reaches classical or medieval era, then the simplest question is what if they started in an era after those?

Then as I mentioned, have you done anything to take care of ruins that appear after the event triggered?

P.S.
Don't forget it is possible to skip classical era in bts and advance directly to medieval
 
OK, now I understand you.

1) I tried an advanced start game in Modern era as suggested. I didn't notice something special: the event was not triggered (normal). So I didn't understand you because I thought you did it and something wrong happened.

2) Could not test the new ruins. Again, I thought you ran the test and that something was happening to these "new ruins" which I don't have (improvement_ancient_ruins). All my tests were done with farms transformed into towns.

hrochland asked a very specific component, he didn't mention either what to do with the newly created city_ruins after the medieval era.

The code has not strictly changed since post #3, it was just rearranged for the event (and medieval era added). It checks seperately: 1) if a Player is in era_classical 2) if a Player is in era_medieval. So starting in Modern era does not alter the event: it is not triggered, newly created city_ruins will stay city_ruins.

As for your P.S., the event will be triggered as you start in medieval era and will do nothing as there isn't supposed to be city_ruins!... When new city_ruins will be created, they will not change since the event will be off (one-time event).

First, I used the improvement required in xml but then changed it to none because otherwise it would not trigger with city_ruins outside your borders.

If hrochland wants something to be done about the new city_ruins created after medieval era has been reached once, he should say so.

And thank you Platyping, for all your codes! I downloaded your Grand Gruesome Gigantic Gigapack only to have a copy of your Python files! All codes in this specific component come from you actually, I just re-arranged them together!
 
Gigapack is one of my earlier works though, and it is one of those that is too tedious to review, so it is conveniently ignored :D

Thus, 95% of the works there should work, although there may be some which can be done in a better way or unforseen circumstances not taken care of.
 
Sorry, I thought I wrote that the medieval era ruins remain ... there is no reason to change it more :) For me, it works perfectly :)
 
Back
Top Bottom