Platyping's Promotions and Traits

SUCCESS!!

Thanks for all your help platyping!
 

Attachments

  • Civ4ScreenShot0023.JPG
    Civ4ScreenShot0023.JPG
    152.9 KB · Views: 242
Artifacts Version 3

1) Added a limit to the probability of obtaining artifacts.
It is still based on unit level, (Level / 150), but capped at 10/150
So level 5 unit still has 5/150 chance
level 10 unit still has 10/150 chance
level 15 unit now only has 10/150 chance

2) No more hard coded python
Rewrite some parts such that modders can easily add any number of new artifacts themselves, WITHOUT doing anything to the python codes.
Thus, any new addition of artifacts is simply XML work, unless of course, the artifacts come with python effects.

If you are happy with hard coded python, there is no need to change the codes :D
 
Been awhile since I made something

Fortune
Spoiler :


Basically gambling.
Instead of choosing the promotion you want, taking this promotion instead will choose a random promotion ignoring all pre-requisities, except unit class.
So a level 2 archer can suddenly end up with City Garrison III or even Morale or Tactics, without having Leader or City Garrison I.
Leader promotion itself is excluded.
What's the catch? 25% failure rate, whereby you end up with nothing. XP simply wasted.


Windrunner (Modified)
Spoiler :

Old


New


Now it only works when in Cultural Borders and Below 25% Strength.
Thus, it is no longer counter productive during offensive wars where you are fighting at a place 1000 miles away.
And now it chooses the nearest city rather than the capital.


PromoPack:
Added Sword of Justice
Added Fortune
Removed Instant Heal (It is not really a promotion... Since I lazy to add the other "skills" like Fortification and Haste, I remove this as well)
Fixed Economist Button
Added limit to Artifact Spawn Rate as above, didn't bother to include the hard coded changes.
 
Wonderful work as always, Platyping.

I am considering adapting "Toxic Cloud" into a sort of "Depleted Uranium Ammunition" promotion in my personal mod (and I wouldn't call it that :lol: ), but I'd like it if it could generate fallout both from pillaging AND from attacking. Is there a quick adjustment to the code to make it do that? Or is there another promotion floating around somewhere that I could merge with "Toxic Cloud"?
 
Thanks.

FireStorm II has a chance to add a "Fire" feature to a city when attacking cities.
You can merge it into Toxic Cloud, and do some adjustments so that instead of "Fire" it adds "Fallout", and remove those city checks.

If you have trouble editing the codes, let me know then.
 
I'm a near-total noob when it comes to Python, so...I can guess! Is it just taking out the bolded code, and changing the italicized bit from FIRE to FALLOUT? (I'm sure I'm guessing wrong.)

Code:
## Fire Storm II Promotion Start ##
		if pLoser.getUnitCombatType() > -1 and pLoser.getDomainType() == pWinner.getDomainType():
			if pWinner.isHasPromotion(gc.getInfoTypeForString("PROMOTION_FIRESTORM2")):
				pPlot2 = pLoser.plot()
[B]				if pPlot2.isCity():
					if CyGame().getSorenRandNum(2, "Fire") == 0:
						pCity2 = pPlot2.getPlotCity()
						pPlayer = gc.getPlayer(pWinner.getOwner())
						if gc.getTeam(pPlayer.getTeam()).isAtWar(gc.getPlayer(pCity2.getOwner()).getTeam()):
							if pPlot2.getFeatureType() == -1:[/B]
								pPlot2.setFeatureType(gc.getInfoTypeForString("FEATURE_[I]FALLOUT[/I]"), -1)
## Fire Storm II Promotion End ##
## AI Promotion ##
		pPlayer = gc.getPlayer(pUnit.getOwner())
		if not pPlayer.isHuman():
			if CyGame().getSorenRandNum(5, "Platy Promotion") == 0:
				iPromo = gc.getInfoTypeForString("PROMOTION_FIRESTORM2")
				if pUnit.canAcquirePromotion(iPromo):
					pUnit.setHasPromotion(iPromotion, false)
					iPromotion = iPromo
					pUnit.setHasPromotion(iPromotion, true)
## AI Promotion ##

Also, since there's a random number involved... this isn't going to cause OOS errors in multiplayer, is it?
 
Code:
	def onCombatResult(self, argsList):
		'Combat Result'
		pWinner,pLoser = argsList
		playerX = PyPlayer(pWinner.getOwner())
		unitX = PyInfo.UnitInfo(pWinner.getUnitType())
		playerY = PyPlayer(pLoser.getOwner())
		unitY = PyInfo.UnitInfo(pLoser.getUnitType())
## Fire Storm II Promotion Start ##
		if pLoser.getUnitCombatType() > -1 and pLoser.getDomainType() == pWinner.getDomainType():
			if pWinner.isHasPromotion(gc.getInfoTypeForString("PROMOTION_TOXIC_CLOUD")):
				pPlot2 = pLoser.plot()
				if CyGame().getSorenRandNum(2, "Fallout") == 0:
					pPlayer = gc.getPlayer(pWinner.getOwner())
					if gc.getTeam(pPlayer.getTeam()).isAtWar(gc.getPlayer(pPlot2.getOwner()).getTeam()):
						if pPlot2.getFeatureType() == -1:
							pPlot2.setFeatureType(gc.getInfoTypeForString("FEATURE_FALLOUT"), -1)
## Fire Storm II Promotion End ##
		if (not self.__LOG_COMBAT):
			return
		if playerX and playerX and unitX and playerY:
			CvUtil.pyPrint('Player %d Civilization %s Unit %s has defeated Player %d Civilization %s Unit %s' 
				%(playerX.getID(), playerX.getCivilizationName(), unitX.getDescription(), 
				playerY.getID(), playerY.getCivilizationName(), unitY.getDescription()))

Random number has never been a cause of OOS.
CyGame().getSorenRandNum(2, "Fallout") == 0 simply gives a 50% chance.
If you do not want the 50% probability, simply remove the line and shift all those edited codes below by 1 tab back
 
Thanks Platyping, I look forward to testing this out.

Suppose I wanted that % chance to be less than 50. If I change that "2" in getSorenRandNum to a 3, does that change it to a 33% chance? And would a 4 give me a 25% chance? Or am I getting this wrong too :D
 
I am happy to report the "depleted uranium" version of Toxic Cloud/Firestorm II is working just fine :goodjob:

However, now I'm wondering if the effect of Firestorm I can be given to air units (either air bomb or air strike missions), and if so, what THAT Python would look like? (This one I'm calling "Incendiaries," a la the firebombing of Dresden :cringe: )
 
