The Mod is the result of me getting into C.
I dont know if it works with older versions.
I dont know if i will update the mod in future.
Age will be set to 22 if a Member of the Player Clan get older than that.
Should not conflict with any other Mod
Feel Free to copy my code and reupload the mod so i dont have to maintain it myself. (Would be nice to post a link and credit me, if you do so)
Source Code:
using System;
using TaleWorlds.CampaignSystem;
using TaleWorlds.Core;
using TaleWorlds.MountAndBlade;
namespace StayYoung
{
public class Main : MBSubModuleBase
{
protected override void OnGameStart(Game game, IGameStarter gameStarter)
{
// desired Age for the character
const float age = 22.0f;
CampaignEvents.DailyTickEvent.AddNonSerializedListener((object) this, new Action(() =>
{
if (Math.Abs(Hero.MainHero.Age - age) > 1)
{
var birthday = CampaignTime.Now - CampaignTime.Years(age);
Hero.MainHero.SetBirthDay(birthday);
if (Hero.MainHero.Spouse != null && !Hero.MainHero.Spouse.IsDead && Hero.MainHero.Spouse.Age > age)
{
Hero.MainHero.Spouse.SetBirthDay(birthday);
}
}
if (Clan.PlayerClan != null)
{
foreach (var hero in Clan.PlayerClan.Heroes)
{
var birthday = CampaignTime.Now - CampaignTime.Years(age);
if (hero.Age > age)
hero.SetBirthDay(birthday);
}
}
}));
}
}
}