CBP Events and Decisions Compatibility

Yeah it looks like it should be part of the prohibition choice, but the sugar is received on the wild horses choice.
 
Yeah it looks like it should be part of the prohibition choice, but the sugar is received on the wild horses choice.
But the Prohibition Choice is granting the Sugar? Was this with the recent version or...?
 
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.
 
you cant have the most recent version. I just tested it right now. Wild Horse Choices offer +2 Horses, not 2 Sugars.
 
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 :(
 
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.
 

Attachments

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.
wow very based
 
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.
 
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
 
It annoys me that there are constant happiness tweaks that I have to change or rework some of the decisions.
 
I am playing with the new VP update (June). Entered Renaissance and already two times Tax reform culture cost more than next social policy.
 
Back
Top Bottom