Platyping's Python

Matsumoto Castle

Spoiler :

Matsumoto.jpg

 
i absolutely love the ideasof these two, both really original

assuming your running out of ideas, maybe some type of wonder that came with the start of gunpowder which gives the buildings like walls and castles bonuses against gunpowder units as well, ik that can be coded but not sure what wonder
 
Thanks, not sure how to code that though, because I think the obsolete defense part comes under SDK
 
if you want I could always expose some sdk functions into python for you
 
Version 1.5

Burj Al Arab, Knossos Labyrinth, Willis Tower, World Trade Center, Louvre
1) Codes rewrote in similar fashion as Matsumoto and Gateway Arch
2) Locations of Wonder Cities Stored and Loaded
3) Thus, no more searching for who has Wonder and which City each turn => Performance Improvement

Louvre
Added a City Raze part where cities with wonders razed will decrease Louvre's output

Great Zimbawee
Removed leftover codes in onCombatResults from previous codes

Matsumoto
Added City Raze part

Catacombs
Added check on Loser's Domain, so that units destroying ships or planes in cities will not trigger

Silk Road
1) Includes possibility of spawning silk in non-forested plots of capital as well
2) Adds a check in case there is totally no eligible plot around capital to spawn silk

Neuschwanstein
1) Shifted to Replacement Parts, since it is a 19th century wonder. Engineering too early
2) Thus, gave it a boost to become global effect
Spoiler :

Neuschwanstein.jpg



Megapack
Changes updated, Added 2 new wonders

P.S.
Is it just me or does it seem like buildings adding % food yield actually add nothing at all?
 
Thanks, not sure how to code that though, because I think the obsolete defense part comes under SDK

Thats what you think at first, but all you have to do is say if the city has building_castle then add the percentage of defence a castle has, and do that with walls as well

not sure if you can do this is python but do buildingclass_castle if you can because otherwise you would have to do the UU too, and that would make for a longer codej
 
What Matsumoto does is just ensures the CURRENT defense is back at MAX each turn.
However, there isn't any python code to adjust MAX defense, which is based on culture level
 
What Matsumoto does is just ensures the CURRENT defense is back at MAX each turn.
However, there isn't any python code to adjust MAX defense, which is based on culture level

hmm weird, when theres something or xml i assume theres something for the more complicated python:crazyeye:

maybe a wonder, like the prague castle, that once you get into the modern era it changed the castles/walls meaning, it turns it into more of a tourist attractions, it gives a gold/culture bonus since after gunpoweder those two are pointless, and most castles now a day are toursists attractions
 
like I said sdk methods can be put to use... for example
Code:
def gaul(*args):
        "Power of the Dun - Cities built on hills get +10% defence"
        if args:
                if len(args) == 3:
                        pCity, eOwner, eNewOwner = args
                else:
                        pCity, eOwner = args
                        eNewOwner = eOwner
                iExtraDefense = pCity.getExtraDefense()
                if eOwner != pointer("Gaul", playerID) != eNewOwner: return
                if eNewOwner == pointer("Gaul", playerID):
                        if pCity.plot().isHills() and iExtraDefense == 0:
                                [B]pCity.changeExtraDefense(iGallicDefenseBonus)[/B]
                elif iExtraDefense > 0:
                       [B] pCity.changeExtraDefense(-iGallicDefenseBonus)[/B]
        else:
                for pCity in list(city.GetCy() for city in pointer("Gaul", PyPlayer).getCityList()):
                        if pCity.plot().isHills():
                                [B]pCity.changeExtraDefense(iGallicDefenseBonus)[/B]

