Civ 5 LUA - Help to Update for Civ 6

kingchris20

Wisdom Seeker
Joined
Jul 30, 2012
Messages
1,343
Location
Resident of Heaven; Currently in the Waiting Room
Can anyone help me update this LUA code to work with Civ 6 please?

Code:
function TES_UpdateRestorationMageStrength(iPlayer, iUnitID)
    local pPlayer = Players[iPlayer];
    if (pPlayer:IsEverAlive()) then
        local pUnit = pPlayer:GetUnitByID();
        local pTeam = Teams[pPlayer:GetTeam()];
        local pPlot = pUnit:GetPlot();
          if (pUnit:GetX() > 0 and pUnit:GetY() > 0) then
            if (pUnit:GetUnitType() == GameInfoTypes.UNIT_TES_RESTORATION_MAGE) then
                if (pPlot:GetOwner() == iPlayer) then
                    if (pTeam:GetTeamTechs():HasTech(GameInfoTypes[ "TECH_MOBILE_TACTICS" ])) then 
                        pUnit:SetBaseCombatStrength(90)
                    elseif (pTeam:GetTeamTechs():HasTech(GameInfoTypes[ "TECH_PLASTIC" ])) then
                        pUnit:SetBaseCombatStrength(70)
                    elseif (pTeam:GetTeamTechs():HasTech(GameInfoTypes[ "TECH_REPLACEABLE_PARTS" ])) then
                        pUnit:SetBaseCombatStrength(50)
                    elseif (pTeam:GetTeamTechs():HasTech(GameInfoTypes[ "TECH_RIFLING" ])) then
                        pUnit:SetBaseCombatStrength(34)
                    elseif (pTeam:GetTeamTechs():HasTech(GameInfoTypes[ "TECH_GUNPOWDER" ])) then
                        pUnit:SetBaseCombatStrength(24)
                    elseif (pTeam:GetTeamTechs():HasTech(GameInfoTypes[ "TECH_STEEL" ])) then
                        pUnit:SetBaseCombatStrength(21)
                    elseif (pTeam:GetTeamTechs():HasTech(GameInfoTypes[ "TECH_IRON_WORKING" ])) then
                        pUnit:SetBaseCombatStrength(14)
                    end
                end
            end
        end
    end
end
 
From what I see, this Lua increases strength for a specific unit when the player progresses through tech tree.
You should be able to get this effect with modifiers and clever use of requirements in Civ6, I think.
 
From what I see, this Lua increases strength for a specific unit when the player progresses through tech tree.
You should be able to get this effect with modifiers and clever use of requirements in Civ6, I think.
Yeah, it took me about 2.5 hours to get it going, but it did work with modifiers using tech requirements
 
Top Bottom