Simple Python Things

I definitely should.
I should have learned it until now, never post something, which you haven't tested yourself, will probably never work :/.


I'll have to do this tomorrow, or so, it's already after midnight here, and i have to wake up in around 6 hours...bah.

Every week, it can never be Friday after work soon enough.
 
Alright, looks like I have another question about the SpawnACiv.

Just to make sure that I don't get this wrong, it is possible with SpawnACiv to have a total of three variety of units for the spawned civ: the "capital city unit", which appears only in the capital; the "default city defender", which appears in all the spawned cities; and the "default second unit", which appears also in all spawned cities.

I just want to make sure that the capital city unit and the default city defender are two SEPARATE units, correct?

Thanks agian for all your help.
 
Yes, your description is right, they are different units :yup:.

Every week, it can never be Friday after work soon enough.

You are soooooooooooooooooooo right.
But this week, it gets even worse after friday, because i'll have completely no time on saturday, due to the GamesCom....7 hours minimum in the car (to Cologne and back).

But whatever, i've attached the original CvEventManager with the new debugging messages, so please try it again.
And oh man, unbelievable, how many mistakes i can make in only a few lines, i'm such a lousy coder (and i must be crazy to code for my master thesis...today has really lead to an extrem loss in self confidence :().
 

Attachments

Yes, your description is right, they are different units :yup:.

You are soooooooooooooooooooo right.
But this week, it gets even worse after friday, because i'll have completely no time on saturday, due to the GamesCom....7 hours minimum in the car (to Cologne and back).

But whatever, i've attached the original CvEventManager with the new debugging messages, so please try it again. And oh man, unbelievable, how many mistakes i can make in only a few lines, i'm such a lousy coder (and i must be crazy to code for my master thesis...today has really lead to an extrem loss in self confidence :().

I think you are probably a fine coder, I think Python is very very picky and likes to quit on "errors" that wouldn't even be errors in other languages.

It worked this time, I included teh python logs and a screenshot of what I was seeing in game in the turn log.
 

Attachments

i completly don't see it :crazyeye: :confused: :wallbash:.
The logs say, that this first check here is passed 2 times:
PHP:
											if ThisTeam.isHasMet(iConquerTeam):
                                                                                                        CyInterface().addMessage(0,False,15,CyTranslator().getText("passed has met check",()),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), iX, iY, True,True)
                                                                                                        print "passed has met check: iPlayer = "+str(iPlayer)
													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 ####

and that then there is the option for two messages:
- You've captured the wonder
- Someone else captured the wonder.

The check has been passed for player 0 and for player 6, and you get the message 2 times, but there can only be 2 messages at all be there, and you can't be player 0 and player 6....:crazyeye:.
I'll sleep over it, and open tomorrow a thread in the python subforum, if i not magically see the solution then.
 
i completly don't see it :crazyeye: :confused: :wallbash:.
The logs say, that this first check here is passed 2 times:
PHP:
											if ThisTeam.isHasMet(iConquerTeam):
                                                                                                        CyInterface().addMessage(0,False,15,CyTranslator().getText("passed has met check",()),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), iX, iY, True,True)
                                                                                                        print "passed has met check: iPlayer = "+str(iPlayer)
													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 ####

and that then there is the option for two messages:
- You've captured the wonder
- Someone else captured the wonder.

The check has been passed for player 0 and for player 6, and you get the message 2 times, but there can only be 2 messages at all be there, and you can't be player 0 and player 6....:crazyeye:.
I'll sleep over it, and open tomorrow a thread in the python subforum, if i not magically see the solution then.

They had, i believe the same problem with a AND Beta a ways back, so you might want to get with Afforess on this also.
 
Hello again!

I started playing around with the Spawn A Civ, and I noticed one odd bug. When a spawned civ has more than one city, for some reason, multiple amounts of the CapitalCityUnit or whatever it is spawns. For example, if, say, the Huns start with three cities, then there would be three Attila the Hun hero units in the capital, not one. I have not modified the python in any way whatsoever, except only at those two places where you indicated we had to. Of course, it's not that big of an issue, since at the least Spawn A Civ works more or less like it should.


