[BNW] Modding beginner needs advice on a small but complex mod (links are enough)

Pawelec123456

Chieftain
Joined
Jun 29, 2016
Messages
33
I'm developing a mod which removes all World Wonder-related bonuses from the game so I can disable World Wonders without creating pointless choices. I'd like to get some opinions about the changes I proposed.

Policy branch wonders are converted to National Wonders.

Pantheon belief Monuments to the Gods: +1 :c5faith: Faith from each Monument and Marble resource
Follower belief Divine Inspiration: Shrines and Temples provide +1 :c5production: Production in cities with at least 4 followers
Social Policy Aristocracy: +2, +10% :c5production: Production in the :c5capital: Capital and +1 :c5happy: Happiness for every 10 :c5citizen: Citizens in a City
Social Policy Flourishing of the arts: +20% :c5culture: Culture in each city which has a :greatwork: Great Work and the empire immediately enters a :c5goldenage: Golden Age
World Congress decision Cultural Heritage Sites: Great Person tile improvements provide +3 :c5culture: Culture when worked (analogous bonus is removed from Historical Landmarks)
UA for Ramesses: +2 :c5production: Production for all specialists and for all Great Person tile improvements. A Great Engineer appears after researching Masonry.
UA for Napoleon: All :greatwork: Great Work and Artifact theming bonuses in the :c5capital: Capital are doubled. (note: it already works that way, the text is just misleading)

After BNW changes are applied I'll focus on adjusting JFDLC boni.
 
