1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Snaitf's Great General

Discussion in 'Civ4 - Mod Components' started by Snaitf, Dec 3, 2005.

  1. Optimizer

    Optimizer Sthlm, SWE

    Joined:
    Dec 29, 2001
    Messages:
    692
    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?
     
  2. Snaitf

    Snaitf Chieftain

    Joined:
    Nov 28, 2005
    Messages:
    76
    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:
     
  3. Impaler[WrG]

    Impaler[WrG] Civ4:Col UI programmer

    Joined:
    Dec 5, 2005
    Messages:
    1,750
    Location:
    Vallejo, California
    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.
     
  4. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    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.
     
  5. Exel

    Exel Prince

    Joined:
    Nov 25, 2001
    Messages:
    440
    Location:
    Finland
    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%.
     
  6. Aussie_Lurker

    Aussie_Lurker Deity

    Joined:
    Jul 21, 2003
    Messages:
    7,744
    Location:
    Adelaide, South Australia
    Not directly, Exel, but we hope-and pray-that there might be a workaround using Python Scripting.

    Yours,
    Aussie_Lurker.
     
  7. hIdDeN_eViL

    hIdDeN_eViL {кοтоя дѕѕαѕѕїй}²

    Joined:
    Sep 18, 2004
    Messages:
    458
    Location:
    sydney,down under
    @ 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 =(
     
  8. CyberChrist

    CyberChrist You caught my attention

    Joined:
    Dec 6, 2001
    Messages:
    1,424
    Location:
    The Matrix
    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.
     
  9. hIdDeN_eViL

    hIdDeN_eViL {кοтоя дѕѕαѕѕїй}²

    Joined:
    Sep 18, 2004
    Messages:
    458
    Location:
    sydney,down under
    i would definately implement the addon, if AI could use it, but lacking that, i'll stick with snaitf's original.
     
  10. Dusty4prez

    Dusty4prez Krazy Kanuck

    Joined:
    Jan 27, 2004
    Messages:
    413
    ummm is there anyway to combine some o these mods together for use?
     
  11. Quantum7

    Quantum7 Warlord

    Joined:
    Nov 3, 2005
    Messages:
    188
    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.
     
  12. Draax

    Draax Chieftain

    Joined:
    Nov 9, 2005
    Messages:
    60
    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.
     
  13. Aussie_Lurker

    Aussie_Lurker Deity

    Joined:
    Jul 21, 2003
    Messages:
    7,744
    Location:
    Adelaide, South Australia
    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.
     
  14. Aussie_Lurker

    Aussie_Lurker Deity

    Joined:
    Jul 21, 2003
    Messages:
    7,744
    Location:
    Adelaide, South Australia
    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.
     
  15. Mylon

    Mylon Amateur Game Designer

    Joined:
    Nov 4, 2005
    Messages:
    1,013
    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.
     
  16. Aussie_Lurker

    Aussie_Lurker Deity

    Joined:
    Jul 21, 2003
    Messages:
    7,744
    Location:
    Adelaide, South Australia
    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.
     
  17. Snaitf

    Snaitf Chieftain

    Joined:
    Nov 28, 2005
    Messages:
    76
    Almost all buildings are destroyed when you take over a city...
     
  18. Aussie_Lurker

    Aussie_Lurker Deity

    Joined:
    Jul 21, 2003
    Messages:
    7,744
    Location:
    Adelaide, South Australia
    @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.
     
  19. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    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.
     
  20. Aussie_Lurker

    Aussie_Lurker Deity

    Joined:
    Jul 21, 2003
    Messages:
    7,744
    Location:
    Adelaide, South Australia
    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.
     

Share This Page