When spawning a custom division with a custom class division, it crashes in MissionMultiplayerGameModeBase.OnMissionTick:
The reason is that MultiplayerClassDivisions.GetMPHeroClasses tries to find class divisions matching the culture. But my game mode doesn't need culture, class divisions or perks. The work-around is to either duplicate the custom class division for each custom culture, or to avoid calling base.OnMissionTick which assumes nothing is important in the base class.
I wish there was no mentions of class divisions or perks in the base classes.
Code:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
at System.Collections.Generic.List`1.get_Item(Int32 index)
at TaleWorlds.MountAndBlade.MultiplayerClassDivisions.GetMPHeroClassForPeer(MissionPeer peer, Boolean skipTeamCheck)
at TaleWorlds.MountAndBlade.MultiplayerClassDivisions.GetAvailablePerksForPeer(MissionPeer missionPeer)
at TaleWorlds.MountAndBlade.MissionPeer.get_SelectedPerks()
at TaleWorlds.MountAndBlade.MPPerkObject.GetPerkHandler(MissionPeer peer)
at TaleWorlds.MountAndBlade.MPPerkObject.TickAllPeerPerks(Int32 tickCount)
at TaleWorlds.MountAndBlade.MissionMultiplayerGameModeBase.OnMissionTick(Single dt)
at Crpg.Module.Modes.Battle.CrpgBattleServer.OnMissionTick(Single dt)
at TaleWorlds.MountAndBlade.Mission.OnTick(Single dt, Single realDt, Boolean updateCamera, Boolean doAsyncAITick)
at TaleWorlds.MountAndBlade.MissionState.TickMissionAux(Single dt, Single realDt, Boolean updateCamera, Boolean asyncAITick)
at TaleWorlds.MountAndBlade.MissionState.TickMission(Single realDt)
at TaleWorlds.MountAndBlade.MissionState.OnTick(Single realDt)
at TaleWorlds.Core.GameStateManager.OnTick(Single dt)
at TaleWorlds.Core.Game.OnTick(Single dt)
at TaleWorlds.Core.GameManagerBase.OnTick(Single dt)
at TaleWorlds.MountAndBlade.Module.OnApplicationTick(Single dt)
at TaleWorlds.MountAndBlade.CoreManaged.TaleWorlds.DotNet.IManagedComponent.OnApplicationTick(Single dt)
at TaleWorlds.DotNet.Managed.ApplicationTick(Single dt)
at ManagedCallbacks.LibraryCallbacksGenerated.Managed_ApplicationTick(Single dt)
The reason is that MultiplayerClassDivisions.GetMPHeroClasses tries to find class divisions matching the culture. But my game mode doesn't need culture, class divisions or perks. The work-around is to either duplicate the custom class division for each custom culture, or to avoid calling base.OnMissionTick which assumes nothing is important in the base class.
I wish there was no mentions of class divisions or perks in the base classes.