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

Leadership Reformation

Discussion in 'Civ5 - Creation & Customization' started by Enginseer, Dec 9, 2015.

  1. Nunuyz

    Nunuyz Chieftain

    Joined:
    Aug 23, 2015
    Messages:
    34
    Location:
    California
    Very interesting idea - I usually find myself storing surplus GGs in cities because I have nothing to do with them, so this could give me something to consider when managing GGs besides using them to steal for its material and/or strategic value.

    I assume that this would be fully compatible with the entirety of the CPP?
     
  2. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,215
    Gender:
    Male
    Location:
    Somewhere in California
    Of course.
     
  3. Rob (R8XFT)

    Rob (R8XFT) Ancient Briton Super Moderator

    Joined:
    Aug 11, 2002
    Messages:
    10,783
    Location:
    Leeds (UK)
    Moderator Action: Moved to main Creation and Customisation forum at the request of Enginseer
     
  4. WileyNg

    WileyNg Chieftain

    Joined:
    Aug 17, 2013
    Messages:
    595
    Location:
    Hong Kong
    Has this implemented in the mod yet?

    All units? not nearby units only? Does it affect globally? I fear it might be out of balanced
     
  5. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,215
    Gender:
    Male
    Location:
    Somewhere in California
    Yes, testing atm.


    Well, basically all generals that are following toward an ideology will affect nearby units, so essentially ALL units.
     
  6. WileyNg

    WileyNg Chieftain

    Joined:
    Aug 17, 2013
    Messages:
    595
    Location:
    Hong Kong
    So when the player attains a ideology, all GGs automatically gain that particular promotion?
     
  7. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,215
    Gender:
    Male
    Location:
    Somewhere in California
    Correct and when a civilization switches to another ideology, the GGs will lose their old ideology promotion and gain new ones.
     
  8. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,215
    Gender:
    Male
    Location:
    Somewhere in California
  9. WileyNg

    WileyNg Chieftain

    Joined:
    Aug 17, 2013
    Messages:
    595
    Location:
    Hong Kong
    Push to let people know this great mod. Haven't had time to play another game but i am very excited to see the new features!!
     
  10. i like turtles

    i like turtles Chieftain

    Joined:
    Feb 17, 2015
    Messages:
    42
    I cant find the mod in the steam workshop. Did you delete it?
     
  11. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,215
    Gender:
    Male
    Location:
    Somewhere in California
    I just realized a major error(enemy generals were giving promotions to their enemies!) on my LUA part when I was adapting the code from LeeS's Rome Scipio, and I decidedly have to fix the problem.

    Most likely, the mod will be postponed until a month or so when I have enough free time to work on it. I'm only one man.
     
  12. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,233
    Location:
    Illinois, USA
    I made substantial changes to files GGTraits.lua and GeneralPromotion.lua

    Some notes on some of the changes (I had to break this into 2 posts because of single-post-length restrictions):
    1. Code of GGTraits.lua where I made major changes:
      Spoiler :
      Code:
      ---------------------------------------------------------------------------------------------
      --Debugging Print-Out Function
      ---------------------------------------------------------------------------------------------
      DebugPrintMessages = true	--set this to false to eliminate printing to the lua log file
      function PrintDebug(sMessage)
      	if DebugPrintMessages then
      		print(sMessage)
      	end
      end
      
      ---------------------------------------------------------------------------------------------
      --Determine if CP is being used and set variable flag accordingly
      ---------------------------------------------------------------------------------------------
      
      isUsingCP = false
      --This checks for the Community Patch!--
      for _, mod in pairs(Modding.GetActivatedMods()) do
      	if (mod.ID == "d1b6328c-ff44-4b0d-aad7-c657f83610cd") then
      		isUsingCP = true
      		PrintDebug("Community Patch is installed!")
      	end
      	if isUsingCP == false then
      		PrintDebug("Community Patch is not installed!")
      	end
      end
      
      ---------------------------------------------------------------------------------------------
      --Promotions Data Table Constructions
      ---------------------------------------------------------------------------------------------
      
      GeneralPromotions_GG = {}
      GeneralTraits = {}
      tGeneralToUnitCorrespondances = {}
      tUnitToGeneralCorrespondances = {}
      tLevel1GeneralshipPromotions = {}
      tLevel2GeneralshipPromotions = {}
      tLevel3GeneralshipPromotions = {}
      tCombatUnitMasterPromotionList = {}
      tUnitToGeneralCorrespondancesIdeology = {}
      tGeneralToUnitCorrespondancesIdeology = {}
      
      
      GeneralPromotions_GG.Homeguard = { [1] = { General=GameInfoTypes.PROMOTION_INSPIRED_HOMEGUARD_GG, Combat=GameInfoTypes.PROMOTION_INSPIRED_HOMEGUARD, Level=1 },
      	[2] = { General=GameInfoTypes.PROMOTION_INSPIRED_HOMEGUARD_GG2, Combat=GameInfoTypes.PROMOTION_INSPIRED_HOMEGUARD_2, Level=2 },
      	[3] = { General=GameInfoTypes.PROMOTION_INSPIRED_HOMEGUARD_GG3, Combat=GameInfoTypes.PROMOTION_INSPIRED_HOMEGUARD_3, Level=3 } }
      GeneralPromotions_GG.Nationalism = { [1] = { General=GameInfoTypes.PROMOTION_INSPIRED_NATIONALISM_GG, Combat=GameInfoTypes.PROMOTION_INSPIRED_NATIONALISM, Level=1 },
      	[2] = { General=GameInfoTypes.PROMOTION_INSPIRED_NATIONALISM_GG2, Combat=GameInfoTypes.PROMOTION_INSPIRED_NATIONALISM_2, Level=2 },
      	[3] = { General=GameInfoTypes.PROMOTION_INSPIRED_NATIONALISM_GG3, Combat=GameInfoTypes.PROMOTION_INSPIRED_NATIONALISM_3, Level=3 } }
      GeneralPromotions_GG.Sufficient = { [1] = { General=GameInfoTypes.PROMOTION_SUFFICIENT_GG, Combat=GameInfoTypes.PROMOTION_SUFFICIENT, Level=1 },
      	[2] = { General=GameInfoTypes.PROMOTION_SUFFICIENT_GG2, Combat=GameInfoTypes.PROMOTION_SUFFICIENT2, Level=2 },
      	[3] = { General=GameInfoTypes.PROMOTION_SUFFICIENT_GG3, Combat=GameInfoTypes.PROMOTION_SUFFICIENT3, Level=3 } }
      GeneralPromotions_GG.Foreign = { [1] = { General=GameInfoTypes.PROMOTION_FOREIGN_GG, Combat=GameInfoTypes.PROMOTION_FOREIGN, Level=1 },
      	[2] = { General=GameInfoTypes.PROMOTION_FOREIGN_GG2, Combat=GameInfoTypes.PROMOTION_FOREIGN2, Level=2 },
      	[3] = { General=GameInfoTypes.PROMOTION_FOREIGN_GG3, Combat=GameInfoTypes.PROMOTION_FOREIGN3, Level=3 } }
      GeneralPromotions_GG.Commando = { [1] = { General=GameInfoTypes.PROMOTION_COMMANDO_GG, Combat=GameInfoTypes.PROMOTION_COMMANDO, Level=1 },
      	[2] = { General=GameInfoTypes.PROMOTION_COMMANDO_GG2, Combat=GameInfoTypes.PROMOTION_COMMANDO2, Level=2 },
      	[3] = { General=GameInfoTypes.PROMOTION_COMMANDO_GG3, Combat=GameInfoTypes.PROMOTION_COMMANDO3, Level=3 } }
      GeneralPromotions_GG.LocalIntelligence = { [1] = { General=GameInfoTypes.PROMOTION_LOCAL_INTELLIGENCE_GG, Combat=GameInfoTypes.PROMOTION_LOCAL_INTELLIGENCE, Level=1 },
      	[2] = { General=GameInfoTypes.PROMOTION_LOCAL_INTELLIGENCE_GG2, Combat=GameInfoTypes.PROMOTION_LOCAL_INTELLIGENCE2, Level=2 },
      	[3] = { General=GameInfoTypes.PROMOTION_LOCAL_INTELLIGENCE_GG3, Combat=GameInfoTypes.PROMOTION_LOCAL_INTELLIGENCE3, Level=3 } }
      GeneralPromotions_GG.Cowardly = { [1] = { General=GameInfoTypes.PROMOTION_COWARDLY_GG, Combat=GameInfoTypes.PROMOTION_COWARDLY, Level=1 },
      	[2] = { General=GameInfoTypes.PROMOTION_COWARDLY_GG2, Combat=GameInfoTypes.PROMOTION_COWARDLY2, Level=2 },
      	[3] = { General=GameInfoTypes.PROMOTION_COWARDLY_GG3, Combat=GameInfoTypes.PROMOTION_COWARDLY3, Level=3 } }
      GeneralPromotions_GG.Forced = { [1] = { General=GameInfoTypes.PROMOTION_FORCED_GG, Combat=GameInfoTypes.PROMOTION_FORCED, Level=1 },
      	[2] = { General=GameInfoTypes.PROMOTION_FORCED_GG2, Combat=GameInfoTypes.PROMOTION_FORCED2, Level=2 },
      	[3] = { General=GameInfoTypes.PROMOTION_FORCED_GG3, Combat=GameInfoTypes.PROMOTION_FORCED3, Level=3 } }
      GeneralPromotions_GG.Butcher = { [1] = { General=GameInfoTypes.PROMOTION_BUTCHER_GG, Combat=GameInfoTypes.PROMOTION_BUTCHER, Level=1 },
      	[2] = { General=GameInfoTypes.PROMOTION_BUTCHER_GG2, Combat=GameInfoTypes.PROMOTION_BUTCHER2, Level=2 },
      	[3] = { General=GameInfoTypes.PROMOTION_BUTCHER_GG3, Combat=GameInfoTypes.PROMOTION_BUTCHER3 } }
      GeneralPromotions_GG.Skirmish = { [1] = { General=GameInfoTypes.PROMOTION_SKIRMISH_GG, Combat=GameInfoTypes.PROMOTION_SKIRMISH, Level=1 },
      	[2] = { General=GameInfoTypes.PROMOTION_SKIRMISH_GG2, Combat=GameInfoTypes.PROMOTION_SKIRMISH2, Level=2 },
      	[3] = { General=GameInfoTypes.PROMOTION_SKIRMISH_GG3, Combat=GameInfoTypes.PROMOTION_SKIRMISH3, Level=3 } }
      GeneralPromotions_GG.Strict = { [1] = { General=GameInfoTypes.PROMOTION_STRICT_GG, Combat=GameInfoTypes.PROMOTION_STRICT, Level=1 },
      	[2] = { General=GameInfoTypes.PROMOTION_STRICT_GG2, Combat=GameInfoTypes.PROMOTION_STRICT2, Level=2 },
      	[3] = { General=GameInfoTypes.PROMOTION_STRICT_GG3, Combat=GameInfoTypes.PROMOTION_STRICT3, Level=3 } }
      
      if isUsingCP then
      	GeneralPromotions_GG.Reeducation = { [1] = { General=GameInfoTypes.PROMOTION_REEDUCATION_GG, Combat=GameInfoTypes.PROMOTION_REEDUCATION, Level=1 },
      		[2] = { General=GameInfoTypes.PROMOTION_REEDUCATION_GG2, Combat=GameInfoTypes.PROMOTION_REEDUCATION2, Level=2 },
      		[3] = { General=GameInfoTypes.PROMOTION_REEDUCATION_GG3, Combat=GameInfoTypes.PROMOTION_REEDUCATION3, Level=3 } }
      	GeneralPromotions_GG.Pious = { [1] = { General=GameInfoTypes.PROMOTION_PIOUS_GG, Combat=GameInfoTypes.PROMOTION_PIOUS, Level=1 },
      		[2] = { General=GameInfoTypes.PROMOTION_PIOUS_GG2, Combat=GameInfoTypes.PROMOTION_PIOUS2, Level=2 },
      		[3] = { General=GameInfoTypes.PROMOTION_PIOUS_GG3, Combat=GameInfoTypes.PROMOTION_PIOUS3, Level=3 } }
      	GeneralPromotions_GG.Scavenger = { [1] = { General=GameInfoTypes.PROMOTION_SCAVENGER_GG, Combat=GameInfoTypes.PROMOTION_SCAVENGER, Level=1 },
      		[2] = { General=GameInfoTypes.PROMOTION_SCAVENGER_GG2, Combat=GameInfoTypes.PROMOTION_SCAVENGER2, Level=2 },
      		[3] = { General=GameInfoTypes.PROMOTION_SCAVENGER_GG3, Combat=GameInfoTypes.PROMOTION_SCAVENGER3, Level=3 } }
      	GeneralTraits.Freedom = GameInfoTypes.PROMOTION_MUHFREEDOM
      	GeneralTraits.Order =  GameInfoTypes.PROMOTION_MUHORDER
      	GeneralTraits.Autocracy = GameInfoTypes.PROMOTION_MUHAUTOCRACY
      	--Unit Promotion to G-General Promotion Correspondance
      	tUnitToGeneralCorrespondancesIdeology[GameInfoTypes.PROMOTION_MUHFREEDOM] = GameInfoTypes.PROMOTION_MUHFREEDOM_GG
      	tUnitToGeneralCorrespondancesIdeology[GameInfoTypes.PROMOTION_MUHORDER] = GameInfoTypes.PROMOTION_MUHORDER_GG
      	tUnitToGeneralCorrespondancesIdeology[GameInfoTypes.PROMOTION_MUHAUTOCRACY] = GameInfoTypes.PROMOTION_MUHAUTOCRACY_GG
      	--G-General Promotion to Unit Promotion Correspondance
      	tGeneralToUnitCorrespondancesIdeology[GameInfoTypes.PROMOTION_MUHFREEDOM_GG] = GameInfoTypes.PROMOTION_MUHFREEDOM
      	tGeneralToUnitCorrespondancesIdeology[GameInfoTypes.PROMOTION_MUHORDER_GG] = GameInfoTypes.PROMOTION_MUHORDER
      	tGeneralToUnitCorrespondancesIdeology[GameInfoTypes.PROMOTION_MUHAUTOCRACY_GG] = GameInfoTypes.PROMOTION_MUHAUTOCRACY
      end
      
      for k,v in pairs(GeneralPromotions_GG) do
      	local TempTable = {}
      	TempTable = v
      	local keyname = k
      	PrintDebug("key " .. keyname .. " has value of " .. tostring(TempTable))
      	for Level,Data in pairs(TempTable) do
      		PrintDebug("key " .. Level .. " has value of " .. tostring(Data))
      		tUnitToGeneralCorrespondances[Data.Combat] = Data.General
      		tGeneralToUnitCorrespondances[Data.General] = Data.Combat
      		table.insert(tCombatUnitMasterPromotionList, Data.Combat)
      		if Level == 1 then
      			tLevel1GeneralshipPromotions[keyname] = Data.General
      		elseif Level == 2 then
      			tLevel2GeneralshipPromotions[keyname] = Data.General
      		elseif Level == 3 then
      			tLevel3GeneralshipPromotions[keyname] = Data.General
      		end
      
      	end
      end
      • This section allows you to turn on or off printing to the lua.log by changing variable DebugPrintMessages from true to false, or vice versa:
        Code:
        ---------------------------------------------------------------------------------------------
        --Debugging Print-Out Function
        ---------------------------------------------------------------------------------------------
        DebugPrintMessages = true	--set this to false to eliminate printing to the lua log file
        function PrintDebug(sMessage)
        	if DebugPrintMessages then
        		print(sMessage)
        	end
        end
        Simply use
        Code:
        PrintDebug("Something")
        instead of
        Code:
        print("Something")
        wherever you want to make a print statement to the lua.log for debugging purposes.
      • I moved the check for the CP mod into the GGTraits.lua
      • I restructured the lua table GeneralPromotions_GG to be a master data-table of all the leadership types, their levels, and the Great General and Combat Unit promotions that are associated with each other. Snippet of that code:
        Code:
        GeneralPromotions_GG.Homeguard = { [1] = { General=GameInfoTypes.PROMOTION_INSPIRED_HOMEGUARD_GG, Combat=GameInfoTypes.PROMOTION_INSPIRED_HOMEGUARD, Level=1 },
        	[2] = { General=GameInfoTypes.PROMOTION_INSPIRED_HOMEGUARD_GG2, Combat=GameInfoTypes.PROMOTION_INSPIRED_HOMEGUARD_2, Level=2 },
        	[3] = { General=GameInfoTypes.PROMOTION_INSPIRED_HOMEGUARD_GG3, Combat=GameInfoTypes.PROMOTION_INSPIRED_HOMEGUARD_3, Level=3 } }
        GeneralPromotions_GG.Nationalism = { [1] = { General=GameInfoTypes.PROMOTION_INSPIRED_NATIONALISM_GG, Combat=GameInfoTypes.PROMOTION_INSPIRED_NATIONALISM, Level=1 },
        	[2] = { General=GameInfoTypes.PROMOTION_INSPIRED_NATIONALISM_GG2, Combat=GameInfoTypes.PROMOTION_INSPIRED_NATIONALISM_2, Level=2 },
        	[3] = { General=GameInfoTypes.PROMOTION_INSPIRED_NATIONALISM_GG3, Combat=GameInfoTypes.PROMOTION_INSPIRED_NATIONALISM_3, Level=3 } }
      • This section takes the 'master' data mentioned above, and places the required pieces of data in other tables that make it easier for the main code to reference and use:
        Code:
        for k,v in pairs(GeneralPromotions_GG) do
        	local TempTable = {}
        	TempTable = v
        	local keyname = k
        	PrintDebug("key " .. keyname .. " has value of " .. tostring(TempTable))
        	for Level,Data in pairs(TempTable) do
        		PrintDebug("key " .. Level .. " has value of " .. tostring(Data))
        		tUnitToGeneralCorrespondances[Data.Combat] = Data.General
        		tGeneralToUnitCorrespondances[Data.General] = Data.Combat
        		table.insert(tCombatUnitMasterPromotionList, Data.Combat)
        		if Level == 1 then
        			tLevel1GeneralshipPromotions[keyname] = Data.General
        		elseif Level == 2 then
        			tLevel2GeneralshipPromotions[keyname] = Data.General
        		elseif Level == 3 then
        			tLevel3GeneralshipPromotions[keyname] = Data.General
        		end
        
        	end
        end
    2. None of this code is currently being used:
      Spoiler :
      Code:
      --Homeguard--
      function Set1GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "HOMEGUARD3" then
      		pUnit:SetHasPromotion(GeneralPromotions.Homeguard3, true)
      	elseif iGeneralType == "HOMEGUARD2" then
      		pUnit:SetHasPromotion(GeneralPromotions.Homeguard2, true)
      	elseif iGeneralType == "HOMEGUARD" then
      		pUnit:SetHasPromotion(GeneralPromotions.Homeguard, true)
      	end
      end
      function Up1GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.Homeguard2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Homeguard3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.Homeguard.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Homeguard2.General, true)
      	end
      end
      
      --Nationalism--
      function Set2GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "NATIONALISM3" then
      		pUnit:SetHasPromotion(GeneralPromotions.Nationalism3, true)
      	elseif iGeneralType == "NATIONALISM2" then
      		pUnit:SetHasPromotion(GeneralPromotions.Nationalism2, true)
      	elseif iGeneralType == "NATIONALISM" then
      		pUnit:SetHasPromotion(GeneralPromotions.Nationalism, true)
      	end
      end
      function Up2GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.Nationalism2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Nationalism3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.Nationalism.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Nationalism2.General, true)
      	end
      end
      
      --Sufficient--
      function Set9GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "SUFFICIENT3" then
      		pUnit:SetHasPromotion(GeneralPromotions.Sufficient3, true)
      	elseif iGeneralType == "SUFFICIENT2" then
      		pUnit:SetHasPromotion(GeneralPromotions.Sufficient2, true)
      	elseif iGeneralType == "SUFFICIENT" then
      		pUnit:SetHasPromotion(GeneralPromotions.Sufficient, true)
      	end
      end
      function Up9GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.Sufficient2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Sufficient3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.Sufficient.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Sufficient2.General, true)
      	end
      end
      
      --Foreign Recruitment--
      function Set11GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "FOREIGN3" then
      		pUnit:SetHasPromotion(GeneralPromotions.Foreign3, true)
      	elseif iGeneralType == "FOREIGN2" then
      		pUnit:SetHasPromotion(GeneralPromotions.Foreign2, true)
      	elseif iGeneralType == "FOREIGN" then
      		pUnit:SetHasPromotion(GeneralPromotions.Foreign, true)
      	end
      end
      function Up11GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.Foreign2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Foreign3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.Foreign.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Foreign2.General, true)
      	end
      end
      
      --Commando--
      function Set10GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "COMMANDO3" then
      		pUnit:SetHasPromotion(GeneralPromotions.Commando3, true)
      	elseif iGeneralType == "COMMANDO2" then
      		pUnit:SetHasPromotion(GeneralPromotions.Commando2, true)
      	elseif iGeneralType == "COMMANDO" then
      		pUnit:SetHasPromotion(GeneralPromotions.Commando, true)
      	end
      end
      function Up10GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.Commando2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Commando3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.Commando.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Commando2.General, true)
      	end
      end
      
      --Local Intelligence--
      function Set3GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "LOCAL_INTELLIGENCE3" then
      		pUnit:SetHasPromotion(GeneralPromotions.LocalIntelligence3, true)
      	elseif iGeneralType == "LOCAL_INTELLIGENCE2" then
      		pUnit:SetHasPromotion(GeneralPromotions.LocalIntelligence2, true)
      	elseif iGeneralType == "LOCAL_INTELLIGENCE" then
      		pUnit:SetHasPromotion(GeneralPromotions.LocalIntelligence, true)
      	end
      end
      function Up3GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.LocalIntelligence2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.LocalIntelligence3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.LocalIntelligence.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.LocalIntelligence2.General, true)
      	end
      end
      
      --Cowardly--
      function Set4GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "COWARDLY3" then
      		pUnit:SetHasPromotion(GeneralPromotions.Cowardly3, true)
      	elseif iGeneralType == "COWARDLY2" then
      		pUnit:SetHasPromotion(GeneralPromotions.Cowardly2, true)
      	elseif iGeneralType == "COWARDLY" then
      		pUnit:SetHasPromotion(GeneralPromotions.Cowardly, true)
      	end
      end
      function Up4GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.Cowardly2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Cowardly3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.Cowardly.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Cowardly2.General, true)
      	end
      end
      
      --Forced March--
      function Set12GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "FORCED3" then
      		pUnit:SetHasPromotion(GeneralPromotions.Forced3, true)
      	elseif iGeneralType == "FORCED2" then
      		pUnit:SetHasPromotion(GeneralPromotions.Forced2, true)
      	elseif iGeneralType == "FORCED" then
      		pUnit:SetHasPromotion(GeneralPromotions.Forced, true)
      	end
      end
      function Up12GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.Forced2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Forced3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.Forced.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Forced2.General, true)
      	end
      end
      
      --Butcher--
      function Set5GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "BUTCHER3" then
      		pUnit:SetHasPromotion(GeneralPromotions.Butcher3, true)
      	elseif iGeneralType == "BUTCHER2" then
      		pUnit:SetHasPromotion(GeneralPromotions.Butcher2, true)
      	elseif iGeneralType == "BUTCHER" then
      		pUnit:SetHasPromotion(GeneralPromotions.Butcher, true)
      	end
      end
      function Up5GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.Butcher2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Butcher3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.Butcher.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Butcher2.General, true)
      	end
      end
      
      --Reeducation--
      function Set6GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "REEDUCATION3" then
      		pUnit:SetHasPromotion(GeneralPromotions.Reeducation3, true)
      	elseif iGeneralType == "REEDUCATION2" then
      		pUnit:SetHasPromotion(GeneralPromotions.Reeducation2, true)
      	elseif iGeneralType == "REEDUCATION" then
      		pUnit:SetHasPromotion(GeneralPromotions.Reeducation, true)
      	end
      end
      function Up6GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.Reeducation2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Reeducation3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.Reeducation.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Reeducation2.General, true)
      	end
      end
      
      --Skirmish--
      function Set13GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "SKIRMISH3" then
      		pUnit:SetHasPromotion(GeneralPromotions.Skirmish3, true)
      	elseif iGeneralType == "SKIRMISH2" then
      		pUnit:SetHasPromotion(GeneralPromotions.Skirmish2, true)
      	elseif iGeneralType == "SKIRMISH" then
      		pUnit:SetHasPromotion(GeneralPromotions.Skirmish, true)
      	end
      end
      function Up13GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.Skirmish2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Skirmish3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.Skirmish.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Skirmish2.General, true)
      	end
      end
      
      --Strict--
      function Set14GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "STRICT3" then
      		pUnit:SetHasPromotion(GeneralPromotions.Strict3, true)
      	elseif iGeneralType == "STRICT2" then
      		pUnit:SetHasPromotion(GeneralPromotions.Strict2, true)
      	elseif iGeneralType == "STRICT" then
      		pUnit:SetHasPromotion(GeneralPromotions.Strict, true)
      	end
      end
      function Up14GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.Strict2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Strict3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.Strict.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Strict2.General, true)
      	end
      end
      
      --Pious--
      function Set7GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "PIOUS3" then
      		pUnit:SetHasPromotion(GeneralPromotions.Pious3, true)
      	elseif iGeneralType == "PIOUS2" then
      		pUnit:SetHasPromotion(GeneralPromotions.Pious2, true)
      	elseif iGeneralType == "PIOUS" then
      		pUnit:SetHasPromotion(GeneralPromotions.Pious, true)
      	end
      end
      function Up7GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.Pious2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Pious3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.Pious.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Pious2.General, true)
      	end
      end
      
      --Scavenger--
      function Set8GeneralEffect(pUnit, iGeneralType)
      	if iGeneralType == "SCAVENGER3" then
      		pUnit:SetHasPromotion(GeneralPromotions.Scavenger3, true)
      	elseif iGeneralType == "SCAVENGER2" then
      		pUnit:SetHasPromotion(GeneralPromotions.Scavenger2, true)
      	elseif iGeneralType == "SCAVENGER" then
      		pUnit:SetHasPromotion(GeneralPromotions.Scavenger, true)
      	end
      end
      function Up8GeneralEffect(pUnit)
      	if (pUnit:GetExperience() >= Expneeded3 and pUnit:IsHasPromotion(GeneralPromotions_GG.Scavenger2.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Scavenger3.General, true)
      	elseif (pUnit:GetExperience() >= Expneeded2 and pUnit:IsHasPromotion(GeneralPromotions_GG.Scavenger.General)) then
      		pUnit:SetHasPromotion(GeneralPromotions_GG.Scavenger2.General, true)
      	end
      end
    zipped copy of the altered mod will be included in 2nd post
     
  13. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,233
    Location:
    Illinois, USA
    1. Major changes made to GeneralPromotion.lua:
      • To make sure the Great General's 'trait' is not re-written on saved game reload:
        Code:
        --returns true/false as to whether the Greeat General already has AT LEAST ONE of the basic promotions a Great General can be given
        function GreatGeneralHasAlreadyRecievedBasicPromotion(pUnit)
        	for k,v in pairs(tLevel1GeneralshipPromotions) do
        		if pUnit:IsHasPromotion(v) then
        			return true
        		end
        	end
        	return pUnit:IsHasPromotion(GameInfoTypes.PROMOTION_NOTHING)
        end
        This function is called from the Unit Created function GeneralSpawned
      • Function GeneralSpawned:
        Code:
        function GeneralSpawned(playerID, unitID, hexVec, unitType, cultureType, civID, primaryColor, secondaryColor, unitFlagIndex, fogState, selected, military, notInvisible)
        	local pPlayer = Players[playerID]
        	local pUnit = pPlayer:GetUnitByID(unitID)
        	if (pPlayer == nil or pUnit == nil or pUnit:IsDead()) then
        		return
        	end
        	if pUnit:GetUnitClassType() ~= GameInfoTypes.UNITCLASS_GREAT_GENERAL then
        		return 
        	end 
        	PrintDebug("GeneralSpawned function fired for a great general")
        	if GreatGeneralHasAlreadyRecievedBasicPromotion(pUnit) then
        		PrintDebug("The Generalship selection was not applied because the Great General already had one of the basic promotions from the list")
        		return
        	else
        		PrintDebug("The Great General does not already have one of the basic GG promotions or any of the ideology promotions: The Generalship selection will be applied")
        		GeneralshipChoices = { tLevel1GeneralshipPromotions.Homeguard, tLevel1GeneralshipPromotions.Nationalism, tLevel1GeneralshipPromotions.LocalIntelligence,
        			tLevel1GeneralshipPromotions.Cowardly, tLevel1GeneralshipPromotions.Butcher, tLevel1GeneralshipPromotions.Sufficient, tLevel1GeneralshipPromotions.Commando,
        			tLevel1GeneralshipPromotions.Foreign, tLevel1GeneralshipPromotions.Forced, tLevel1GeneralshipPromotions.Strict, tLevel1GeneralshipPromotions.Skirmish,
        			GameInfoTypes.PROMOTION_NOTHING, GameInfoTypes.PROMOTION_NOTHING, GameInfoTypes.PROMOTION_NOTHING, GameInfoTypes.PROMOTION_NOTHING, GameInfoTypes.PROMOTION_NOTHING,
        			GameInfoTypes.PROMOTION_NOTHING, GameInfoTypes.PROMOTION_NOTHING, GameInfoTypes.PROMOTION_NOTHING, GameInfoTypes.PROMOTION_NOTHING }
        		if isUsingCP then
        			GeneralshipChoices = {tLevel1GeneralshipPromotions.Homeguard, tLevel1GeneralshipPromotions.Nationalism, tLevel1GeneralshipPromotions.Reeducation,
        				tLevel1GeneralshipPromotions.LocalIntelligence, tLevel1GeneralshipPromotions.Cowardly, tLevel1GeneralshipPromotions.Butcher,
        				tLevel1GeneralshipPromotions.Pious, tLevel1GeneralshipPromotions.Scavenger, tLevel1GeneralshipPromotions.Sufficient,
        				tLevel1GeneralshipPromotions.Commando, tLevel1GeneralshipPromotions.Foreign, tLevel1GeneralshipPromotions.Forced, tLevel1GeneralshipPromotions.Strict,
        				tLevel1GeneralshipPromotions.Skirmish, GameInfoTypes.PROMOTION_NOTHING, GameInfoTypes.PROMOTION_NOTHING, GameInfoTypes.PROMOTION_NOTHING,
        				GameInfoTypes.PROMOTION_NOTHING, GameInfoTypes.PROMOTION_NOTHING, GameInfoTypes.PROMOTION_NOTHING } --A list of your promotions!
        		end
        		local iGeneralshipSelection = GeneralshipChoices[math.random(#GeneralshipChoices)] --Game will setup a random number for you!
        		PrintDebug("iGeneralshipSelection = " .. iGeneralshipSelection .. " (" .. GameInfo.UnitPromotions[iGeneralshipSelection].Type .. ")")
        		pUnit:SetHasPromotion(iGeneralshipSelection, true)
        	end
        end
        Essentially I just simplified the code.
      • The function that sorts out what type of Promotion a Great General has I rewrote to simplify and make more adaptive to changes in the overall 'scheme of promotions':
        Code:
        --This checks the General's custom promotion and any unit on him!--
        function GeneralAtPlot(pPlot, iPlayer)
        	local iGeneralType = "NONE"
        	local pGeneral = nil
        	for i = 0, pPlot:GetNumUnits() do
        		local pUnit = pPlot:GetUnit(i)
        		if pUnit then
        			if (pUnit:GetUnitClassType() == GameInfoTypes.UNITCLASS_GREAT_GENERAL) and (pUnit:GetOwner() == iPlayer) then
        				pGeneral = pUnit
        			end
        		end
        	end
        	if pGeneral then
        		if not pGeneral:IsHasPromotion(GameInfoTypes.PROMOTION_NOTHING) then
        			for key1,value1 in pairs(tLevel1GeneralshipPromotions) do
        				if pGeneral:IsHasPromotion(value1) then
        					iGeneralType = value1
        					for key2,value2 in pairs(tLevel2GeneralshipPromotions) do
        						if pGeneral:IsHasPromotion(value2) then
        							iGeneralType = value2
        							for key3,value3 in pairs(tLevel3GeneralshipPromotions) do
        								if pGeneral:IsHasPromotion(value3) then
        									iGeneralType = value3
        								end
        							end
        						end
        					end
        				end
        				if iGeneralType ~= "NONE" then
        					break
        				end
        			end
        		end
        	end
        	return iGeneralType
        end
        it now:
        1. makes sure the Great General belongs to the same player as the Combat Unit.
        2. makes sure the Great General does not have the PROMOTION_NOTHING promotion.
        3. sorts out which of the Level-1 Great General promotion the Great General Unit has
        4. checks to see if the Great General has the Level-2 promotion from that same 'promotion-line'
        5. checks to see if the Great General has the Level-3 promotion from that same 'promotion-line'
        6. returns the promotion ID# for the highest-level promotion the Great General has out of the same 'promotion-line'
        The GeneralAtPlot function now handles any and all promotion-lines that are listed in table GeneralPromotions_GG but it does not deal with the three promotions listed in table GeneralTraits
      • Changes to function SetGeneralEffect:
        Code:
        function SetGeneralEffect(pUnit, iGeneralType)
        	if iGeneralType ~= "NONE" then
        		pUnit:SetHasPromotion(tGeneralToUnitCorrespondances[iGeneralType], true)
        	end
        --	Set1GeneralEffect(pUnit, iGeneralType)
        --	Set2GeneralEffect(pUnit, iGeneralType)
        --	Set9GeneralEffect(pUnit, iGeneralType)
        --	Set11GeneralEffect(pUnit, iGeneralType)
        --	Set10GeneralEffect(pUnit, iGeneralType)
        --	Set3GeneralEffect(pUnit, iGeneralType)
        --	Set4GeneralEffect(pUnit, iGeneralType)
        --	Set12GeneralEffect(pUnit, iGeneralType)
        --	Set5GeneralEffect(pUnit, iGeneralType)
        --	Set13GeneralEffect(pUnit, iGeneralType)
        --	Set14GeneralEffect(pUnit, iGeneralType)
        --	if isUsingCP == false then return
        --	end
        --	Set6GeneralEffect(pUnit, iGeneralType)
        --	Set7GeneralEffect(pUnit, iGeneralType)
        --	Set8GeneralEffect(pUnit, iGeneralType)
        end
        Essentially, the promotion ID# grabbed from function GeneralAtPlot will be sent to this code, and the tGeneralToUnitCorrespondances table will specify which Combat-Unit-Promotion should be applied to the Combat Unit based on the Great General Promotion that was found.
      • function GeneralCheckLevelUp is written to now handle all the promotion-lines within table GeneralPromotions_GG:
        Code:
        function GeneralCheckLevelUp(pUnit)
        	if pUnit:GetExperience() >= Expneeded2 then
        		local sGeneralshipLine = "NONE"
        		for k,v in pairs (tLevel1GeneralshipPromotions) do
        			if pUnit:IsHasPromotion(v) then
        				sGeneralshipLine = k
        			end
        		end
        		if pUnit:IsHasPromotion(tLevel2GeneralshipPromotions[sGeneralshipLine]) and pUnit:GetExperience() >= Expneeded3 then
        			if not pUnit:IsHasPromotion(tLevel3GeneralshipPromotions[sGeneralshipLine]) then
        				pUnit:SetHasPromotion(tLevel3GeneralshipPromotions[sGeneralshipLine], true)
        			end
        		end
        		if not pUnit:IsHasPromotion(tLevel2GeneralshipPromotions[sGeneralshipLine]) then
        			pUnit:SetHasPromotion(tLevel2GeneralshipPromotions[sGeneralshipLine], true)
        		end
        	end
        --	Up1GeneralEffect(pUnit)
        --	Up2GeneralEffect(pUnit)
        --	Up9GeneralEffect(pUnit)
        --	Up11GeneralEffect(pUnit)
        --	Up10GeneralEffect(pUnit)
        --	Up3GeneralEffect(pUnit)
        --	Up4GeneralEffect(pUnit)
        --	Up12GeneralEffect(pUnit)
        --	Up5GeneralEffect(pUnit)
        --	Up13GeneralEffect(pUnit)
        --	Up14GeneralEffect(pUnit)
        --	if isUsingCP == false then return
        --	end
        --	Up6GeneralEffect(pUnit)
        --	Up7GeneralEffect(pUnit)
        --	Up8GeneralEffect(pUnit)
        end
      • The various GeneralAdjacentPlotCheck, IdeologyAdjacentPlotCheck, General2ndRingPlotCheck etc. were re-written to return "NONE" if no valid Great General unit was discovered. I did not make any other changes to the 'Ideology' functions, so they will require a bit more rework.
      • Re-Wrote function UnitsNearGeneral so that 1 (one) and only 1 (one) Great General can add its affects to a single Combat Unit. Otherwise I simply cannot see how to solve the logic required where multiple Great Generals are all adding different effects to the same Combat Unit:
        Code:
        --This opens up and gives the promotions to the unit!--
        --runs on PlayerDoTurn and adds correct promotions to normal combat units.
        function UnitsNearGeneral(iPlayer)
        	local pPlayer = Players[iPlayer]
        	if not pPlayer:IsAlive() then return end
        	for pUnit in pPlayer:Units() do
        		if pUnit:IsCombatUnit() then
        			if pUnit:GetDomainType() == iDomainLand then
        				for k,v in pairs(tCombatUnitMasterPromotionList) do
        					if pUnit:IsHasPromotion(v) then
        						pUnit:SetHasPromotion(v, false)
        					end
        				end
        				if pUnit:IsNearGreatGeneral() then
        					pUnitPlot = pUnit:GetPlot()
        					local iGeneralType = GeneralAtPlot(pUnitPlot, iPlayer) --Also known as a Local Great General (Unit earns the promotion from the Great General on them!)
        					SetGeneralEffect(pUnit, iGeneralType)
        					if iGeneralType == "NONE" then
        						iGeneralType = GeneralAdjacentPlotCheck(pUnitPlot, iPlayer) --Also known as a Regional Great General (Units adjacent to the Great General may earn the promotion, but priority of the better promotions is considered!)
        						SetGeneralEffect(pUnit, iGeneralType)
        					end
        					if iGeneralType == "NONE" then
        						iGeneralType = General2ndRingPlotCheck(pUnitPlot, iPlayer) --Also known as a Territorial Great General (Same rule applies like the Regional Great General.)
        						SetGeneralEffect(pUnit, iGeneralType)
        					end
        				end
        			end
        		end
        		if pUnit:GetUnitClassType() == GameInfoTypes.UNITCLASS_GREAT_GENERAL then
        			PrintDebug(pUnit:GetName() .. " has " .. pUnit:GetExperience() .. " experience")
        		end
        	end	
        end
        This is mostly accomplished by the use of the lines:
        Code:
        if iGeneralType == "NONE" then
      • function NearGeneralKiller was re-written to grab the promotion the Combat Unit has and feed that promotion, along with the Combat Unit's Plot and Owner ID# to functions SearchForMatchingGeneralAndAssignXP and CheckPlotForMatchingGeneral:
        Spoiler :
        Code:
        function NearGeneralKiller(iOwner, iUnit, iUnitType, iX, iY, bDelay, iKiller)
        	if bDelay then
        		iFirstTimeThroughKillerData = iKiller
        		return
        	end
        	if iFirstTimeThroughKillerData == -1 then
        		iFirstTimeThroughKillerData = "NONE"
        		return
        	end
        	if iFirstTimeThroughKillerData == "NONE" then
        		return
        	end
        	local pOwnerPlayer = Players[iOwner]
        	local pUnitKilled = pOwnerPlayer:GetUnitByID(iUnit)
        	if not pUnitKilled:IsCombatUnit() then return end
        	if pUnitKilled:GetDomainType() ~= iDomainLand then return end
        	local pKillerPlayer = Players[iFirstTimeThroughKillerData]
        	iFirstTimeThroughKillerData = "NONE"
        	local pPlot = Map.GetPlot(iX, iY)
        	local iNumTileUnits = pPlot:GetNumUnits()
        	if iNumTileUnits > 1 then
        		for i = 0, pPlot:GetNumUnits() do
        			local pUnit = pPlot:GetUnit(i)
        			if pUnit then
        				local iUnitOwner = pUnit:GetOwner()
        				if iUnitOwner ~= iOwner then
        					[color="blue"]local iCombatUnitPromotion = "NONE"		
        					for k,v in pairs(tGeneralToUnitCorrespondances) do
        						if pUnit:IsHasPromotion(v) then
        							iCombatUnitPromotion = v
        							break
        						end
        					end
        					if iCombatUnitPromotion ~= "NONE" then
        						PrintDebug("The Combat Unit has promotion " .. iCombatUnitPromotion .. ":" .. GameInfo.UnitPromotions[iCombatUnitPromotion].Type .. " for matching with a nearby great general")
        						PrintDebug("In function NearGeneralKiller: iUnitOwner is " .. tostring(iUnitOwner))
        						PrintDebug("In function NearGeneralKiller: pPlot is " .. tostring(pPlot))
        						PrintDebug("In function NearGeneralKiller: iCombatUnitPromotion is " .. tostring(iCombatUnitPromotion))
        						SearchForMatchingGeneralAndAssignXP(iUnitOwner, pPlot, iCombatUnitPromotion)
        					else
        						PrintDebug("No valid combat unit promotion was found from within table tGeneralToUnitCorrespondances")
        					end[/color]
        				end
        			end
        		end
        	end
        end
      • Function SearchForMatchingGeneralAndAssignXP was rewritten to find one and only one great general that matches-up to the promotion the combat unit has, assign XP to the Great General that is found, and then terminate at the earliest opportunity once all this is accomplished
      • Function CheckPlotForMatchingGeneral takes the info sent to it from SearchForMatchingGeneralAndAssignXP and looks for whether there is a Great General unit that has a matching promotion for the promotion the Combat Unit had. The code is re-written to make use of table tUnitToGeneralCorrespondances. Table tUnitToGeneralCorrespondances is created based on the data entered into the master data-table GeneralPromotions_GG
      • Also re-wrote function GeneralLevelUp to conform to the new 'systems' of the re-write
    2. Also fixed a few typo mis-matches between promotion names in the lua and in the XML/SQL and in the lua-table 'key' names used to make them consistent in all usages
    • Remember I did not do anything with the 'Ideology' side of the system. But from what I can gather this isn't effective unless CP is enabled, and since I don't use CP or CBP this was not an issue for me.

    I seem to be having a firewall or other issue with trying to make attachments, so: Link To Mediafire Download of Zipped Re-work of the Mod
     
  14. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,215
    Gender:
    Male
    Location:
    Somewhere in California
    Well, the code got a lot more simpler to process for the machine now then. I guess with some changes, the mod can expect a beta release by today.
     
  15. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,215
    Gender:
    Male
    Location:
    Somewhere in California
  16. rockinroger

    rockinroger WoC Team Member

    Joined:
    Feb 6, 2006
    Messages:
    1,312
    Location:
    Overland Park, Kansas
    Very nice gonna give this a test drive. I have been disappointed with GG since civ 3. Back in civ 3 you could use a GG to merge 3 units together for max strength. I miss that ability, so lets see what this one does. Thanks.
     
  17. Buildkirbyus

    Buildkirbyus Trainee Modder

    Joined:
    Dec 24, 2014
    Messages:
    159
    Location:
    University Wi-Fi
    Have you tested for EUI compatibility?
    I found this line in the code after starting a new game without any unit panel showing up, preventing me to play the game.
    Code:
    [711139.265] Runtime Error: C:\Users\Build\Documents\My Games\Sid Meier's Civilization 5\MODS\Leadership Reformation (v 3)\LUA\UnitPanel.lua:65: attempt to index field 'PromotionButton' (a nil value)
    [711139.265] Runtime Error: Error loading C:\Users\Build\Documents\My Games\Sid Meier's Civilization 5\MODS\Leadership Reformation (v 3)\LUA\UnitPanel.lua.
    
    Mod List:
    Spoiler :

    Community Patch
    Community Balance Patch
    CSD for CBP
    Civ IV Diplomatic Features
    More Luxuries
    Community Balance Patch - Compatibility Files (EUI)
    Barbarian Immersion Enhancements
    Advancing Worker
    Ethnic Units
    Faster Aircraft Animations
    Historical Religons Complete
    Improved Air Recon
    Ingame Editor
    Internation Utopia Project
    JFD's Cities in Development
    JFD's Cultural Diversity
    JFD's Rise to Power
    Leadership Reformation (This Mod)
    Music Changer
    Pillage Perfect
    Quick Turns
    Events and Decisions
    Trading Posts Turn into Towns
     
  18. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    This is amazing. So sad I did not knew of it's existence.
    Subscribed. :)
     
  19. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,215
    Gender:
    Male
    Location:
    Somewhere in California
    Are you sure that you used the EUI UnitPanel customized for Leadership Reformation?
     
  20. Buildkirbyus

    Buildkirbyus Trainee Modder

    Joined:
    Dec 24, 2014
    Messages:
    159
    Location:
    University Wi-Fi
    ah whoops. didn't see that
    will apply the fix and try again.
     

Share This Page