Partial journal sharing?

Everything having to do with OpenMW's TES3MP branch.
davidcernat
Posts: 119
Joined: 19 Jul 2016, 01:02

Re: Partial journal sharing?

Post by davidcernat » 22 Mar 2018, 19:00

Why iterate through the player-specific previous quests at myMod.lua#L735 ?

Instead, you should add this main quest-checking function to myMod.lua somewhere:

Code: Select all

Methods.IsReceivingMainQuestJournal = function(pid)

    local mainQuestPrefixes = { "a1", "a2", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "c0", "c2", "c3" }

    for i = 0, tes3mp.GetJournalChangesSize(pid) - 1 do

        local quest = tes3mp.GetJournalItemQuest(pid, i)
        local questPrefix = string.sub(quest, 1, 2)

        if tableHelper.containsValue(mainQuestPrefixes, questPrefix) then
            return true
        end
    end

    return false
end
Then you change these lines:

Code: Select all

Methods.OnPlayerJournal = function(pid)
    if Players[pid] ~= nil and Players[pid]:IsLoggedIn() then

        if config.shareJournal == true then
            WorldInstance:SaveJournal(pid)
            tes3mp.SendJournalChanges(pid, true)
        else
            Players[pid]:SaveJournal()
        end
    end
end
Into this:

Code: Select all

Methods.OnPlayerJournal = function(pid)
    if Players[pid] ~= nil and Players[pid]:IsLoggedIn() then

        if Methods.IsReceivingMainQuestJournal(pid) then
            WorldInstance:SaveJournal(pid)
            tes3mp.SendJournalChanges(pid, true)
        else
            Players[pid]:SaveJournal()
        end
    end
end
Last edited by davidcernat on 22 Mar 2018, 19:58, edited 1 time in total.

unelsson
Posts: 96
Joined: 17 Mar 2018, 14:57

Re: Partial journal sharing?

Post by unelsson » 22 Mar 2018, 19:33

Thank you! Great to see how neat and easy that could be implemented. I'm not an experienced coder, so it's quite a feat for me to figure out those functions in openmw-code. Tested that code, and it works like I hoped it would.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests