Snaitf's Great General

Let's call this specialist guy "Officer" and the great person "Great Officer". That would be more neutral.

How many Officers/Soldiers/Drill Sergeants are allowed per city? Do Barracks, Castles and such buildings provide slots?
 
The Great Apple said:
This shouldn't be too hard to do should it?

I'm going to go have a go! (Although the AI won't be able to handle it, that much I can tell you already)

I won't be able to test it myself (not at home), but I can post up the code, and one of you guys can do it for me!

EDIT: Ok! Done!

The way I've done it is quite crude, but it was the simplest and most effecive I could think of at this time of night. It SHOULD all work. I read it through 3 times for errors.

Basically, if you shove this into the same folder as the main mod, it will give a "General" promotion to any unit on the same square as the general. Default for the promotion gives +25% combat, and uses the Combat I icon.

If you like, I can make a similar script to add a small amount to units around the general.

never really thought of doing it that way, every time a unit moves, check to see if there is a GG in the stack, if so give a promotion, if not, take it away... seems so simple now... :suicide:
 
I have an idea concerning "Officers" (thats the name I prefer). As others have mentioned it would be very cool yet very easily exploited if each Officer in a City gave experience to units produced in that City much like a barraks. People would just crank out the max officers the turn the unit is being completed and remove them all a turn later.

An alternative solution is to have Officers add experience very slowly to units after they are built. I think a base rate of about 1/20 a point per turn would be a good start, as the player adds more advanced training facilites the rate of XP gain incresses. Now I dont belive it is possible to actualy give less then 1 experience because experience is stored as an Integer so instead we should simply left shift the decimal point of all the games current experience bonuses and levels by 2. So Barracks would give 400 experience rather then 4, the first promotion would be at 200 rather then 2 ect ect. Everything would remain functionaly identical but with the equivilent of 2 extra decimal places.

Experience would be handed out each turn by a simple python script firing at the end of turn, each city is checked for officers and the bonusus that affect officers. Then any units that are in the city get their exp incressed.

One other note I think the bonus that the Great General provides should be called "Leader ship" and we should find some Graphics people to make a nice Icon for it perhaps a picture of some Medals or a guy saluting. I would apply the bonus equaly to all units in the Generals plot or adjacent to it.
 
I've just realised I botched up the "General Promotion" in the addon I posted. I accidently made it so any unit could get it if they leveled up... I've updated the attachment.
 
Is it possible to have the soldier specialists increase the hammer output for military units only? Some civ traits do this, like Organized increases +50% production for Lighthouse and Courthouse.

One Officer specialist could for example increase the production of military units by 10%, while a General super specialist would increase the production by 50%.
 
Not directly, Exel, but we hope-and pray-that there might be a workaround using Python Scripting.

Yours,
Aussie_Lurker.
 
@ the great apple

i think a bonus for a nine square area is better, as a general is expected to command overall strategy. maybe, 25% for units in the stack, and 10% for those around.

i see a prob with this bit of mod... AI will definately not understand how to use the general to boost combat =(
 
Hmm, if the AI could be made to make use of the same strategies it applies to units with the Medic promotion then maybe it would make a General unit follow other units around also.
 
i would definately implement the addon, if AI could use it, but lacking that, i'll stick with snaitf's original.
 
ummm is there anyway to combine some o these mods together for use?
 
The idea of a great general really makes sense.

However, some remarks:
- What he can do sounds pretty decent already, I'm missing his effect on troops though. A general should probably have a minor effect on every unit within 1 square adjacent of his unit. This would simulate perfectly that a general 'commands' an army. Possibly: One extra promotion while a unit is in range of a general.
- I'd rather see a great general unit without any specialists. It doesn't seem to make much sense that you'd create them by using specialists.
- A more logical way would be the Civ III way in which only units with a certain amount of experience would give a chance to generate them. Possibly only after you've built the Heroic Epic.
 
Does the AI build military academies? I played with this mod and I love the idea, but I conquered France and none of the cities had a MA. And I know Napoleon had a few GGs.

Has anyone else conquered a city and found a MA in it? If not I think I'm going to drop the mod since it's such a hugely powerful building.
 
Hey Snaitf. I am trying to repay the favour of all the help you have given me, and came up with this possibility for making Great Generals do what they ought to do. Perhaps you have already tried it but, otherwise, it might be worth a shot:

Code:
def onBeginPlayerTurn(self, argsList):
		'Called at the beginning of a players turn'
		iGameTurn, iPlayer = argsList

		player = gc.getActivePlayer()
		if (player.isSpecialist(gc.getInfoTypeForString("SPECIALIST_GREAT_GENERAL "))):
			for i in range(player.getNumCities()):
				player.getCity(i).getFreeExperience(2)
		else:
			for i in range(player.getNumCities()):
				player.getCity(i).getFreeExperience(0)

What do you think, could this work?

Yours,
Aussie_Lurker.
 
While I am at it, it may be worth looking at THIS string for Python:

Code:
getMilitaryProductionModifier()

and this

Code:
getDefenseModifier()
or maybe even this?
Code:
getCityDefensePercent()

Hope this helps.
 
I think you mean:

Code:
 ## in onUnitBuilt ##

if gc.getUnitInfo(iUnit).getSpecialUnitType == -1: #Make sure this unit can use exp
	GeneralExperience = pCity.getSpecialistCount(gc.getInfoTypeForString("SPECIALIST_GREAT_GENERAL"))
	gc.getUnitInfo(iUnit).changeExperience(GeneralExperience, 100) #The second number might work with -1 instead.  I don't feel like testing this.
 
Ahhh, yes, I see what you are getting at Mylon. My script is looking at the start of the turn wheras-as you rightly point out, it should be looking at when a unit is built. I don't see much wrong with my script beyond this. Either way, its the final string which I feel is important-the one which may, or may not, cause these specialists to add experience to units. I am considering testing both tonight-just to give me a break from my 'Slave Market' headaches ;)! I will report back later on!

Yours,
Aussie_Lurker.
 
Draax said:
Does the AI build military academies? I played with this mod and I love the idea, but I conquered France and none of the cities had a MA. And I know Napoleon had a few GGs.

Has anyone else conquered a city and found a MA in it? If not I think I'm going to drop the mod since it's such a hugely powerful building.

Almost all buildings are destroyed when you take over a city...
 
@Snaitf. I have tried your mod in the context of my Slavery/Serfdom mod, and it seems to be behaving VERY oddly. Although the icon for the soldier is there, I simply can't use it-even after building a barracks. In fact, mousing over the icon gives me NO info on it. It also seems to be having a negative impact on the operation of my original slavery mod. I think I might try building the whole thing from the ground up, using this mod as inspiration-if you don't mind :)!

