private static void SetVassal(Hero hero) { //Find a clan that matches culture string culture = hero.Culture.StringId; Hero lord = Hero.FindAll((Hero tmp) => (tmp.Culture.StringId == hero.Culture.StringId) && tmp.IsAlive && tmp.IsFactionLeader && !tmp.MapFaction.IsMinorFaction).GetRandomElementInefficiently <Hero>(); if (lord != null) //Adding to prevent crash on custom cultures with no kingdom { Clan targetclan = lord.Clan; CharacterRelationManager.SetHeroRelation(hero, lord, 10); ChangeKingdomAction.ApplyByJoinToKingdom(hero.Clan, targetclan.Kingdom, false); GainKingdomInfluenceAction.ApplyForJoiningFaction(hero, 10f); } }