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

Quick Questions / Quick Answers

Discussion in 'Community Patch Project' started by Theral, Aug 23, 2016.

  1. CoastalRiverMountain

    CoastalRiverMountain Chieftain

    Joined:
    Jul 13, 2020
    Messages:
    2
    How do I disable the UI changes of the Community Patch? Namely, the new movement indicator... which was not mentioned anywhere in any feature list, even the exhaustive google doc.

    There is not a toggle for it in CommunityOptions.sql nor CommunityPatchDLLChanges.xml.
    All I have installed is the CP. I do not intend on installing EUI because it seems entwined with the rest of VP which I wish to avoid.
     
    Last edited: Jul 13, 2020
  2. vyyt

    vyyt Deity

    Joined:
    Jan 28, 2005
    Messages:
    2,272
    Location:
    Czech Republic
    @CoastalRiverMountain , there are no UI changed integrated in CP as far as I know. Must be some other mod of yours. Try deleting the cache folder (same level as the MODS folder)

    And EUI is not related to VP. It is bundled with it because most players like it, but there is an option in the autoinstaller to install VP without EUI.
     
  3. Recursive

    Recursive Covets Lands That You Currently Own Moderator

    Joined:
    Dec 19, 2017
    Messages:
    2,211
    Gender:
    Male
    Pretty sure that's part of EUI.

    The google doc is out of date.
     
  4. CoastalRiverMountain

    CoastalRiverMountain Chieftain

    Joined:
    Jul 13, 2020
    Messages:
    2
    Interesting. I've only downloaded the "(1) Community Patch" zip in the VP MEGA and have no other mods.

    Edit: I found Community-Patch-DLL/issues/3984 in the Github, which explains things. However the math that's performed to get the desired result out of the indicator appears to be done in the compiled .dll. The viewable lua files work with that math (Core Files\CoreLua\PathHelpManager.lua), let me change the number that's displayed in the middle of the movement indicator, but its colour will always be grey because the internal value (how many turns will it take to get there) is being artificially multiplied elsewhere, to a minimum of 5 turns even to move one hex.
     
    Last edited: Jul 16, 2020
  5. Vhozite

    Vhozite Warlord

    Joined:
    Dec 18, 2019
    Messages:
    116
    Gender:
    Male
    1. Can unit upgrade cost not be lowered? Changing “UNIT_UPGRADE_COST_PER_PRODUCTION” in Core Defines to anything lower than 1 results in my unit upgrades costing 10 gold.

    2. Is there any way I can tweak unit XP gains or the amount of xp needed for a promo? The only thing I’ve found EXPERIENCE_ATTACKING_CITY_RANGED, which is really specific.
     
  6. Recursive

    Recursive Covets Lands That You Currently Own Moderator

    Joined:
    Dec 19, 2017
    Messages:
    2,211
    Gender:
    Male
    Code:
    //   --------------------------------------------------------------------------------
    /// How much does it cost to upgrade this Unit to a shiny new eUnit?
    int CvUnit::upgradePrice(UnitTypes eUnit) const
    {
       VALIDATE_OBJECT
       int iPrice = 0;
     
       CvUnitEntry* pkUnitInfo = GC.getUnitInfo(eUnit);
       if(pkUnitInfo == NULL)
       {
           return 0;
       }
    
       if(isBarbarian())
       {
           return 0;
       }
    
       if (GET_PLAYER(getOwner()).isMinorCiv())
           return 0;
    
       iPrice = /*10*/ GC.getBASE_UNIT_UPGRADE_COST();
    
       CvPlayerAI& kPlayer = GET_PLAYER(getOwner());
    
       int iProductionBase = kPlayer.getProductionNeeded(getUnitType());
       if (iProductionBase == 0)
       {
           iProductionBase = kPlayer.getProductionNeeded(eUnit) / 2;
       }
    
       iPrice += (std::max(0, (kPlayer.getProductionNeeded(eUnit) - iProductionBase)) * /*2*/ GC.getUNIT_UPGRADE_COST_PER_PRODUCTION());
    
       // Upgrades for later units are more expensive
       const TechTypes eTech = (TechTypes) pkUnitInfo->GetPrereqAndTech();
       CvTechEntry* pkTechInfo = GC.getTechInfo(eTech);
       if(pkTechInfo)
       {
           const EraTypes eUpgradeEra = (EraTypes) pkTechInfo->GetEra();
    
           double fMultiplier = 1.0f;
           fMultiplier += (eUpgradeEra* /*0.3*/ GC.getUNIT_UPGRADE_COST_MULTIPLIER_PER_ERA());
    
           iPrice = int(iPrice * fMultiplier);
       }
    
       if(!isHuman() && !isBarbarian())
       {
           iPrice *= GC.getGame().getHandicapInfo().getAIUnitUpgradePercent();
           iPrice /= 100;
    
           iPrice *= std::max(0, ((GC.getGame().getHandicapInfo().getAIPerEraModifier() * GET_TEAM(getTeam()).GetCurrentEra()) + 100));
           iPrice /= 100;
       }
    
       // Discount
       iPrice -= (iPrice * getUpgradeDiscount()) / 100;
    
       // Mod (Policies, etc.)
       int iMod = kPlayer.GetUnitUpgradeCostMod();
       iPrice *= (100 + iMod);
       iPrice /= 100;
    
       // Apply exponent
       iPrice = (int) pow((double) iPrice, (double) /*1.0f*/ GC.getUNIT_UPGRADE_COST_EXPONENT());
    
       // Make the number not be funky
       int iDivisor = /*5*/ GC.getUNIT_UPGRADE_COST_VISIBLE_DIVISOR();
       iPrice /= iDivisor;
       iPrice *= iDivisor;
    
       return max(1, iPrice);
    }
    
    Code:
    //   --------------------------------------------------------------------------------
    #if defined(MOD_UNITS_XP_TIMES_100)
    void CvUnit::changeExperienceTimes100(int iChangeTimes100, int iMax, bool bFromCombat, bool bInBorders, bool bUpdateGlobal)
    #else
    void CvUnit::changeExperience(int iChange, int iMax, bool bFromCombat, bool bInBorders, bool bUpdateGlobal)
    #endif
    {
       VALIDATE_OBJECT
       // Barbs don't get XP or Promotions
    #if defined(MOD_UNITS_XP_TIMES_100)
       if (isBarbarian() && iChangeTimes100 > 0)
    #else
       if (isBarbarian() && iChange > 0)
    #endif
       {
           return;
       }
    
       if (MOD_BALANCE_CORE_SCALING_XP && !bFromCombat)
       {
           iChangeTimes100 *= GC.getGame().getGameSpeedInfo().getTrainPercent();
           iChangeTimes100 /= 100;
       }
    
    #if defined(MOD_UNITS_XP_TIMES_100)
       // Checking limits.h for the values of MAX_INT and MAX_LONG they are the same, so we need to use "long long" and hence MAX_LLONG
       long long lMaxTimes100 = (iMax == -1) ? INT_MAX : (iMax * 100LL);
       int iMaxTimes100 = (lMaxTimes100 > ((long long)INT_MAX)) ? INT_MAX : (int)lMaxTimes100;
     
       int iUnitExperienceTimes100 = iChangeTimes100;
    #else
       int iUnitExperience = iChange;
    #endif
       PromotionTypes eNewPromotion = NO_PROMOTION;
    
       if(bFromCombat)
       {
           CvPlayer& kPlayer = GET_PLAYER(getOwner());
    
           // Promotion that changes after combat?
           for (int iI = 0; iI < GC.getNumPromotionInfos(); iI++)
           {
               const PromotionTypes eLoopPromotion = static_cast<PromotionTypes>(iI);
               CvPromotionEntry* pkPromotionInfo = GC.getPromotionInfo(eLoopPromotion);
               if(pkPromotionInfo)
               {
                   if (pkPromotionInfo->HasPostCombatPromotions() && m_Promotions.HasPromotion(eLoopPromotion))
                   {
                       eNewPromotion = m_Promotions.ChangePromotionAfterCombat(eLoopPromotion);
                       setHasPromotion(eLoopPromotion, false);
    
                       if (eNewPromotion != NO_PROMOTION)
                       {
                           setHasPromotion(eNewPromotion, true);
    
    #if defined(MOD_EVENTS_UNIT_UPGRADES)
                           if (MOD_EVENTS_UNIT_UPGRADES) {
                               GAMEEVENTINVOKE_HOOK(GAMEEVENT_UnitPromoted, getOwner(), GetID(), eNewPromotion);
                           }
    #endif
                           if (kPlayer.GetID() == GC.getGame().getActivePlayer())
                           {
                               CvPromotionEntry* pkNewPromotionInfo = GC.getPromotionInfo(eNewPromotion);
                               Localization::String localizedText = Localization::Lookup(pkNewPromotionInfo->GetDescriptionKey());
                               SHOW_PLOT_POPUP(plot(), getOwner(), localizedText.toUTF8());
                           }
                       }
                   }
               }
           }
    
           // Player Great General/Admiral mod
           int iCombatExperienceMod;
           if (getDomainType() == DOMAIN_SEA)
           {
               iCombatExperienceMod = 100 + kPlayer.getGreatAdmiralRateModifier();
           }
           else
           {
               iCombatExperienceMod = 100 + kPlayer.getGreatGeneralRateModifier();
           }
    
           // Unit XP mod
    #if defined(MOD_UNITS_XP_TIMES_100)
           int iPlayerBonusXpTimes100 = (iChangeTimes100 * kPlayer.getExpModifier()) / 100;
           if (!MOD_UNITS_XP_TIMES_100) {
               // If NOT using XP times 100, remove any fractional part
               iPlayerBonusXpTimes100 -= (iPlayerBonusXpTimes100 % 100);
           }
           iUnitExperienceTimes100 += iPlayerBonusXpTimes100;
           if(MOD_BALANCE_CORE_RESOURCE_MONOPOLIES)
           {
               const std::vector<ResourceTypes>& vStrategicMonopolies = GET_PLAYER(getOwner()).GetStrategicMonopolies();
               for (size_t iResourceLoop = 0; iResourceLoop < vStrategicMonopolies.size(); iResourceLoop++)
               {
                   ResourceTypes eResourceLoop = vStrategicMonopolies[iResourceLoop];
                   CvResourceInfo* pInfo = GC.getResourceInfo(eResourceLoop);
                   if (pInfo && pInfo->getMonopolyXPBonus() > 0)
                   {
                       iUnitExperienceTimes100 += (pInfo->getMonopolyXPBonus() * 100);
                   }
               }
           }
    #else
           iUnitExperience += (iChange * kPlayer.getExpModifier()) / 100;
    #if defined(MOD_BALANCE_CORE_RESOURCE_MONOPOLIES)
           if(MOD_BALANCE_CORE_RESOURCE_MONOPOLIES)
           {
               const std::vector<ResourceTypes>& vStrategicMonopolies = GET_PLAYER(getOwner()).GetStrategicMonopolies();
               for (size_t iResourceLoop = 0; iResourceLoop < vStrategicMonopolies.size(); iResourceLoop++)
               {
                   ResourceTypes eResourceLoop = vStrategicMonopolies[iResourceLoop];
                   CvResourceInfo* pInfo = GC.getResourceInfo(eResourceLoop);
                   if (pInfo && pInfo->getMonopolyXPBonus() > 0)
                   {
                       iUnitExperience += pInfo->getMonopolyXPBonus();
                   }
               }
           }
    #endif
    #endif
           // Great General & Unit XP mod in borders
           if (bInBorders)
           {
               // In-borders GG mod
               if (getDomainType() == DOMAIN_LAND)
               {
                   iCombatExperienceMod += kPlayer.getDomesticGreatGeneralRateModifier();
               }
    
               int iBorderBonusXpTimes100 = (iChangeTimes100 * kPlayer.getExpInBorderModifier()) / 100;
               if (!MOD_UNITS_XP_TIMES_100) {
                   // If NOT using XP times 100, remove any fractional part
                   iBorderBonusXpTimes100 -= (iBorderBonusXpTimes100 % 100);
               }
               iUnitExperienceTimes100 += iBorderBonusXpTimes100;
           }
    
           if(bUpdateGlobal)
           {
               // Add Unit GG mod
               if (getDomainType() == DOMAIN_LAND)
               {
                   iCombatExperienceMod += getGreatGeneralModifier();
               }
    
               if(iMax == -1)
               {
                   if(getDomainType() == DOMAIN_SEA)
                   {
    #if defined(MOD_GLOBAL_LOCAL_GENERALS)
    #if defined(MOD_UNITS_XP_TIMES_100)
                       kPlayer.changeNavalCombatExperienceTimes100((iChangeTimes100 * iCombatExperienceMod) / 100, (MOD_GLOBAL_LOCAL_GENERALS ? this : NULL));
    #else
                       kPlayer.changeNavalCombatExperience((iChange * iCombatExperienceMod) / 100, (MOD_GLOBAL_LOCAL_GENERALS ? this : NULL));
    #endif
    #else
    #if defined(MOD_UNITS_XP_TIMES_100)
                       kPlayer.changeNavalCombatExperienceTimes100((iChangeTimes100 * iCombatExperienceMod) / 100);
    #else
                       kPlayer.changeNavalCombatExperience((iChange * iCombatExperienceMod) / 100);
    #endif
    #endif
                   }
                   else
                   {
    #if defined(MOD_GLOBAL_LOCAL_GENERALS)
    #if defined(MOD_UNITS_XP_TIMES_100)
                       kPlayer.changeCombatExperienceTimes100((iChangeTimes100 * iCombatExperienceMod) / 100, (MOD_GLOBAL_LOCAL_GENERALS ? this : NULL));
    #else
                       kPlayer.changeCombatExperience((iChange * iCombatExperienceMod) / 100, (MOD_GLOBAL_LOCAL_GENERALS ? this : NULL));
    #endif
    #else
    #if defined(MOD_UNITS_XP_TIMES_100)
                       kPlayer.changeCombatExperienceTimes100((iChangeTimes100 * iCombatExperienceMod) / 100);
    #else
                       kPlayer.changeCombatExperience((iChange * iCombatExperienceMod) / 100);
    #endif
    #endif
                   }
               }
               else
               {
    #if defined(MOD_UNITS_XP_TIMES_100)
                   int iModdedChangeTimes100 = min(iMaxTimes100 - m_iExperienceTimes100, iChangeTimes100);
                   if (iModdedChangeTimes100 > 0)
    #else
                   int iModdedChange = min(iMax - m_iExperience, iChange);
                   if (iModdedChange > 0)
    #endif
                   {
                       if(getDomainType() == DOMAIN_SEA)
                       {
    #if defined(MOD_GLOBAL_LOCAL_GENERALS)
    #if defined(MOD_UNITS_XP_TIMES_100)
                           kPlayer.changeNavalCombatExperienceTimes100((iModdedChangeTimes100 * iCombatExperienceMod) / 100, (MOD_GLOBAL_LOCAL_GENERALS ? this : NULL));
    #else
                           kPlayer.changeNavalCombatExperience((iModdedChange * iCombatExperienceMod) / 100, (MOD_GLOBAL_LOCAL_GENERALS ? this : NULL));
    #endif
    #else
    #if defined(MOD_UNITS_XP_TIMES_100)
                           kPlayer.changeNavalCombatExperienceTimes100((iModdedChangeTimes100 * iCombatExperienceMod) / 100);
    #else
                           kPlayer.changeNavalCombatExperience((iModdedChange * iCombatExperienceMod) / 100);
    #endif
    #endif
                       }
                       else
                       {
    #if defined(MOD_GLOBAL_LOCAL_GENERALS)
    #if defined(MOD_UNITS_XP_TIMES_100)
                           kPlayer.changeCombatExperienceTimes100((iModdedChangeTimes100 * iCombatExperienceMod) / 100, (MOD_GLOBAL_LOCAL_GENERALS ? this : NULL));
    #else
                           kPlayer.changeCombatExperience((iModdedChange * iCombatExperienceMod) / 100, (MOD_GLOBAL_LOCAL_GENERALS ? this : NULL));
    #endif
    #else
    #if defined(MOD_UNITS_XP_TIMES_100)
                           kPlayer.changeCombatExperienceTimes100((iModdedChangeTimes100 * iCombatExperienceMod) / 100);
    #else
                           kPlayer.changeCombatExperience((iModdedChange * iCombatExperienceMod) / 100);
    #endif
    #endif
                       }
                   }
               }
           }
    
           if(getExperiencePercent() != 0)
           {
    #if defined(MOD_UNITS_XP_TIMES_100)
               int iUnitBonusXpTimes100 = (iUnitExperienceTimes100 + getExperiencePercent()) / 100;
               if (!MOD_UNITS_XP_TIMES_100) {
                   // If NOT using XP times 100, remove any fractional part
                   iUnitBonusXpTimes100 -= (iUnitBonusXpTimes100 % 100);
               }
               iUnitExperienceTimes100 += iUnitBonusXpTimes100;
    #else
               iUnitExperience *= 100 + getExperiencePercent();
               iUnitExperience /= 100;
    #endif
           }
       }
    
    #if defined(MOD_UNITS_XP_TIMES_100)
       setExperienceTimes100((getExperienceTimes100() + iUnitExperienceTimes100), iMax);
    #else
       setExperience((getExperience() + iUnitExperience), iMax);
    #endif
    }
    
    Code:
    //   --------------------------------------------------------------------------------
    int CvUnit::experienceNeeded() const
    {
       VALIDATE_OBJECT
    
       const int iLevel = getLevel();
    
       // Sum up the levels to get our multiplier (1:1, 2:3, 3:6, 4:10, etc.)
       int iExperienceMultiplier = 0;
       for(int iLevelLoop = 1; iLevelLoop <= iLevel; iLevelLoop++)
       {
           iExperienceMultiplier += iLevelLoop;
       }
    
       int iExperienceNeeded = /*10*/ GC.getEXPERIENCE_PER_LEVEL() * iExperienceMultiplier;
    
       const int iModifier = GET_PLAYER(getOwner()).getLevelExperienceModifier();
       if(0 != iModifier)
       {
           float fTemp = (float) iExperienceNeeded;
           fTemp *= (100 + iModifier);
           fTemp /= 100;
           iExperienceNeeded = (int) ceil(fTemp); // Round up
       }
    
       if (MOD_BALANCE_CORE_SCALING_XP)
       {
           iExperienceNeeded *= GC.getGame().getGameSpeedInfo().getTrainPercent();
           iExperienceNeeded /= 100;
       }
    
       return iExperienceNeeded;
    }
    
    To update global values you can generally add the following to an SQL file:

    Code:
    UPDATE Defines
    SET Value = [new value]
    WHERE Name = '[global name]';
    
    Example:
    UPDATE Defines
    SET Value = '10'
    WHERE Name = 'EXPERIENCE_PER_LEVEL';
    
    (make sure to include the ; at the end)
    
    NOTE: It's possible that the /*listed values*/ of globals in the code blocks are not the actual values. If it's a value that exists in the base game it'll be found in the Expansion2 subfolder of the base game's Steam files (XML). It may have been updated in VP in an SQL file.

    Notepad++'s Find in Files feature is very helpful.
     
    Vhozite likes this.
  7. NakFour1

    NakFour1 Chieftain

    Joined:
    Jun 15, 2020
    Messages:
    8
    Gender:
    Male
    Is light tank an armored unit? (Does "Lightning Warfare" tenet apply on the light tanks?)
    Tnx in advance!
     
  8. azum4roll

    azum4roll Emperor

    Joined:
    Jul 17, 2018
    Messages:
    1,312
    Gender:
    Male
    Is there a pure SQL way to add a new promotion that gives a ranged attack bonus against just melee ships?
     
  9. amateurgamer88

    amateurgamer88 Emperor

    Joined:
    Aug 24, 2018
    Messages:
    1,282
    Gender:
    Male
    Armored units are melee units like Landship and Tanks. Light Tank is considered Archer unit since it's ranged. Therefore, Light Tanks don't get that promotion unless you're playing Austria and you upgrade your UU into a Light Tank.

    You mean something like this:

    Spoiler :

    INSERT INTO UnitPromotions_UnitCombatMods
    (PromotionType, UnitCombatType, Modifier)
    VALUES
    ('PROMOTION_BLANK', 'UNITCOMBAT_NAVALMELEE', 50);
     
  10. 10101100

    10101100 Chieftain

    Joined:
    Oct 14, 2019
    Messages:
    45
    Gender:
    Male
    Is there an easy way to make buildings 1, 2,3 eras older than your current era have a discount?
     
    usadefcon1 likes this.
  11. Stalker0

    Stalker0 Baller Magnus

    Joined:
    Dec 31, 2005
    Messages:
    7,218
    The imperialism policy tree has just such a policy
     
    10101100 likes this.
  12. 10101100

    10101100 Chieftain

    Joined:
    Oct 14, 2019
    Messages:
    45
    Gender:
    Male
    unfortunately that works only for puppeted cities and cities with a courthouse, and I needed it for every city
     
  13. sambrowny

    sambrowny Chieftain

    Joined:
    Apr 6, 2020
    Messages:
    8
    Has there been any chances to the aggressiveness of the AI early game recently, I updated my version and it feels like the ai are much more passive early on, thanks
     
  14. Recursive

    Recursive Covets Lands That You Currently Own Moderator

    Joined:
    Dec 19, 2017
    Messages:
    2,211
    Gender:
    Male
    I've fixed it for next version.
     
    James Ryle and vyyt like this.
  15. Zanteogo

    Zanteogo King

    Joined:
    Nov 13, 2015
    Messages:
    800
    How do you disable the AI hate for the civ in the lead in the latter eras?

    I can't recall what needs to be edited to change that.
     
  16. Recursive

    Recursive Covets Lands That You Currently Own Moderator

    Joined:
    Dec 19, 2017
    Messages:
    2,211
    Gender:
    Male
    (1) Community Patch > Core Files > Core Changes > DiploAIOptions.sql, set DIPLO_AI_NO_VICTORY_COMPETITION to 1 and save the file.
     
    Zanteogo likes this.
  17. James Ryle

    James Ryle Chieftain

    Joined:
    Feb 17, 2018
    Messages:
    46
    Gender:
    Male
    Location:
    La Herradura, Spain
    Is it possible to know the changes to aggression values and where to place them? I’d love to be able to use them with ilteroi’s new DLL.
     
  18. Recursive

    Recursive Covets Lands That You Currently Own Moderator

    Joined:
    Dec 19, 2017
    Messages:
    2,211
    Gender:
    Male
    According to Github I've made over 7,000 line changes for next version. Best to wait. :)
     
    James Ryle and CppMaster like this.
  19. CppMaster

    CppMaster Emperor

    Joined:
    Feb 13, 2018
    Messages:
    1,205
    Gender:
    Male
    Location:
    Poland
    Omg, how many lines has whole VP mod?
     
  20. Stalker0

    Stalker0 Baller Magnus

    Joined:
    Dec 31, 2005
    Messages:
    7,218
    7012, iteroi is very efficient ;)
     
    XSamatan likes this.

Share This Page