Sad to say, but onCombatResult() is not activated for Air Combats, nor Air missions.

Although there is one Section def onSelectionGroupPushMission() which sounds as performance taxing as def onUnitMove().
 
Well, taxing performance certainly isn't an option with my machines :mischief: but thanks anyway!
 
I really need to keep track of your new threads :p. I need to be reading about all your new stuff :rolleyes:
 
Settler Promotions

Features:
Settlers get promotions when built under certain conditions.
Based on these promotions, cities built by these settlers get different benefits.

 

Attachments

  • Civ4ScreenShot0013.JPG
    Civ4ScreenShot0013.JPG
    77.8 KB · Views: 672
  • Civ4ScreenShot0014.JPG
    Civ4ScreenShot0014.JPG
    78.6 KB · Views: 654
  • Civ4ScreenShot0015.JPG
    Civ4ScreenShot0015.JPG
    77.9 KB · Views: 638
  • Civ4ScreenShot0016.JPG
    Civ4ScreenShot0016.JPG
    79 KB · Views: 639
  • Civ4ScreenShot0017.JPG
    Civ4ScreenShot0017.JPG
    78.8 KB · Views: 670
  • Civ4ScreenShot0018.JPG
    Civ4ScreenShot0018.JPG
    77.2 KB · Views: 693
  • Civ4ScreenShot0019.JPG
    Civ4ScreenShot0019.JPG
    78.3 KB · Views: 603
Settler Promotions

Features:
Settlers get promotions when built under certain conditions.
Based on these promotions, cities built by these settlers get different benefits.

I'd LOVE to get these in C2C but they'd really need to be based on XP gain, as usual. In C2C, these kinds of units are Civilians and can easily be made to gain XP on building them. I'd been considering what could be done for settler promos and I think you've pretty much nailed it on the effects (I'ts a dang good start that's for sure!) But since its all python driven, I'd just like these promos pretty much as is but without the way they earn them according to your text displays. Would that be easily enough provided then?
 
Just delete all the codes on unit built.
DH will know how.
 
Oh, and BTW, all cities starts with railroads or roads already if you have the appropriate tech, looks nice though... :)
 
Top Bottom