BannerlordCE / CEEvents

Captivity Events Source Code
https://www.nexusmods.com/mountandblade2bannerlord/mods/1226
MIT License
4 stars 6 forks source link

Do not follow me Companion Crash #6

Closed TheBadListener closed 4 years ago

TheBadListener commented 4 years ago

Connected with issue #1

In the CompanionRolesCampaignBehavior

private void companion_dont_follow_me_on_consequence()
        {
            Agent oneToOneConversationAgent = ConversationMission.OneToOneConversationAgent;
            oneToOneConversationAgent.GetComponent<CampaignAgentComponent>().AgentNavigator.GetBehaviorGroup<DailyBehaviorGroup>().RemoveBehavior<FollowAgentBehavior>();
            LocationCharacter locationCharacter = LocationComplex.Current.FindCharacter(oneToOneConversationAgent);
            AccompanyingCharacter accompanyingCharacter = PlayerEncounter.LocationEncounter.GetAccompanyingCharacter(locationCharacter);
            accompanyingCharacter.IsFollowingPlayer = false;
            this._isFollowingPlayer.Remove(accompanyingCharacter.LocationCharacter.Character.HeroObject);
        }

The actual current LocationComplex does not contain the location of brothel, therefore there is a disconnect and when it returns a null on the

LocationCharacter locationCharacter = LocationComplex.Current.FindCharacter(oneToOneConversationAgent);

It crashes.