Death from old age mod

Users who are viewing this thread

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);
    }
}
 
Upvote 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
 
Upvote 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.
 
Upvote 0
Back
Top Bottom