What makes a spouse suitable for marriage?

Users who are viewing this thread

I'm using a mod "Fixed Pregnancy Control" that allows to marry more than once. I tried using "Marry Anyone" mod too, but it caused weird problems which made my clan leave my kingdom.

I edited the heroes.xml (of my own mod) to marry my main hero, a man, to a few woman, then started a new game ... but some of the marriages failed, didn't happen. When I look at the encyclopedia page of a woman that marriage fails with, I see my main hero as her ex-spouse.
When trying developer console commad "campaign.marry_player_with_hero xxxxxxx" , I get a reply:

Marriage is not suitable between [My main hero name] and xxxxxxx.

Errr... why not? The woman is single and not a clan leader. Browsed similar threads and all I found that age should be close to similar. There was a 5 year age gap. Edited age to 1 year gap, but they are still not suitable. EDIT: And it seems marriage was succesful with bigger age gap: wife 18, main hero 27, succesfully married.

So what makes a pair suitable?
 
Last edited:
There is only one field in memory for a spouse so any mod changing it will have to be pretty broad and pretty well made.

The default marriage suitability is defined like this, but it may have changed in one of your mods
public override bool IsCoupleSuitableForMarriage(Hero firstHero, Hero secondHero)
{
if (firstHero.Clan != null && secondHero.Clan != null)
{
Clan clan = firstHero.Clan;
if (((clan != null) ? clan.Leader : null) == firstHero)
{
Clan clan2 = secondHero.Clan;
if (((clan2 != null) ? clan2.Leader : null) == secondHero)
{
return false;
}
}
if (firstHero.IsFemale != secondHero.IsFemale && !Enumerable.Any<Hero>(Enumerable.Intersect<Hero>(this.DiscoverAncestors(firstHero, 3), this.DiscoverAncestors(secondHero, 3))))
{
Hero courtedHeroInOtherClan = Romance.GetCourtedHeroInOtherClan(firstHero, secondHero);
if (courtedHeroInOtherClan != null && courtedHeroInOtherClan != secondHero)
{
return false;
}
Hero courtedHeroInOtherClan2 = Romance.GetCourtedHeroInOtherClan(secondHero, firstHero);
return (courtedHeroInOtherClan2 == null || courtedHeroInOtherClan2 == firstHero) && firstHero.CanMarry() && secondHero.CanMarry();
}
}
return false;
}

Both must have a clan
One of them must not be a clan leader
Must be different sexes
A check against marrying close family
Cannot have courted a different hero other than this one (not sure how this works exactly)

Then it checks CanMarry for both heroes
public override bool IsSuitableForMarriage(Hero maidenOrSuitor)
{
if (maidenOrSuitor.IsAlive && !maidenOrSuitor.IsPrisoner && maidenOrSuitor.Spouse == null && maidenOrSuitor.IsLord && !maidenOrSuitor.IsMinorFactionHero && !maidenOrSuitor.IsNotable && !maidenOrSuitor.IsTemplate)
{
MobileParty partyBelongedTo = maidenOrSuitor.PartyBelongedTo;
if (((partyBelongedTo != null) ? partyBelongedTo.MapEvent : null) == null)
{
if (maidenOrSuitor.IsFemale)
{
return maidenOrSuitor.CharacterObject.Age >= (float)this.MinimumMarriageAgeFemale;
}
return maidenOrSuitor.CharacterObject.Age >= (float)this.MinimumMarriageAgeMale;
}
}
return false;
}

This one I think is simple enough to figure out yourself, just some checks of states of each hero. Anyway the main issue as I see with such a marriage mod is that it would have to expand upon there being only one field in memory which stores a single spouse.
 
I think every hero has an attribute if they are married or not: every hero can have their spouse set as the main hero. So basically there is no limits to how many heroes one could marry (if game didn't prevent new marriages). I can't see that spouse attribute one set in the above code.
There's only checks in the above if the marriage can happen.

Beats me what prevents the marriage then. As the game just starts, there has been no actual courting yet. Unless some courting is decided when game is created.

The wives the main hero is set to marry in the heroes.xml, are not his relatives. They are of different gender. None of them is married. Only the main hero is a clan leader. Everyone's age is above 18 years.
 
Last edited:
It seems I found the reason why couldn't set this (or some other) woman as the spouse for the main hero.
The woman was set as a clan leader by another mod. I had succesfully over written that character in my mod, demoted her to a regular clan member. However, setting her as a spouse still failed. Same thing with all the failed marriage cases.

EDIT:
Found the reason. Setting her up as the wife still failed, because the settings of my own mod's spclans.xml where she was demoted as a regular clan member, was not yet in force, when I tried to set her as the wife. My own mod's spclans.xml where she was demoted came in force AFTER I tried to set her as a wife.
 
Last edited:
Back
Top Bottom