this is code using an sdk method. You could have it so that if city has walls or castle (checking if it isn't obsolete for will the wonder go at rifling?) then increase city defence or (if I can find one) increase defence vs gunpowder units.

edit: in fact the way the void methods are set up I could create a method that forces a building to have extra defence. however untill I work out how bypassing obsolete would work then the extra city defence if walls are in the city (even if obsolete) will be a piece of cake if you want it?

edit: edit: after thinking about it I could make it so that gunpowder units are weaker while attacking cities if the wonder has been built by the defender and the defending city has walls or castle.
 
@dacubz145 Adding Extra Commerce/Yield/Happiness/Health to Buildings is possible. In fact, already done with Bolshoi and Porcelain Tower, which is why I don't feel like doing it again for another wonder. Else, I can easily chunk out 50 wonders for each type of building.

However, because of the XML tag <ObsoleteSafeCommerceChanges>, only those that are stated there will remain when the building obsoletes. As such, even if I add culture/gold etc to the castles, those bonus will still obsolete.

@j_mie yeah I know SDK can do much more, but I don't wish to release single wonders requiring SDK work. Else, I could have done global maintainence, inflation etc. Simply because SDK requires compiling, there is a .dll file etc which is not going to be easy for modders with less experience to merge and use
 
if your running out of wonder idea have you considered doing units or civics? civics seem really too unimportant and if u did someing similar to your traits, it would be really cool(just inhancing the basic civ ones) and units would be really cool as well, there are so many that really need python to go with them i think it would be great
 
Actually, most python benefits of those wonders, can be used for civics or traits.

For instance, at game start, if player has xxx trait, increase fishing boat commerce.
Only issue is this will only affect players available at turn 1. New ones liberated will not be affected, so extra codes have to be done in first contact or probably vassal

If I really got nothing left to do, I may explore letting it trigger event for those extra benefits like inflation.

Edit:
Traits
1) Rewrote Creative codes for new Cities.
No more if else statements. Works for all Mods
2) Slightly changed Organized codes for Religion Changes

Known Issue:
Charismatic Trait will not work properly if Team has more than 1 Player
 
Actually, most python benefits of those wonders, can be used for civics or traits.

For instance, at game start, if player has xxx trait, increase fishing boat commerce.
Only issue is this will only affect players available at turn 1. New ones liberated will not be affected, so extra codes have to be done in first contact or probably vassal

If I really got nothing left to do, I may explore letting it trigger event for those extra benefits like inflation.

Edit:
Traits
1) Rewrote Creative codes for new Cities.
No more if else statements. Works for all Mods
2) Slightly changed Organized codes for Religion Changes

Known Issue:
Charismatic Trait will not work properly if Team has more than 1 Player
i get your pint but most people dont mod pythong and civics would really benefit the game
but as for units you cant really take it from a building, a couple off the top of my head
railroad artillery can only drive on railroad (theres python for that but not specifically for the unit)
escort ship which protects carriers, so a bonus while still on a square with a carrier

if ur not interested in units thats fine but there are so many units the ideas are endless
 
Not recommended for performace issue using python.
To check whether escort ship and carrier are in the same plot, every time one of them move, you have to loop through all the units in the previous plot to 1) see if there are other escort ship/carrier 2) remove the bonus if none of 1 type around. Then you have to check the new plot and do the necessary as well

Civics is harder than traits or wonders because there isn't a change civics check. So the only solution is to check every turn. And because of this, I can only know what civics he has currently, and not previous turn, so only limited codes can be used. Unless you want to store data for each and every single player, each civics class, then you can compare whether civics in previous turn and current turn are the same. This is why for civics you can only do stuff like, "add gold per turn if he has this" or "add promotion to new unit built if he has this"
 
Oh well, world wonder :D
If you wanna take the risk and wait till your city culture level is pretty high to build, you risk letting it built by others.
AI usually build wonders in big cities so shouldn't be a problem :D
 
Zuiderzee Works
Spoiler :

Civ4ScreenShot0023-2.jpg


Been a long time since a wonder/project took more than an hour to get all the codings right... Thanks to the damn rivers

What it does is simple, turn a coast tile into a plain tile for every coastal city.
Extend river where required
If new tile has river, add floodplains.
Thus, every coastal city gets an additional useful tile rather than boring coastal tile.
Codes are long, and very long, but since it only activates on project built, only once per game

Rivers are extended if possible, making non river tiles => river tiles now, so extra commerce, + extra production with levee, irrigation etc.
So actually, the effects are greater than just the one converted tile


Edit:
Burj Al Arab
Fixed variable undefined error

Padrao
Added a check on United Nations, in case Padrao is still not built when UN is built, which results in an error

Megapack
Added extra code for Zuiderzee Works to be compatible with Springfield
Updated with new wonders/projects
 
Back
Top Bottom