BL Coding Death from old age mod

正在查看此主题的用户

Lord Badfox

Recruit
Is there a possibility to apply the characteristic "death by age" through a mod? I wish I could create a dynasty.
I know the feature is in the game but not currently applied. Any advice?
 
If I am understanding the question correctly, you would probably need to create some kind of loop to check all heros and a desired death age and use the KillCharacterAction.
Haven't tested it myself, so this is just a crude markup, but I would think it is something along the lines of:

C#:
static float death_Age = 90;
foreach (Hero hero in Campaign.Current.Heroes)
{
    if (hero.Age > death_Age)
    {
        KillCharacterAction.ApplyByOldAge(hero, true);
    }
}
 
点赞 0
If I am understanding the question correctly, you would probably need to create some kind of loop to check all heros and a desired death age and use the KillCharacterAction.
Haven't tested it myself, so this is just a crude markup, but I would think it is something along the lines of:

C#:
static float death_Age = 90;
foreach (Hero hero in Campaign.Current.Heroes)
{
    if (hero.Age > death_Age)
    {
        KillCharacterAction.ApplyByOldAge(hero, true);
    }
}

And this, where would you apply it? As I would do it? If you can help me with a mini tutorial, I am a mod beginner for Bannerlord. If it is very difficult I will continue using "campaign.make_main_hero_ill" but it does not apply to the other heroes, which is very annoying.

My mother tongue is Spanish and my English language skills are basic. sorry and thanks for helping
 
点赞 0
You'd need to throw it into a daily tick function.
C#:
        public override void RegisterEvents()
        {
            CampaignEvents.DailyTickEvent.AddNonSerializedListener(this, new Action(this.DailyTickEvent));
        }

Then, make a private void DailyTickEvent() and throw your code in there.
 
点赞 0
后退
顶部 底部