Events system brainstorm

VP has a much better Lua API. We just lack documentation - but you only need a tiny bit of C++ knowledge to check what each function does and what parameters it takes.
 
I'm playing my game again and another thought occurred to me regarding events. Can we get a Resource expansion pack? This is just an idea to add even more events to the game and I'm thinking they'd best be one-time events (though, perhaps someone else has other ideas), sort of like what you designed here.

So, for example, when a city gains a Fish Resource then the Fish Resource Event fires. If it gains Iron then the Iron Resource Event fires. Etc. I don't know if it should fire for every single time you'd gain the resource, because that may be excessive. 🤷‍♂️
I've been thinking about this, and here is what I'm pondering. Initial thoughts?
Spoiler Initial thoughts :

Screenshot 2024-09-012.jpg

Still trying to figure out uranium and coal. Would also like a bit more variety but need a good reason for any events firing.
 
I've been thinking about this, and here is what I'm pondering. Initial thoughts?
Spoiler Initial thoughts :

Still trying to figure out uranium and coal. Would also like a bit more variety but need a good reason for any events firing.
I'm sorry but it's been so long since I've even tried this mod in anyway, I'm going to have to go back to the beginning, reread, & then reply to make any sense of this post.
 
Does this look like it will work?

Spoiler Event Code :


Code:
--------------------------------------------------------------
-- Dummy Policy Creator for Religious Events
--------------------------------------------------------------

local ePilgrimageBelief = GameInfoTypes.BELIEF_PILGRIMAGE
local eCeremonialBurialBelief = GameInfoTypes.BELIEF_CEREMONIAL_BURIAL
local eCouncilofEldersBelief = GameInfoTypes.BELIEF_PAPAL_PRIMACY
local eHeroWorshipBelief = GameInfoTypes.BELIEF_INTERFAITH_DIALOGUE
local eHolyLawBelief = GameInfoTypes.BELIEF_CHURCH_PROPERTY
local eDivineInheritanceBelief = GameInfoTypes.BELIEF_PEACE_LOVING
local eTheocraticRuleBelief = GameInfoTypes.BELIEF_WORLD_CHURCH
local eRevelationBelief = GameInfoTypes.BELIEF_TITHE
local eTranscendentThoughtsBelief = GameInfoTypes.BELIEF_INITIATION_RITES

local ePilgrimageDummyPolicy = GameInfoTypes.POLICY_PILGRIMAGE_DUMMY
local eCeremonialBurialDummyPolicy = GameInfoTypes.POLICY_CEREMONIAL_BURIAL_DUMMY
local eCouncilofEldersDummyPolicy = GameInfoTypes.POLICY_PAPAL_PRIMACY_DUMMY
local eHeroWorshipDummyPolicy = GameInfoTypes.POLICY_INTERFAITH_DIALOGUE_DUMMY
local eHolyLawDummyPolicy = GameInfoTypes.POLICY_CHURCH_PROPERTY_DUMMY
local eDivineInheritanceDummyPolicy = GameInfoTypes.POLICY_PEACE_LOVING_DUMMY
local eTheocraticRuleDummyPolicy = GameInfoTypes.POLICY_WORLD_CHURCH_DUMMY
local eRevelationDummyPolicy = GameInfoTypes.POLICY_TITHE_DUMMY
local eTranscendentThoughtsDummyPolicy = GameInfoTypes.POLICY_INITIATION_RITES_DUMMY

local tBeliefPolicy = {
    [ePilgrimageBelief] = ePilgrimageDummyPolicy,
    [eCeremonialBurialBelief] = eCeremonialBurialDummyPolicy,
    [eCouncilofEldersBelief] = eCouncilofEldersDummyPolicy,
    [eHeroWorshipBelief] = eHeroWorshipDummyPolicy,
    [eHolyLawBelief] = eHolyLawDummyPolicy,
    [eDivineInheritanceBelief] = eDivineInheritanceDummyPolicy,
    [eTheocraticRuleBelief] = eTheocraticRuleDummyPolicy,
    [eRevelationBelief] = eRevelationDummyPolicy,
    [eTranscendentThoughtsBelief] = eTranscendentThoughtsDummyPolicy,
}

function OnReligionFoundDummy(ePlayer, eHolyCity, eReligion, eBelief1, eBelief2, eBelief3, eBelief4, eBelief5)

    local pPlayer = Players[ePlayer]
    local tOwnedBelief = {eBelief1, eBelief2, eBelief3, eBelief4, eBelief5}

--------------------------------------------------------------
-- Shuffling the owned beliefs so Byzantium is randomized
--------------------------------------------------------------
    for i = 1, 4 do
        local r = math.random(i, 5)
         tOwnedBelief[i],  tOwnedBelief[r] =  tOwnedBelief[r],  tOwnedBelief[i]
    end

    for _, eOwnedBelief in tOwnedBelief do
        for eBelief, ePolicy in tBeliefPolicy do
            if eOwnedBelief == eBelief then
                pPlayer:SetNumFreePolicies(1)
                pPlayer:SetNumFreePolicies(0)
                pPlayer:SetHasPolicy(GameInfoTypes[ePolicy], true)
                sPolicyName = Locale.ConvertTextKey(GameInfo.Policies[ePolicy].Description)
                print(sPolicyName .. " is active")

                return  -- Added the return to jump out of the function for Byzantium

            end
        end
    end
end

GameEvents.ReligionFounded.Add(OnReligionFoundDummy)
 
Last edited:
Back
Top Bottom