BL Coding Where to find required relation for recruiting in settlements?

Users who are viewing this thread

Unterkatze

Recruit
I want to edit the value required relation for recruiting in settlements and citys. Can`t find it. Can someone help me out?
 
Solution
I think this is it, in Helpers.HeroHelper.MaximumIndexHeroCanRecruitFromHero():

C#:
        public static int MaximumIndexHeroCanRecruitFromHero(Hero buyerHero, Hero sellerHero, int useValueAsRelation = -101)
        {
            int num = 1;
            int num2 = (buyerHero == Hero.MainHero) ? Campaign.Current.Models.DifficultyModel.GetPlayerRecruitSlotBonus() : 0;
            int num3 = (sellerHero.CurrentSettlement != null && buyerHero.MapFaction == sellerHero.CurrentSettlement.MapFaction) ? 1 : 0;
            int num4 = (sellerHero.CurrentSettlement != null && buyerHero.MapFaction.IsAtWarWith(sellerHero.CurrentSettlement.MapFaction)) ? -1 : 0;
            int num5 = (useValueAsRelation < -100) ? buyerHero.GetRelation(sellerHero)...

mr_mouflon

Recruit
I think this is it, in Helpers.HeroHelper.MaximumIndexHeroCanRecruitFromHero():

C#:
        public static int MaximumIndexHeroCanRecruitFromHero(Hero buyerHero, Hero sellerHero, int useValueAsRelation = -101)
        {
            int num = 1;
            int num2 = (buyerHero == Hero.MainHero) ? Campaign.Current.Models.DifficultyModel.GetPlayerRecruitSlotBonus() : 0;
            int num3 = (sellerHero.CurrentSettlement != null && buyerHero.MapFaction == sellerHero.CurrentSettlement.MapFaction) ? 1 : 0;
            int num4 = (sellerHero.CurrentSettlement != null && buyerHero.MapFaction.IsAtWarWith(sellerHero.CurrentSettlement.MapFaction)) ? -1 : 0;
            int num5 = (useValueAsRelation < -100) ? buyerHero.GetRelation(sellerHero) : useValueAsRelation;
            int num6 = (num5 >= 100) ? 7 : ((num5 >= 80) ? 6 : ((num5 >= 60) ? 5 : ((num5 >= 40) ? 4 : ((num5 >= 20) ? 3 : ((num5 >= 10) ? 2 : ((num5 >= 5) ? 1 : ((num5 >= 0) ? 0 : -1)))))));
            return Math.Max(0, num + num6 + num2 + num3 + num4);
        }

Called from CampaignSystem.ViewModelCollection.GameMenu.RecruitVolunteerTroopVM:

C#:
            this.Owner = owner;
            if (this.Owner != null)
            {
                this._currentRelation = Hero.MainHero.GetRelation(this.Owner.OwnerHero);
            }
            this._maximumIndexCanBeRecruit = HeroHelper.MaximumIndexHeroCanRecruitFromHero(Hero.MainHero, this.Owner.OwnerHero, -101);
            for (int i = -100; i < 100; i++)
            {
                if (index < HeroHelper.MaximumIndexHeroCanRecruitFromHero(Hero.MainHero, this.Owner.OwnerHero, i))
                {
                    this._requiredRelation = i;
                    break;
                }
            }
 
Upvote 0
Solution

Mr.Kebab

Veteran
WBWF&SNWVC
I think this is it, in Helpers.HeroHelper.MaximumIndexHeroCanRecruitFromHero():

C#:
        public static int MaximumIndexHeroCanRecruitFromHero(Hero buyerHero, Hero sellerHero, int useValueAsRelation = -101)
        {
            int num = 1;
            int num2 = (buyerHero == Hero.MainHero) ? Campaign.Current.Models.DifficultyModel.GetPlayerRecruitSlotBonus() : 0;
            int num3 = (sellerHero.CurrentSettlement != null && buyerHero.MapFaction == sellerHero.CurrentSettlement.MapFaction) ? 1 : 0;
            int num4 = (sellerHero.CurrentSettlement != null && buyerHero.MapFaction.IsAtWarWith(sellerHero.CurrentSettlement.MapFaction)) ? -1 : 0;
            int num5 = (useValueAsRelation < -100) ? buyerHero.GetRelation(sellerHero) : useValueAsRelation;
            int num6 = (num5 >= 100) ? 7 : ((num5 >= 80) ? 6 : ((num5 >= 60) ? 5 : ((num5 >= 40) ? 4 : ((num5 >= 20) ? 3 : ((num5 >= 10) ? 2 : ((num5 >= 5) ? 1 : ((num5 >= 0) ? 0 : -1)))))));
            return Math.Max(0, num + num6 + num2 + num3 + num4);
        }

Called from CampaignSystem.ViewModelCollection.GameMenu.RecruitVolunteerTroopVM:

C#:
            this.Owner = owner;
            if (this.Owner != null)
            {
                this._currentRelation = Hero.MainHero.GetRelation(this.Owner.OwnerHero);
            }
            this._maximumIndexCanBeRecruit = HeroHelper.MaximumIndexHeroCanRecruitFromHero(Hero.MainHero, this.Owner.OwnerHero, -101);
            for (int i = -100; i < 100; i++)
            {
                if (index < HeroHelper.MaximumIndexHeroCanRecruitFromHero(Hero.MainHero, this.Owner.OwnerHero, i))
                {
                    this._requiredRelation = i;
                    break;
                }
            }
He is asking for warband but thanks anyway, i was searching about it :grin:
 
Upvote 0

Dj_FRedy

Archduke
M&BWBNWVCWF&S
Hey! if it's WB I would check the script 'cf_village_recruit_volunteers_cond', the conditionals that control the menu option to recruit in villages are there...
 
Upvote 0

Unterkatze

Recruit
Ups i meant bannerlord my bad :smile: Will have a look at the suggestions.

[Edit]
Yep it worked, thanks for that.
 
Last edited:
Upvote 0
Top Bottom