Platyping's Python

End of Commercial Break, back to revision of Gigapack.

Fort Knox (Remake)
Old:
Spoiler :
FortKnox.jpg

New:
Spoiler :
FortKnox-1.jpg


The old benefit has been granted to Mentor Promotion.
Also, some of you have pointed out Fort Knox is now more of a treasury than training ground which it used to be.
Thus, the new benefit is more or less a combination of both treasury and training ground.
Also better for performance since you do not have to loop through the units in the city anymore.

National College (Remake)
Old:
Spoiler :
NationalCollege.jpg

New:
Spoiler :
NationalCollege-1.jpg


The old one requires a check every turn, plus a loop through all cities to find it.
The new one no longer requires checks every turn, although now it requires checks elsewhere (when cities built, razed etc)
Overall, should be better for performance

Golden Pavilion (Remake)
Old:
Spoiler :
GoldenPavilion-1.jpg

New:
Spoiler :
GoldenPavilion.jpg


Killed mainly because of UN Resolution(Free Religion) bug.
The new one is still based on the theme, X Benefit based on State Religion.
But since it is now granted to new cities, the bug is avoided.
Later religions are granted slightly more beneficial ones while the early ones get simpler benefits.
Pretty much a combination of some of my own traits.

Now Lotus Temple is only wonder left using onChangeStateReligion codes, so that is the only one left with UN Resolution bug

Cyrus Cylinder
Effects:
Generate Great General Points based on Game Score, Vassals Increase the Rate

What's New:
Effects are still the same, except based on Power Now.
Codes have been rewritten, still require turn checks, but no more loops, so still a boost.
 
UN Resolution forces you to change state religion without triggering codes under that
 
Rampage
Spoiler :
Rampage.jpg


The python alone may not be that useful, so added some XML effects to go with it.
Sounds better as a trait though.

Only granted to those 3 unit classes because XP is gained on withdrawals but does not trigger onCombatResult.
Thus, there may be occassions where the promotion does not work when XP gained because of withdrawals.
Thus, by right these 3 unit classes should not be able to withdraw, unless they have Tactics which is pretty rare.


Spoils of War
Spoiler :
SpoilsofWar.jpg


Very Simple Promotion


Diplomat
Spoiler :
Diplomat.jpg


May need balancing, too weak?


Fear Promotion:
Enhanced with 15% Damage beside just stunning the victim unit for 3 turns.
This is because usually the victim will be the next strongest unit, but even when stunned, it will still be the next defending unit.
Thus, add a little damage, so it will no longer be the next best defending unit, usually :D

Scavenger Promotion:
Removed unnecessary python codes from Standalone.
 
You just gave me a great idea!!!!

For my next mod I have loads of guilds and I think I will have it so that units built in the headquarters of a guild get the guild's promotion (unique abilities). I guess if you had all 7 guilds in one city then it needs balancing, like python code to randomly assign one or something like that.

Maybe you could think of some abilities for them :D

there is:

Smiths guild
Merchants guild
Explorers guild
Agricultural guild
Artists guild
Masons guild
Alchemists guild
 
Where got never ending ideas :D
Think of them yourself lalala

Toxic Cloud
Spoiler :
ToxicCloud.jpg


Promotion Pack updated

P.S.
Known Bug:
Divine Strength which adds 2 Base Strength will not carry forward when unit promoted. (From Warrior to Axeman for example)
 
Not sure if that will be used that much, because normally you have a war to conquer cities, and you don't want to have them surrounded by Fallout :/. Interesting idea though.
I don't think the name is very good, but I cannot really think of a better one.
 
Yeah, I am not really in the creative department :D
If I can conquer the city, I also wont pillage, but if I am not strong enough to conquer, maybe it will be fun to be an irritant.
Especially in early eras where players cannot clear fallout :D

Estates
Spoiler :
Estates.jpg


This one is an experimental promotion.
Uses script data, rather than my usual style of storing data using self.xxx functions.
Just trying to see how script data works, seems to be only capable of storing one string?
If so may conflict with other mods using script data, then I will just convert this back to my old style of coding (ahem, looted from The_J long ago)

