Great General Spare Troops (Python Modcomp)

OK :) Now I will play as russia.
If I choose Stalin - every new unit will have Combat I
If I choose Peter - every new unit will have City Garrison I
If I choose Cathy - every new unit will have

Now I can set adding promotion by nation (civ) as complex. I very need possibility set adding promotion by leader.

So you mean:
For every unit built,
if leader is AAA, gives promotion AAA
if leader is BBB, gives promotion BBB
......
if leader is ZZZ, gives promotion ZZZ

This can be done, but I highly doubt it is advisable to do it in python.
For instance, if you have 50 leaders in your mod, this means for every unit built, it has to go through 50 if statements, which is definitely going to be taxing on performance.

My suggestion is add a 3rd trait for each leader, where the 3rd trait adds the promotion to the units you want.
Simple XML work then, no python involved, not taxing on performance
 
Code:
alien = CyGame().getSorenRandNum([COLOR="Red"]N[/COLOR], "Alien Help")
if alien == 0:

CyGame().getSorenRandNum chooses a random number from 0 to (N - 1).
For 50% effect, just set N to 2, so it will get either 0 or 1.

Add it before all those codes are triggered
 
Can somebody write last (full) version to the CvEventManager.py file and take here for download, please ?
thanks
It is interesant idea. Maybe write second GG attach take max 10 XP. It is better. 20 again is :mischief:

BTW you all are pythonists :) I have problem.
In game start I have set civilization XY will have promotion XYZ when unit trained.

My problem is, I want when civs have two and more leaders, ad promotion ABC with first leader and promotion XYZ with second leader. Is possible write some as in python?

Thanks for your time

Hrochland


Hello Hrochland, I have put a link for downloading CvEventManager.py file in the beginning of the thread.
 
thank you very much

@ platyping
is not possible make it for al leaders. Maybe, if you can make it - for russia with "everybody can add" possibility ?
 
So you mean, it is only meant for the 3 leaders of Russia?
That can be done, although it is still simpler to just add a 3rd trait for just those 3 leaders to add the promotions
 
By the way, Outitch, reading the new codes, it seems that when you are checking the base strength, you are only considering to move the GG to units with more or similar base strength.
In other words, when a GG artillery died, even if there are other catapults or swordsmen on the same tile, the GG will still die
 
Top Bottom