Fixed: Crashing the Official Game at start

Issue Summary:
My friend runned my MorePlayers mod in modded realm. After we where done she went back to official realm and keeps crashing after the intro video.


Steps to Reproduce:

  1. Start the game in official realm
  2. crash

Reproduction Rate (Choose One):
Constant (100%)

Additional Information:
I am the creator of the mod MorePlayers mod and tested the mod a lot of times. But in a unknown way she manage to change the PlayerData.bot_spawn_priority in modded realm.

This variable contains now more values then expected. Now the official game can not handle this extra data it contains and crash the official game.

Hopefully you can fix her account.

PS: I made this mod now hidden, like no one else can get this issue.

Reference:
OptionsView._get_original_bot_spawn_priority
OptionsView.cb_bot_spawn_priority_setup

----

Should only be a local change right as opposed to one in her account data. If you know which file is altered, delete that and verify the game cache

1 Like

Thx, that fixed it <3

1 Like
--[[
    Because the MorePlayers mod had a different ProfilePriority with more elements.
    The bot_spawn_priority is in a rare case influenced by the ProfilePriority and adds more elements to this
    data. The official game cant handle with these extra elements and crashes at start.
    
    Fix:
        - Before PlayerData is been saved check if the bot_spawn_priority has not to much elements
]]--
local mod = get_mod("MorePlayers")

mod:hook(SaveManager, "auto_save", function(func, self, file_name, data, ...)
    mod:debug("SaveManager.auto_save()")
    
    local all_players_data = data.player_data
    for key, value in pairs(all_players_data) do
        local player_data = all_players_data[key]
        
        if player_data.bot_spawn_priority and #player_data.bot_spawn_priority > 5 then
            player_data.bot_spawn_priority = {[1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5}
        end
    end
    
    return func(self, file_name, data, ...)
end)

This is the fix i made. It prevents the modded realm to save to much elements in the PlayerData, like its cant corrupt the user anymore

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.