What it does is self-explainatory, in short, a walking gold mine.
Another old ability from Heroes of Might and Magic Series lalala I am a thief :mischief:
Since this is just an experiment, I did not bother to look for a new button also :D

Requires turn check, obviously, but pretty much a one-liner so not a big deal.
 
You can store more than just a string...er...I mean at the end it will be a string IIRC, but you can load a lot more data into it.
import pickle
then you can do e.g.
CyMap().plot(0,0).setScriptData(pickle.dumps(bListSpawnedCiv))
(bListSpawnedCiv is obviously a list)
and to get the info back
bListSpawnedCiv = pickle.loads(CyMap().plot(0,0).getScriptData ())

I have absolutely no clue why the heck this works, or how it works, but it does work :D :dunno:.
Yes, it might conflict with other mod's script data.
 
it works because pickle creates very odd looking strings from objects. it allows you to store data as a huge string that looks like nonsense...

out of curiousity how to store sutff with "The_Js method"
 
J's version.
More troublesome to write, but in the long run, might be better off since you can easily merge 10 works using this style, but I doubt it is possible with script data.
No matter how long the string is, it is ultimately ONE string, looks pretty hard to merge 2 works using the same script data.

The bulk of the code is pretty much on game start and game load, after that it works pretty much the same as script data.
Haven't experienced any side effects so far
 
Yup, the disadvantage is the loops done every time you load a game.

The pros will be:
1) Easier to merge with others requiring data
2) Can do calculations on the data directly, without the need of converting string to integers and vice versa.

For this case, the loops may be bigger since you have to loop through every unit to count how many estate units there are...
But oh well, just an experiment :D
 
Destiny
Spoiler :
Civ4ScreenShot0001.jpg


Another Heroes series concept.
Used to be called luck, destiny sounds better.

When promoting, 25% chance to get an extra one.
Simple idea.


Taken Divine Strength out from promotion pack till bug solved.
Estates won't be added into promotion pack, just an experiment.
Destiny added into promotion pack.
Promotion Pack updated

I intend to keep Trait Pack and Promo Pack simple and small.
1) No callbacks
2) No turn checks
3) Only 1 python file, EventManager for simplicity :D
 
Oh well, since Jamie liked this effect, I tried not to touch it, but it seems that I need to adjust it now :D

Invasive Trait
InvasiveTrait.jpg


This trait works well in Single Player, but after some reading, there will be a problem with MP.
Spoiler :
Code:
	def onCityAcquired(self, argsList):
		'City Acquired'
		iPreviousOwner,iNewOwner,pCity,bConquest,bTrade = argsList
## Invasive Trait Start ##
		if bConquest:
			pPlayer2 = gc.getPlayer(iNewOwner)
			if pPlayer2.hasTrait(gc.getInfoTypeForString("TRAIT_INVASIVE")):
				(loopCity, iter) = pPlayer2.firstCity(false)
				while(loopCity):
					loopCity.changeHappinessTimer(pCity.getPopulation() * 3)
					(loopCity, iter) = pPlayer2.nextCity(iter, false)
				for x in range(pCity.getX() - 1, pCity.getX() + 2):
					for y in range(pCity.getY() - 1, pCity.getY() + 2):
						pPlot = CyMap().plot(x,y)
						for i in xrange(pPlot.getNumUnits()):
							pUnit = pPlot.getUnit(i)
							if pUnit.getOwner() == iNewOwner:
								pUnit.setDamage(pUnit.getDamage() - 30, False)
				pUnit = CyInterface().getHeadSelectedUnit()		## Conquering Unit is excluded in above loop for some reason ##
				pUnit.setDamage(pUnit.getDamage() - 30, False)
## Invasive Trait End ##

The current code loops around the city plot to get the units and "heal" them.
The problem is that somehow the conquering unit is not in this loop although the loop covers all 9 plots around the city.
Which is why I added the getHeadSelectedUnit code.
The problem however, is that this code creates OOS in MP, as everyone is looking at different screens.

Thus, there are 2 ways out to get the same effect.
1) use onUnitMove instead, which is definitely out of the question
2) loop through each unit of the player instead and check location of unit and heal.

Option 2 seems the obvious choice, but if I have to loop through every unit, I rather change the effect to simply "Heals all units 20 or 25%" so that I do not have to check location.
Assuming the player has 200 units, this will skip 200 checks when the invasive player captures the city.

Thus:
1) Simply remove the getHeadSelectedUnit code, and ignore the unlucky capturing unit.
2) Heals all units 20 or 25% instead.
 
Spoils of War looks like a cool promotion, and part of me wants to put Cleave and Toxic Cloud together.
 
Thanks.
If you wanna merge Cleave and Toxic Cloud into one promotion, you may want to consider changing Cleave to be "Cleave for pillaging" instead.

Currently Cleave is onCombatResult, whereby when you killed one unit, you injure the units in surrounding units as well.

To merge them into one promotion, you might as well change it to, when you pillage, you pillage the surrounding improvements as well, and then add the fallout from toxic cloud.

Else, if Cleave is still about combat, would seems weird to combine them :D
 
thats fine :p I liked the whole happiness thing the most :D
 
Bug Catching Excerise

Lotus Temple
Added UN Resolution Fix to it.
Effects still same, codes rewritten.

Buckingham Palace, Palacio Da Pena
Rewrite codes to avoid using CyInterface().getHeadSelectedCity() codes which cause OOS error
Effects still same, codes rewritten.

Invasive Trait, still in redesign phase to avoid CyInterface().getHeadSelectedUnit()

Oh well, as usual, to write something here, have to provide something new as well :D

Curse
Spoiler :
Curse.jpg


For those who forgot, this is what Retribution does:
Spoiler :
Retribution.jpg


Now it has been enhanced as well:
Spoiler :
Retribution2.jpg


Well, both of them are "not that strong" on their own, but together they become pretty strong.
The unit is literally a walking time bomb, whoever kills it is pretty crippled, 50% damage and stunned for 10 turns.

The complementary codes for each other are included in both standalones, but both are inactive.
Of course, in the Promotion codes, the complementary codes are activated.


Promotion Pack, Megapack, Gigapack updated
 
Rebirth Flames
Spoiler :
RebirthFlames.jpg

More or less pretty similar to the original Survival Promotion codes, with modifications.
Codes shifted to onUnitKilled rather than onCombatResult so that it will be triggered even if it died outside of its own combat, such as nukes or loaded in transport. (This creates abit of problem though... waste 1 hour to figure out why...)

When the unit died, it will 100% revive back in capital, or a coastal city for ships.
Suffers a 25% Combat Str loss, so a Modern Armor will drop from 40 to 30.
If died again, drops further to 20 (25% from starting base Str, not current base Str)
If died again, drops to 10...
If died again, really dead.
Str Loss is rounded up, so unit with 8 str will lose 2 str, but unit with 6 str will also lose 2 str.
Upon upgrade, like Rifleman to Infantry, the str loss is gone and it is fresh as new again.

In Promotion Pack, it will still trigger Retribution and Curse, the only exception is Last Wish, which would grant alot of XP upon death.
Last Wish will only trigger when it is really dead.


Spider Sense
Spoiler :
Civ4ScreenShot0001-2.jpg


Another variant of the Survival promotion.
When a Knight dies, it will spawn a axeman or so on the spot with all the promotions, exp, level etc of the former.
That's why naval, air and siege are excluded, so you do not get weird promotions on the rider.

When merged with Rebirth Flames, this will only take effect when unit really died


Blood Pact
Spoiler :
Civ4ScreenShot0002.jpg


Fun part about python is you can make this kind of "dynamic" promotions that become stronger with level, rather than Combat I, Combat II, Combat III etc
Set to trigger even if unit survive due to Rebirth Flames or Spider Sense


Mentor, Inspiration, Heroic Promotions
Removed Air Combat Class from them, since they require Leader, and Air Combat Class cannot obtain Leader Promotion

Promotion Pack updated
 
Back
Top Bottom