Besides the fact that the city placement algorithm seems to be a bit off at times (as you said before somewhere), the entire thing is really fun to see, having those random civs pop out of nowhere.
 
i completly don't see it :crazyeye: :confused: :wallbash:.
The logs say, that this first check here is passed 2 times:
PHP:
											if ThisTeam.isHasMet(iConquerTeam):
                                                                                                        CyInterface().addMessage(0,False,15,CyTranslator().getText("passed has met check",()),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), iX, iY, True,True)
                                                                                                        print "passed has met check: iPlayer = "+str(iPlayer)
													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 ####

and that then there is the option for two messages:
- You've captured the wonder
- Someone else captured the wonder.

The check has been passed for player 0 and for player 6, and you get the message 2 times, but there can only be 2 messages at all be there, and you can't be player 0 and player 6....:crazyeye:.
I'll sleep over it, and open tomorrow a thread in the python subforum, if i not magically see the solution then.

Did you magically see a solution?
 
Ureathrea! I figured it out. Seems Emperorfool already put your wonders captured/destroyed modcomp in there and that's why I was getting the double posts.

I saw this thread and it seemed they were about to add it to the mod and I guess they did
http://forums.civfanatics.com/showthread.php?t=334993

After I removed the code from my cveventmgr file, I'm only getting one message as it should be. Thanks for the help sorting this out, sorry it was something you really didn't do but I guess we all learned a little something in the end like that Bug has it in there already.
 
Sorry for not replying.
My internet connection is since thursday evening incredibly horrible (3 minutes connection, 5 minutes no response, and every half hour it crashes), so doing something took really long on friday, and yesterday i've been at the Gamescom, so i could not reply.


Looking at the answer, they didn't add it, so i'll open a thread...if i can reach the subforum today...:mad::mad::mad: this drives me mad.

Hello again!

I started playing around with the Spawn A Civ, and I noticed one odd bug. When a spawned civ has more than one city, for some reason, multiple amounts of the CapitalCityUnit or whatever it is spawns. For example, if, say, the Huns start with three cities, then there would be three Attila the Hun hero units in the capital, not one. I have not modified the python in any way whatsoever, except only at those two places where you indicated we had to. Of course, it's not that big of an issue, since at the least Spawn A Civ works more or less like it should.

Ups, looking at the code, you have to be right.
Try the attachment please :).

Besides the fact that the city placement algorithm seems to be a bit off at times (as you said before somewhere), the entire thing is really fun to see, having those random civs pop out of nowhere.

I really beg for time :religion:, so that i can do something on the algorithm.
 

Attachments

I have not had the time to read through all the threads, but I am most intrigued with the Celebrity, Dying Hero, and Spawning Civ mods.

I am not a big python guy so it will be a big step for me to add them to my mod, but I am up for the challenge.

All three mods seems right in line with some of the new changes I want to implement.
 
Hello, The J.

I've finished integrating Spawn a Civ into my mod, and attempting a few test games, but there seems to be some odd issues with the spawning.

Basically, it seems that some civs aren't spawning with the right technologies. For example, the Mughals, who were supposed to spawn with Gunpowder, spawn instead with Meditation. Or, the Carib, who are supposed to spawn with Sailing, spawn with Mysticism.

The only clue I have right now is the fact that the "wrong" techs were the ones I used for testing originally. i.e., originally I made the Mughals spawn with Meditation to test to see if the spawning would work, and then afterwards I changed the tech to gunpowder.

Anyhow, when the spawning happens, sometimes there is a CTD.

Do you have any ideas as to what could be the problem? Or perhaps it might just be one of those annoying little XML errors that screw over everything?
 