Anyway, I checked that script out that I mentioned above and-though I personally haven't had a chance to see if it works, I DID find out that isSpecialist does NOT work. However, after looking up the Python tute, I have come up with a possibility for making soldiers work-perhaps you can try it out for me? I would, but won't get another chance to work on the game for another 48 hours. Anyway, try this script in your mod and see what happens!

Code:
class CvCustomEventManager(CvEventManager.CvEventManager):
	def __init__(self):
		# initialize base class
		self.parent = CvEventManager.CvEventManager
		self.parent.__init__(self)

        def onBeginPlayerTurn(self, argsList):
                'Called at the beginning of a players turn'
                iGameTurn, iPlayer = argsList

                player = gc.getActivePlayer()
                if (player.isSpecialistValid(gc.getInfoTypeForString("SPECIALIST_SOLDIER"))):
                        for i in range(player.getNumCities()):
                                player.getCity(i).getCityDefensePercent(5)
                else:
                        for i in range(player.getNumCities()):
                                player.getCity(i).getCityDefensePercent(0)

                player = gc.getActivePlayer()
                if (player.isSpecialistValid(gc.getInfoTypeForString("SPECIALIST_SOLDIER"))):
                        for i in range(player.getNumCities()):
                                player.getCity(i).getMilitaryProductionModifier(5)
                else:
                        for i in range(player.getNumCities()):
                                player.getCity(i).getMilitaryProductionModifier(0)

One thing I can say about the above code is that it produces NO error in the PythonErr logs.
Good luck and I look forward to hearing if it works.

Yours,
Aussie_Lurker.
 
Aussie_Lurker said:
Code:
class CvCustomEventManager(CvEventManager.CvEventManager):
	def __init__(self):
		# initialize base class
		self.parent = CvEventManager.CvEventManager
		self.parent.__init__(self)

        def onBeginPlayerTurn(self, argsList):
                'Called at the beginning of a players turn'
                iGameTurn, iPlayer = argsList

                player = gc.getActivePlayer()
                if (player.isSpecialistValid(gc.getInfoTypeForString("SPECIALIST_SOLDIER"))):
                        for i in range(player.getNumCities()):
                                player.getCity(i).getCityDefensePercent(5)
                else:
                        for i in range(player.getNumCities()):
                                player.getCity(i).getCityDefensePercent(0)

                player = gc.getActivePlayer()
                if (player.isSpecialistValid(gc.getInfoTypeForString("SPECIALIST_SOLDIER"))):
                        for i in range(player.getNumCities()):
                                player.getCity(i).getMilitaryProductionModifier(5)
                else:
                        for i in range(player.getNumCities()):
                                player.getCity(i).getMilitaryProductionModifier(0)
Without actually having tested this (away from home - don't have game), I'm pretty certain it won't work.

As a general rule with python commands used in Civ, anything with a "get" prefix returns whatever the value currently is, and anything with a "set" prefix changes the value.

If you look at the API, you can see that getMilitaryProductionModifier() returns an integer value, which this code doesn't do anything with.

Also, isSpecialistValid() doesn't seem to be a valid function for a player - once again, checking the API. Thinking about it, it doesn't make sence either - players don't have specialists, cities do.

Looking at the API I can see no clear way of changing the defence modifier of a city, though I may be wrong.
 
I can assure you that I got isSpecialistValid from the API-after looking for an appropriate string in Locutus' reference. I agree though that it should be pCity and NOT pPlayer and-equally-that it should be set and not get. Again I wasn't thinking (please remember that I am a total novice when it comes to python, but I THINK I am beginning to the get the hang of it).

Yours,
Aussie_Lurker.
 
Back
Top Bottom