Simple Python Things

I've updated both modcomps (water and respawn promotion) with the new button and the new well model :).


I'm currently working again on the warrios of god modcomp, because the code is just not nice :blush:.

So basically the bonuses of this promotion should apply only vs civs that have as state religion islam.

mmhh...thought a moment about it, but i guess, i can't do it.
The problem is, that the strength/the bonuses of a unit would have to be changed before the combat, and i can't see a function, which directly triggers before that.
There's only doCombat in CvGameUtils, but this function gives me only the attacker and the destination plot, and not the unit, which is attacked. I could grab the destination plot, and look, what units are there, but here begins the problem, what units are there, maybe from different civs, are you in war with all civs/only some, what state religion do they have, what unit is attacked, and maybe some things more.

To be sure, i'll take a look at it again tomorrow.
 
OK thank you for trying :goodjob:
 
wow, thanks. I downloaded :)

BTW, one year back I searched somebody for python code... Can you write code for one my wonder? Can I have request, please?
 
I get this error on the Industry Espionage:

Traceback (most recent call last):

File "CvEventInterface", line 30, in onEvent

File "CvCustomEventManager", line 142, in handleEvent

File "CvCustomEventManager", line 153, in _handleDefaultEvent

File "CvEventManager", line 883, in onCombatResult

Code:
	### message: %s1 has plundered %d2 [ICON_GOLD]!###
			if ( message == 2 ):
				[B]CyInterface().addMessage(pPID,false,15,CyTranslator().getText("TXT_KEY_INDUSTRYESPIONAGE2",(szName,iGoldStolen)),'',0,'Art/Interface/Buttons/Process/ProcessResearch.dds',ColorTypes(44), iX, iY, True,True)[/B]
				CyInterface().addMessage(otherPID,false,15,CyTranslator().getText("TXT_KEY_INDUSTRYESPIONAGE2",(szName,iGoldStolen)),'',0,'Art/Interface/Buttons/Process/ProcessResearch.dds',ColorTypes(44), iX, iY, True,True)
				### message: %s1 has plundered %d2 [ICON_GOLD]!###

UnboundLocalError: local variable 'iGoldStolen' referenced before assignment
ERR: Python function onEvent failed, module CvEventInterface
 
That's, what i've wanted to hear :D.

Always happy to oblige, though I have to admit, I have a couple of other promotioninfos tags on my list ahead of StateReligionModifier (like <PillageCommerceChange> :D, I wonder what that could be for? :think: and <CivicPrereq>), but I will get to it.
 
What do you need :)?

thanks. Idon´t know if is it possible but I need special function for one from my wonders.

My idea is: who build this wonder will have revealed coal sources on his territory before allow it relevant technology.
it is possible?
This reveal is bunus for my "special improvement system" where player can build various improvements on resources.

P.S. I was asimilated your excellent well (water) modcomp and found here one little conflict. Name IMPROVEMENT_WELL interrupt well what we can build on oil resource. Here is namesake :(
I was testing rename it in xml and python but something I made bad. I will tested it more.
 
thanks. Idon´t know if is it possible but I need special function for one from my wonders.

My idea is: who build this wonder will have revealed coal sources on his territory before allow it relevant technology.
it is possible?
This reveal is bunus for my "special improvement system" where player can build various improvements on resources.

I've looked in the API, and can't see a command to do that :(.

You could do it through an event, which is triggered through the wonder, and reveals the resouce (look at the event "A man named Jed").


P.S. I was asimilated your excellent well (water) modcomp and found here one little conflict. Name IMPROVEMENT_WELL interrupt well what we can build on oil resource. Here is namesake :(
I was testing rename it in xml and python but something I made bad. I will tested it more.

Nice, i'll update the model.

But you should re-download it, there was an error in it. I named the improvement WELL, like the oil well :blush:. -sr has reported the error.

->
Reuploaded the "water" modcomp, to fix that (renamed to WATERWELL, and changed all references).

Already fixed ;).


Ah, silly me. It works fine now.

:)
 
Just wondering if you could take a look at the Indus Espionage one again, i used to get a pop-up that said i plundered 1 :science: but i dont get that anymore??

Heres my python:

http://forums.civfanatics.com/showpost.php?p=8447915&postcount=35

What do you mean?
Did it work in the mod, and now it doesn't?

The effect also depends on the enemy.
Did you try it with another enemy?

The python itself seems right :dunno:.

I have a question about leader traits. Is it possible to create a trait that allows the player to sacrifice population regardless of your current civic?

mmmhh...not sure.
There's no real python function to enable the hurrying, but it seems, that the control here is done only via the interface.
That means, if i can activate the button (which seems to be possible), then it'll work...maybe...not sure, if it'll work for the AI, but i guess it would work for the human player.
I'll try it out tomorrow.




-----------------------------------

I've re-uploaded the "warriors of god" modcomp.
- Now there's nothing in it, which has to be changed (also when you have more religions) -> a lot easier to merge.
- I've also fixed a bug with the purging religions function of the fanatic.



And i've created a small interface modification,

wonder destroyed/captured messages

Spoiler :




You'll simply get a message, when somebody you know (or youself) captures/destroys a city with a wonder, and what wonders are affected.

This modcomp has originally been requested by Akropolis.
 
The wonder notification feature should really be a part of BUG, IMO.
 
That's a pretty nifty and nice little modcomp there! Great job again. I could stuff it in WoL.
 
What do you mean?
Did it work in the mod, and now it doesn't?

The effect also depends on the enemy.
Did you try it with another enemy?

The python itself seems right :dunno:.



mmmhh...not sure.
There's no real python function to enable the hurrying, but it seems, that the control here is done only via the interface.
That means, if i can activate the button (which seems to be possible), then it'll work...maybe...not sure, if it'll work for the AI, but i guess it would work for the human player.
I'll try it out tomorrow.




OK i got it to work, by putting some older python in, heck if i know what the hack is going on????

http://forums.civfanatics.com/showpost.php?p=8451122&postcount=37

BUT i always get a CRASH with this python?:mad:
 
Top Bottom