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

CBP Events and Decisions Compatibility

Discussion in 'Mods Repository' started by Enginseer, Feb 13, 2016.

  1. Markvitank

    Markvitank Chieftain

    Joined:
    Nov 26, 2018
    Messages:
    3
    Gender:
    Male
    Yeah it looks like it should be part of the prohibition choice, but the sugar is received on the wild horses choice.
     
  2. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,189
    Gender:
    Male
    Location:
    Somewhere in California
    But the Prohibition Choice is granting the Sugar? Was this with the recent version or...?
     
  3. Markvitank

    Markvitank Chieftain

    Joined:
    Nov 26, 2018
    Messages:
    3
    Gender:
    Male
    I haven't reached the prohibition choice yet. I know is that the wild horses choice provides two copies of sugar though. IDK maybe they both provide sugar. Also, I am using the most recent version of the mod.
     
  4. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,189
    Gender:
    Male
    Location:
    Somewhere in California
    you cant have the most recent version. I just tested it right now. Wild Horse Choices offer +2 Horses, not 2 Sugars.
     
  5. ProCatGamer

    ProCatGamer Chieftain

    Joined:
    Aug 8, 2018
    Messages:
    40
    Gender:
    Male
    Hey I was wondering how the progress doing so far

    I know you said use the wiki to look at the progress however I can't really see the progress :(
     
  6. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,189
    Gender:
    Male
    Location:
    Somewhere in California
  7. HungryForFood

    HungryForFood Chieftain

    Joined:
    Oct 4, 2016
    Messages:
    285
    Location:
    Malaysia
    A recent change in the DLL (by me) which comes with 3-14 is causing your unit upgrade Lua (for units unlocked by decisions) to cause a crash, due to the position of the UnitUpgraded Lua hook in the DLL.

    In short, the original upgraded unit (eg Crossbowman rather than the Longbowman) is deleted before the DLL finishes processing it, causing an access violation error.

    So looking through the available Lua methods in the DLL, I found a new one for CP, which works much better for what you need. It basically forces a unit to upgrade into something, even if it normally shouldn't be able to.

    Code:
    Unit:UpgradeTo(iUnitType, bIsFree)
    Unit is your unit instance, iUnitType is the unit to upgrade to (eg Longbowman), bIsFree is whether to charge the player gold.

    There's also Convert, by Firaxis. It is how the XP and promotions are transferred inside the DLL; it transfers all attributes of the old unit to the new unit, eg name, all promotions, etc.

    Previous code looks like this:

    Code:
    function TheLastModder(iPlayer, iOldUnit, iNewUnit, bGoodyHut)
       local pPlayer = Players[iPlayer]
       local pUnit = pPlayer:GetUnitByID(iNewUnit)
       if pUnit:GetUnitType() == iLancer then
           if load(pPlayer, "Decisions_OttomanGunpowder") == true then
               local pPlot = pPlayer:GetUnitByID(iNewUnit):GetPlot()
               pUnit:Kill(false, -1)
               local iBringerofDeath = pPlayer:InitUnit(iSipahi, pPlot:GetX(), pPlot:GetY())
               iBringerofDeath:JumpToNearestValidPlot()
               iBringerofDeath:SetExperience(pPlayer:GetUnitByID(iOldUnit):GetExperience())
           elseif load(pPlayer, "Decisions_SwedenIndelningsverket") == true then
               local pPlot = pPlayer:GetUnitByID(iNewUnit):GetPlot()
               pUnit:Kill(false, -1)
               local iBringerofDeath = pPlayer:InitUnit(iHakkapeliitta, pPlot:GetX(), pPlot:GetY())
               iBringerofDeath:JumpToNearestValidPlot()
               iBringerofDeath:SetExperience(pPlayer:GetUnitByID(iOldUnit):GetExperience())
           end
       elseif pUnit:GetUnitType() == iGalleasses then
           if load(pPlayer, "Decisions_VenetianArsenale") == true then
               local pPlot = pPlayer:GetUnitByID(iNewUnit):GetPlot()
               pUnit:Kill(false, -1)
               local iBringerofDeath = pPlayer:InitUnit(iGalleass, pPlot:GetX(), pPlot:GetY())
               iBringerofDeath:JumpToNearestValidPlot()
               iBringerofDeath:SetExperience(pPlayer:GetUnitByID(iOldUnit):GetExperience())
           end
       elseif pUnit:GetUnitType() == iCrossbow then
           if load(pPlayer, "Decisions_EnglishArmada") == true then
               local pPlot = pPlayer:GetUnitByID(iNewUnit):GetPlot()
               pUnit:Kill(false, -1)
               local iBringerofDeath = pPlayer:InitUnit(iLongbow, pPlot:GetX(), pPlot:GetY())
               iBringerofDeath:JumpToNearestValidPlot()
               iBringerofDeath:SetExperience(pPlayer:GetUnitByID(iOldUnit):GetExperience())
           end
       elseif pUnit:GetUnitType() == iCaravel then
           if load(pPlayer, "Decisions_KoreanGunpowder") == true then
               local pPlot = pPlayer:GetUnitByID(iNewUnit):GetPlot()
               pUnit:Kill(false, -1)
               local iBringerofDeath = pPlayer:InitUnit(iTurtleShip, pPlot:GetX(), pPlot:GetY())
               iBringerofDeath:JumpToNearestValidPlot()
               iBringerofDeath:SetExperience(pPlayer:GetUnitByID(iOldUnit):GetExperience())
           end
       end
    end
    New code looks like this:

    Code:
    function TheLastModder(iPlayer, iOldUnit, iNewUnit, bGoodyHut)
       local pPlayer = Players[iPlayer]
       local pUnit = pPlayer:GetUnitByID(iNewUnit)
       if pUnit:GetUnitType() == iLancer then
           if load(pPlayer, "Decisions_OttomanGunpowder") == true then
               local pBringerofDeath = pUnit:UpgradeTo(iSipahi, true)
               pBringerofDeath:Convert(pPlayer:GetUnitByID(iOldUnit), true)
           elseif load(pPlayer, "Decisions_SwedenIndelningsverket") == true then
               local pBringerofDeath = pUnit:UpgradeTo(iHakkapeliitta, true)
               pBringerofDeath:Convert(pPlayer:GetUnitByID(iOldUnit), true)
           end
       elseif pUnit:GetUnitType() == iGalleasses then
           if load(pPlayer, "Decisions_VenetianArsenale") == true then
               local pBringerofDeath = pUnit:UpgradeTo(iGalleass, true)
               pBringerofDeath:Convert(pPlayer:GetUnitByID(iOldUnit), true)
           end
       elseif pUnit:GetUnitType() == iCrossbow then
           if load(pPlayer, "Decisions_EnglishArmada") == true then
               local pBringerofDeath = pUnit:UpgradeTo(iLongbow, true)
               pBringerofDeath:Convert(pPlayer:GetUnitByID(iOldUnit), true)
           end
       elseif pUnit:GetUnitType() == iCaravel then
           if load(pPlayer, "Decisions_KoreanGunpowder") == true then
               local pBringerofDeath = pUnit:UpgradeTo(iTurtleShip, true)
               pBringerofDeath:Convert(pPlayer:GetUnitByID(iOldUnit), true)
           end
       end
    end
    Bonus is that it fixes the issue where the new unit is spawned at a hex next to the original unit.

    I recommend posting a hotfix as this is causing a crash. As it is Lua, it is save game compatible.

    To users of this mod: Though I'm not sure if my version is the same as the public version, I'll post a fix. Replace "...\MODS\(8) Events and Decisions (CBO) (v 14)\Core\Decisions\Civ Decisions\CivDecisions.lua" with the attached file.
     

    Attached Files:

    JNZS13 likes this.
  8. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,189
    Gender:
    Male
    Location:
    Somewhere in California
    wow very based
     
  9. Handamoose

    Handamoose Chieftain

    Joined:
    Dec 7, 2018
    Messages:
    7
    Gender:
    Male
    Location:
    United States
    It seems the huns tribute decision completely removes the option for either party to ever declare war on one another ever again. This is pretty gamebreaking since as the huns I can get an infinite peace with my enemies.
    The only mods I'm using other than yours and the required ones, is the Enlightenment Era for Vox Populi and the 3rd and 4th unique components for vox populi.


    I'm on the 3-14 beta if that helps with solving this.
     
  10. LucidAPs

    LucidAPs Chieftain

    Joined:
    Nov 10, 2016
    Messages:
    27
    Gender:
    Male
    I am really hoping for an update, i love this mod.
     
    Erikose and akasha27 like this.
  11. akasha27

    akasha27 Chieftain

    Joined:
    Feb 13, 2013
    Messages:
    59
    Location:
    Principality of Sealand
    same here!
     
  12. Erikose

    Erikose Chieftain

    Joined:
    Nov 28, 2012
    Messages:
    74
    About to start a 4-20.x playthrough. Is this now unplayable unless you use HungryForFood's version? Even in it's present state, I always include this as I love the extra flavor it brings to various civs I play.

    Look forward to the new version, and live in hope of an update soon!

    - E
     
  13. KittyKat3120

    KittyKat3120 Chieftain

    Joined:
    Oct 13, 2018
    Messages:
    19
    I hope so too
    But am wondering how is the progress like as it's been over a year since the last update
     
  14. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,189
    Gender:
    Male
    Location:
    Somewhere in California
    It annoys me that there are constant happiness tweaks that I have to change or rework some of the decisions.
     
  15. AndreyK

    AndreyK Chieftain

    Joined:
    Mar 31, 2017
    Messages:
    31
    Gender:
    Male
    I am playing with the new VP update (June). Entered Renaissance and already two times Tax reform culture cost more than next social policy.
     

Share This Page