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

[BNW] Modding world congress proposals

Discussion in 'Civ5 - Creation & Customization' started by fertiliser, Nov 24, 2018.

  1. fertiliser

    fertiliser Chieftain

    Joined:
    Nov 24, 2018
    Messages:
    8
    Something as simple as spawning a dummy building when a world congress resolution is active, and despawning if repealed. Either that, or attaching regular global bonuses to all members via some other method.

    How would one go about making this?
     
  2. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,228
    Gender:
    Male
    Location:
    Somewhere in California
    need a custom dll like community patch and vmc and working with their gameevents.. I remember one mod doing something about it, but he said something about resolution flavor are superhardcoded beside projects so you'll have to just hope for the best when you're making a neutral resolution as possible.

    it's doable but don't get too attached.
     
  3. fertiliser

    fertiliser Chieftain

    Joined:
    Nov 24, 2018
    Messages:
    8
    Yeah, they're really messed up. Flavours seem to be defined as straight up nonparameter integers in the DLL. Projects look modder-friendly, but unfortunately I won't be using them.

    What if I wanted to add an existing modifier or ability from social policies to a resolution, though? Say, for example, replace "arts funding" with "espionage funding", and tack on StealTechFasterModifier=100. Are there any tutorials or reference material that you could point to?
     
  4. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,228
    Gender:
    Male
    Location:
    Somewhere in California
    If you wanted to add an existing modifier to an already-existing resolution. That's pretty easy. Let me just find a mod it won't take a day or two...
     
  5. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,228
    Gender:
    Male
    Location:
    Somewhere in California
    fertiliser likes this.
  6. fertiliser

    fertiliser Chieftain

    Joined:
    Nov 24, 2018
    Messages:
    8
    From PillageMyShip.lua
    Code:
    --[[local tResolutionDummyPolicyPairs = { [GameInfoTypes.RESOLUTION_SOMETHING] = { Enacted=GameInfoTypes.POLICY_GMS_ENACTED, Repealed=GameInfoTypes.POLICY_GMS_REPEALED } }
    
    function SetDummyPolicyPairsForOnePlayer(pPlayer, iAddedPolicy, iPlaceholderPolicy, sAddOrRemove)
        if (sAddOrRemove == "Add") then
            if not pPlayer:HasPolicy(iAddedPolicy) then
                if pPlayer:HasPolicy(iPlaceholderPolicy) then
                    pPlayer:SetHasPolicy(iPlaceholderPolicy, false)
                    pPlayer:SetHasPolicy(iAddedPolicy, true)
                else
                    pPlayer:SetNumFreePolicies(1)
                    pPlayer:SetNumFreePolicies(0)
                    pPlayer:SetHasPolicy(iAddedPolicy, true)
                end
            end
        end
        if (sAddOrRemove == "Remove") then
            if pPlayer:HasPolicy(iAddedPolicy) then
                pPlayer:SetHasPolicy(iAddedPolicy, false)
                pPlayer:SetHasPolicy(iPlaceholderPolicy, true)
            end
        end
    end
    function SetDummyPolicyPairsForAllMajors(iAddedPolicy, iPlaceholderPolicy, sAddOrRemove)
        for iPlayer = 0, GameDefines.MAX_MAJOR_CIVS - 1 do
            local pPlayer = Players[iPlayer]
            if pPlayer:IsAlive() then
                SetDummyPolicyPairsForOnePlayer(pPlayer, iAddedPolicy, iPlaceholderPolicy, sAddOrRemove)
            end
        end
    end
    
    function ResolutionPassed(iResolution, iChoice, bEnact, bPassed)
        if tResolutionDummyPolicyPairs[iResolution] then
            if bEnact and bPassed then
                SetDummyPolicyPairsForAllMajors(tResolutionDummyPolicyPairs[iResolution].Enacted, tResolutionDummyPolicyPairs[iResolution].Repealed, "Add")
            end
            if not bEnact and bPassed then
                SetDummyPolicyPairsForAllMajors(tResolutionDummyPolicyPairs[iResolution].Enacted, tResolutionDummyPolicyPairs[iResolution].Repealed, "Remove")
            end
        end
    end
    GameEvents.ResolutionResult.Add(ResolutionPassed)
    
    iGeneticSoldierBuilding = GameInfoTypes.BUILDING_GENETIC_SOLDIER_BUILDING
    iGeneticSoldeirBuildingRequiredPolicy = tResolutionDummyPolicyPairs[GameInfoTypes.RESOLUTION_SOMETHING].Enacted
    
    function ApprovedGeneticallyModifiedSoldierBuilding(PlayerID, BuildingType)
        if BuildingType == iGeneticSoldierBuilding then
            local pPlayer = Players[PlayerID]
            return (pPlayer:HasPolicy(iGeneticSoldeirBuildingRequiredPolicy))
        end
        return true --default to true for all other buildings
    end
    GameEvents.CityCanConstruct.Add(ApprovedGeneticallyModifiedSoldierBuilding)]]
    
    This is very useful code, thanks for sharing. I'll see if I can wrap my head around pairing policies with resolutions.
     
  7. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,228
    Gender:
    Male
    Location:
    Somewhere in California
    Oh haha those are some old code.

    In the recent CP version, you can use Game.IsResolutionPassed(iResolution, -1 or iChoice) to check if it got passed.
     
  8. fertiliser

    fertiliser Chieftain

    Joined:
    Nov 24, 2018
    Messages:
    8
    I can't find "IsResolutionPassed" anywhere in (1) Community Patch (v 88). Am I looking in the right place?
     
  9. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,228
    Gender:
    Male
    Location:
    Somewhere in California
    cuz it's not documented :p
    upload_2018-11-30_11-34-39.png

    you can see examples here
    Code:
    function StopBullyGold(iPlayer, iCS)
       if Game.IsResolutionPassed(iOpen, iCS) then
            return false
        end
        return true
    end
    
    function StopBullyUnit(iPlayer, iCS)
        if Game.IsResolutionPassed(iOpen, iCS) then
            return false
        end
        return true
    end
    
    GameEvents.PlayerCanBullyGold.Add(StopBullyGold)
    GameEvents.PlayerCanBullyUnit.Add(StopBullyUnit)
    in some of that World Congress Lua file I have there.
     

Share This Page