My technology check seems to be idiot proof (which i can't say for the rest of the code), so this supprises me really :crazyeye:.
Did you shut down civ in between the testing? Or how did you test it? The XML file is read after you've startet a new game, so if you've edited the techs in between, it will not have any effect.
Also, you don't have modular techs (is this even possible?), right?


For the CtD: I hope it's everytime the same civ. If yes, you made somewhere a typo in the XML file, like in the leader or the civ.
 
So I was quickly looking through the xml and python code again, and lo and behold, apparently, in the CvEventManager, where I was supposed to change the path to my mod folder, it was instead pointing to the test mod (i.e. where I was just testing my spawnable civs). I am almost certain that I previously changed it, so I'm assuming either I maybe accidentally replaced the file or I had a brain lapse or something.

:hammer2:

Anyhow, I'm going to test this thing again, and I'm almost certain that this is the cause of the CTDs I've been experiencing (I was also having CTDs occasionally when a new game was loading, but assumed previously that it wasn't related to this, but hopefully these CTDs are also fixed too).

So sorry for the trouble, and thanks again for your help. :D
 
Hello again!

I just wanted to report two (related?) possible bugs/issues with the Spawn a Civ.

The first bug I'm pretty sure is a bug. Basically, what happened when I was testing was that a Spawnable Civ appeared again after it had already been wiped out. In my test game, the Tupi Tribe, a spawnable civ, were destroyed c. 200 AD. However, they reappeared again around 1300 AD. I suspect that this is caused by the second bug, which I'll explain below:

Basically, let's say that the Tupi are spawnable when one civ discovers Archery.

Let's say I, playing as Shaka, discover Archery. The Tupi spawn, and I destroy them.

Then let's say that Isabella discovers Archery after the Tupi are destroyed. Would the Tupi then "reappear"? After all, Isabella is "one civ" that has "discovered" Archery.

On another note, let's say that I have the Huns who have a 50% chance of spawning with Horseback Riding. Would the Huns have a 50% chance of appeared each time someone discovers Horseback Riding? (The reason I suspect this is because I had some spawnable civs that were supposed to spawn with Classical era techs, but they spawned when everybody was pretty much into the Medieval ages)

If so, then I think that this all might be a rather big issue...

Hope that made sense.
 
Then let's say that Isabella discovers Archery after the Tupi are destroyed. Would the Tupi then "reappear"? After all, Isabella is "one civ" that has "discovered" Archery.

Could theoretically happen, when in between another civ has spawned. Did not think that it would really happen.
I think i could implement a quick solution, that a civ can't respawn at least as long as the current game is going on.
But i would need time until the weekend.

On another note, let's say that I have the Huns who have a 50% chance of spawning with Horseback Riding. Would the Huns have a 50% chance of appeared each time someone discovers Horseback Riding? (The reason I suspect this is because I had some spawnable civs that were supposed to spawn with Classical era techs, but they spawned when everybody was pretty much into the Medieval ages)

Yes, that's how i implemented it.

Do you think a one time chance would make more sense?
 
Could theoretically happen, when in between another civ has spawned. Did not think that it would really happen.
I think i could implement a quick solution, that a civ can't respawn at least as long as the current game is going on.
But i would need time until the weekend.

Alright, no problem. I'll be patiently waiting. :D

The next release of WoL can wait just a tad bit longer. :D


Yes, that's how i implemented it.

Do you think a one time chance would make more sense?

I think that would make more sense. Well, at least that's how I thought it was supposed to work. :crazyeye:

If you could fix that it'd be great too, but I don't think it's as "serious" as the other issue above.


Anyhow, thank you so much again. This is really an awesome modcomp, can't believe it isn't being used more often. :goodjob:
 
Alright, sounds cool.

I'm just mainly concerned about the respawn, since it's likely to happen if you already have spawnable civs in place (i.e., let's just say that a primitive Spawnable Civ discovers the tech that spawns the Huns when you're already running around with Rifles).

So that sounds all good, then. Thanks again! :goodjob:
 
Sorry if I sound like I'm pressuring you, but I just wanted to know when you'd be able to [at least] fix the respawn issue? The thing is I want to get WoL out as soon as I can, but I want to know when I'll be able to do that. :D
 
Back
Top Bottom