Last edited:
Considering you didn't post this in the Community Patch section where the most-esteemed modmod maker usually frequents...
Aristocracy: +10% Production towards Buildings in the Capital
Make a dummy building, use NewCityFreeBuilding in the Policy of Aristocracy BUT this dummy building must have a CapitalOnly property. This allows the dummy building to transfer between capital changes.
Flourishing of the arts: Culture increased by 17% in all cities which have a Great Work
Lua through PlayerDoTurn where you have to constantly check whether a Great Work exist and add a dummy building that provides a +17% Culture.
- modifying World Congress decision effects:
Cultural Heritage Sites: each Great Work provides +1 Culture
Lua while creating a dummy policy (however this has the unfortunate effect of not checking for any reviving players nor dead players, so you're going to test that out when removing the :IsAlive() tag.
Code:
function blahblah (iResolution, iChoice, bEnact, bPassed)
if iResolution == GameInfoTypes.Cultural_heritage_something then
  if bPassed then
    for playerID = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
        local pPlayer = Players[playerID]
        if pPlayer:IsAlive() then
            pPlayer:GrantPolicy(GameInfoTypes.DummyPolicy, true)
        end
    end
  elseif bEnact and bPassed then
    for playerID = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
        local pPlayer = Players[playerID]
        if pPlayer:IsAlive() then
            pPlayer:RevokePolicy(GameInfoTypes.DummyPolicy, true)
        end
    end
end
end

GameEvents.ResolutionResult.Add(blahblah)
- modifying effects of buildings:
Hotel/Airport: 50% of Culture from Buildings and Improvements is added to the Tourism output of the city
This is some advanced PlayerDoTurn Lua where you're going to have to gather the culture gained from buildings into CityView.lua and transfer them into dummy buildings that creates tourism. If tourism stacks in Community Patch in the forms of stacking dummy buildings. Then you're good. Otherwise if not talk to me later on that.

- adding buildings and National Wonders requiring a Social Policy to be adopted:
each branch unlocks one specialist building and having it in all cities allows building a National Wonder
See Unique Policy Building
- modifying civ's UA:
Egypt: Receive free Great Engineer when you discover Masonry. Earn Great Engineers 50% faster.
See how Venice gets their Free Merchant.
France: All Great Work theming bonuses are doubled in their Capital.
I have no clue if it's just the capital. I could have swore this was VP's France UA for quite a while, but I probably forgot.

It is incredibly easy to modify existing social policies using SQL. See
Code:
UPDATE Policies
SET NewCityFreeBuilding = 'BUILDINGCLASS_DUMMY101'
WHERE Type = 'POLICY_ARISTOCRACY';
 
Last edited:
I'm almost done with the basic part and I'd like to move to adding mod support. The problem is proposed solution for Cultural Heritage Sites resolution doesn't work:
Code:
function NWIWCulturalHeritage (iResolution, iChoice, bEnact, bPassed)
if iResolution == GameInfoTypes.RESOLUTION_CULTURAL_HERITAGE_SITES then
  if bPassed then
    for playerID = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
        local pPlayer = Players[playerID]
--        if pPlayer:IsAlive() then
        pPlayer:GrantPolicy(GameInfoTypes.POLICY_NWIW_CULTURAL_HERITAGE, true)
--        end
    end
  elseif bEnact and bPassed then
    for playerID = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
        local pPlayer = Players[playerID]
--        if pPlayer:IsAlive() then
        pPlayer:RevokePolicy(GameInfoTypes.POLICY_NWIW_CULTURAL_HERITAGE, true)
--        end
    end
end
end

GameEvents.ResolutionResult.Add(NWIWCulturalHeritage)
Another problem is the resolution miraculously repeals itself after being enacted when I apply SQL changes:
Code:
UPDATE Resolutions
SET CulturePerWonder = 0
WHERE CulturePerWonder IS NOT NULL;

UPDATE Resolutions
SET Help = 'TXT_KEY_RESOLUTION_NWIW_CULTURAL_HERITAGE_SITES_HELP'
WHERE Type == 'RESOLUTION_CULTURAL_HERITAGE_SITES';
 
Last edited:
The game reacts violently also to your SQL entries. Check your local SQL guide.

Also what do you mean when it is repealed? The resolution itself or the dummy policy?
 
The resolution itself is repealed right after being enacted - the popup tells it was enacted but I still can choose to propose it in the following screen. It is caused by the SQL because when I try to apply only the LUA the resolution is enacted properly. However, the LUA doesn't work as there is no change in the Great Work yields.

Waiting for a reply I tried making a "Culture increased by 17% in all cities which have a Great Work" LUA but failed miserably. I got a solid grasp at SQL but LUA is still out of my control... And I'm not sure how to approach the "Gain Great Engineers #% faster" trait because I hoped Babylonian trait would be useful but it turned out to be hardcoded for Great Scientists instead.
 
To approach your Egypt UA change, my recommendation is to just flat out give a Great People buff on a dummy policy, then apply a negative buff on the other great people, since the only GP that doesn't have its own social policy xml tag is the Great Engineer.
Code:
<GameData>
    <Policies>
        <Row>
            <Type>POLICY_DUMMY_ENGINEER_BUFF</Type>
            <Description>TXT_KEY_POLICY_DUMMY_ENGINEER_BUFF</Description>
            <GreatPeopleRateModifier>50</GreatPeopleRateModifier>
            <GreatWriterRateModifier>-50</GreatWriterRateModifier>
            <GreatArtistRateModifier>-50</GreatArtistRateModifier>
            <GreatMusicianRateModifier>-50</GreatMusicianRateModifier>
            <GreatMerchantRateModifier>-50</GreatMerchantRateModifier>
            <GreatScientistRateModifier>-50</GreatScientistRateModifier>
            <PortraitIndex>1</PortraitIndex>
            <IconAtlas>POLICY_ATLAS_EXP2</IconAtlas>
            <IconAtlasAchieved>POLICY_A_ATLAS_EXP2</IconAtlasAchieved>
        </Row>
    </Policies>
</GameData>

Then go lua and add a function to give such a policy to a player.
Code:
local mechanistesPolicy = GameInfoTypes["POLICY_DUMMY_ENGINEER_BUFF"]
local aigyptosCiv = GameInfoTypes["CIVILIZATION_EGYPT"]

for iPlayer = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
    local agonistes = Players[iPlayer]
    if agonistes:GetCivilizationType() == aigyptosCiv then
        if not agonistes:HasPolicy(mechanistesPolicy) then    
            agonistes:SetNumFreePolicies(1)
            agonistes:SetHasPolicy(mechanistesPolicy, true)
            agonistes:SetNumFreePolicies(0)
        end
    end
end
 
Last edited:
This solution literally screams at me: FORGET MOD SUPPORT!
I was hoping the CBP DLL could prove helpful here just like it did with the Unified Yields.
 
Back
Top Bottom