Tsentom1 Python Traits

Tech costs kinda baffle me in the python as I know exactly where I have to edit it but the code I write for it always works kinda weird. I have like 5 things half done with tech costs I'm still trying to clean up. So that might be a bit. Though if you're simply talking about a general +10% research bonus (not affecting the specific cost persay, I can do that easily with the XML. The religion thing I can probably do on begin player turn, scan cities, get number of religions, and add +1 culture per religion. Let me see how that code would work out.
Hmm, that might explain why none of traits created by Firaxis has anything about cost reductions, whether it be tech, unit, or building. Think there's a bug Firaxis seems to be unable to figure out? Or is it just merely a balancing issues? Actually, I question whether cost reduction would upset balance. You can always balance against that with something else. It's hardly more than paper-rock-scissor system, not unlike how you balance units against each other. Still, none, not even one, of traits created by Firaxis has any cost reductions. Something's up? o-O
 
Hi Tsentom, is it possible to add to the gpp rate of a specialist or a building with Python ?
I ask that bcause it will help to make Ind-Phi combo slightly less synergetic and, thus, acceptable.

The only way with python that I could think of would be sort of messy and a hack job. Basically, every turn you'd have to go through all the cities, find the number of wonders, then tell it to subtract so and so amount of GPP points from that city. Otherwise, I don't think you can do it neatly without changing the SDK.
 
Python is really good for one time bonus or bonuses every few turns or every time something happens.

Constant changes are usually best done with the SDK.
 
Noticed. Code is a pain for me but I keep trying. Nevertheless I had an idea for Wonders effects > have a wonder grant a stronger effect the sooner you build it. I think it will spice up things with a race for that Wonder.
 
Noticed. Code is a pain for me but I keep trying. Nevertheless I had an idea for Wonders effects > have a wonder grant a stronger effect the sooner you build it. I think it will spice up things with a race for that Wonder.

that is a good idea and i think i know a good thing for it too (and how to do it) will take me a while though as i have a bunch on my plate at the moment.
 
Was wondering if you were still interested in creating a python function that allowed culture to still be generated by non state religions for a leader trait. The wolfshanze mod is getting a bunch of new leaders in the next installment and I'd like to add more variety with a "Progressive" trait for some of them (+10% science--Which can be done in XML-- and non state religion still produces culture). I'd have no idea how to begin coding that.
 
I do intend to get to it, I've just been really busy lately. It will be tricky but not impossible to code as in retrospect its more of an SDK thing.
 
how can I change the agricultural trait to:

+1 city population if city is not the first city (capital) ?
 
how can I change the agricultural trait to:

+1 city population if city is not the first city (capital) ?

I might be able to do that really easy by having the game check if the Palace is in the city. I just have to see what order the game checks things.

I'm going to be working on some civ stuff / releasing a few things this weekend so I'll check if that works and if so let you know and post the code.

If it doesn't it still doable and would probably just need to check the number of cities, I just forget how to write that offhand, but I've done it before, somewhere...
 
This actually only uses XML, but people requested I separate it from my Thomas' War mod where it originated:

MerTrait.jpg


The wording may seem a bit odd, but that's actually the default wording programmed into BTS. I've separated it in the XML Text file so you can change it if you want. Functionally, what it boils down to is for every 5 commerce a Trade Route makes you also get 1 Food and 1 Production. (20% of a 100 is 5). It works for every Trade Route in a city.

~~~

This was made by request and maybe also for a potential future version of Thomas' War:

SciTrait.jpg


It's relatively self explanatory. For people wondering why I just didn't do a strict +research or +research% bonus, it's because I try to make all my traits functionally different.

Also, this trait can be easily edited to give a free specialist of any kind you wish, just search for and switch out "SPECIALIST_SCIENTIST" within the mod code to whatever you want.
 
I still have more stuff to release this weekend, as well as trying to get the requests working without any bugs. (Currently some of the requests I've been working on are randomly not firing for some reason. I'm trying to figure out why).
 
Nice :).

Waiting for what you're working on :).
I'm sure it'll be interessting.


I think a free scientist will be much to powerfull in the early game.

True, but someone asked me for the code for a free "insert specialist here" in every city, so it was more for him. You can replace it with whatever specialist you want.

The 3 additional research is not that powerful but the 3 free GPP needs to be watched. On the other hand it doesn't have any double speed buildings and it's usefulness declines as the game progress with other existing traits become stronger. Also, it will completely mess with your GP percentages making it harder to get Engineers or Artists so it can limit a cultural victory.

Maybe I'll edit it, but it's mainly for people to use the code however they want in their mods.
 
Scientific Trait might be too good at the beginning (founding of religions, ...). This is why I'm no fan of any pure scientific advantages (remember: financial needs cottages).
 
how can I change the agricultural trait to:

+1 city population if city is not the first city (capital) ?

Okay, replacing the onCityBuilt part of the code in the download with:

Code:
	def onCityBuilt(self, argsList):
		'City Built'
		city = argsList[0]

## Agr Trait Start ##

		player = PyPlayer(city.getOwner())
		pPlayer = gc.getPlayer(city.getOwner())
		iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_AGRICULTURAL')

		iPalace = CvUtil.findInfoTypeNum(gc.getBuildingInfo,gc.getNumBuildingInfos(),'BUILDING_PALACE')

		if (pPlayer.hasTrait(iTrait)):

			if city.getNumActiveBuilding(iPalace) == false:

				city.changePopulation(1)

## Agr Trait End ##

		if (city.getOwner() == gc.getGame().getActivePlayer()):
			self.__eventEditCityNameBegin(city, False)	
		CvUtil.pyPrint('City Built Event: %s' %(city.getName()))

Will accomplish this. Hope it's what you wanted.

~~~~~~~~~~~~~~~~~

@phungus420

I'm still working on your request. I made a rough mod of it, but it only sort of half works. Sometimes it works fine, sometimes it doesn't fire or it will fire twice. So I'm still trying to iron out why it's not working as it should.
 
@phungus420

I'm still working on your request. I made a rough mod of it, but it only sort of half works. Sometimes it works fine, sometimes it doesn't fire or it will fire twice. So I'm still trying to iron out why it's not working as it should.
Thanks for taking the time to look into it. I appreciate it. I have a similar problem with some code I wrote for Revolutions when calculating the city distance penalty, so I know how that goes.
 
Nice work!

How about a seafaring trait that gives a production bonus to naval units?

Are these traits mp compatible?
 
Back
Top Bottom