Jump to content

How to identify the spouse and the children to the player when scripting?


Recommended Posts

(This is about a mod with no sex or nudity.)

 

I have gotten into this problem where I want to figure out if Actor X is the player's spouse. Or some random follower. Or that thief that lingers around creepily after having been added by some mod at some point earlier.

 

What is the easiest way?

 

Also, if some child actor (IsChild()) is identified, how can I seperate between a standard child that have been adopted through Hearthfire or perhaps born through BeingFemale? I have realised that these have to be managed differently. I want to move them.

 

I want to keep this as light as possible script-wise and try not to depend on other mods. Yes I know there might be some things usable in 'Lovers Spouse', but that will cause a required dependency.

 

I have tried with things like GetRelationshipRank (seems to be 3 mostly, and 0 for adopted children for some reason) and HasFamilyRelationship or HasParentRelationship vs the children. I would have thought that you'd get some relationships with the child NPCs at adoption..

 

Help please?

 

---

 

Edit1: I realize that I can check for the presence of 'MarriageBondofMatrimony' in the actors inventory. But this feels like a hack. 

 

 

Link to comment

Well, that's a bit tricky.

The Players spouse is logged in the "RelationshipMarriageFIN" Quest as a Reference. You must check this quest to check for the spouse.

If you want to check, if it's possible to marry this actor somedays, check out the faction "PotentialMarriageFaction"

 

If you want to check for Followers, you can check for the faction and the rank.

"PotentialFollowerFaction" - If the actor is in this faction, this actor will can become a follower somedays

"CurrentFollowerFaction"

 

About the children thing - this is even more complicated, aspecialy when you use BeeingFemale.

In Skyrim all vanilla children are "unique". That's because there aren't any random children waking aroundin skyrim. They all have names, there fix places and stuff. The child flag is set in the race. So children will have there own race.

 

With BeeingFemale things become a bit more complicated. That's because BeeingFemale don't realy handle the children as children and there race are not taged as "Child Race".

I had to do this, because in Skyrim all children will flee when they are in combat. It seems that this was hard coded into Skyrim. That's why I didn't use the Child Flag. But they are still forbidden for SexMods because of some other things. At first, the nape of the race contains child. SexLab and other SexMods check this andwill forbid. Another thing I've done is, they are in a "ForbiddenFaction"

Now - how you can check them.... If you want to check via PapyrusScript you can check for the "_BFChildNPC" and the "_BFChildPlayer" class.

You can also check the GiftFilter that is the default child "GiftChild" filter.

 

Before I forgot - to check for the adopted children, there is a Hearthfire "House" Quest or something like that, where the children are stored in

I hope this helps a bit

Link to comment

Well, that's a bit tricky.

The Players spouse is logged in the "RelationshipMarriageFIN" Quest as a Reference. You must check this quest to check for the spouse.

If you want to check, if it's possible to marry this actor somedays, check out the faction "PotentialMarriageFaction"

 

If you want to check for Followers, you can check for the faction and the rank.

"PotentialFollowerFaction" - If the actor is in this faction, this actor will can become a follower somedays

"CurrentFollowerFaction"

 

About the children thing - this is even more complicated, aspecialy when you use BeeingFemale.

In Skyrim all vanilla children are "unique". That's because there aren't any random children waking aroundin skyrim. They all have names, there fix places and stuff. The child flag is set in the race. So children will have there own race.

 

With BeeingFemale things become a bit more complicated. That's because BeeingFemale don't realy handle the children as children and there race are not taged as "Child Race".

I had to do this, because in Skyrim all children will flee when they are in combat. It seems that this was hard coded into Skyrim. That's why I didn't use the Child Flag. But they are still forbidden for SexMods because of some other things. At first, the nape of the race contains child. SexLab and other SexMods check this andwill forbid. Another thing I've done is, they are in a "ForbiddenFaction"

Now - how you can check them.... If you want to check via PapyrusScript you can check for the "_BFChildNPC" and the "_BFChildPlayer" class.

You can also check the GiftFilter that is the default child "GiftChild" filter.

 

Before I forgot - to check for the adopted children, there is a Hearthfire "House" Quest or something like that, where the children are stored in

I hope this helps a bit

 

 

Thank you very much. It helped a good part of the way.

 

Like this is needed to get hold of the Spouse Actor


Quest Property MarriageQuest Auto ;This is set to the quest RelationshipMarriage

---

QF_RelationshipMarriageFIN_00021382 myQuest
myQuest = MarriageQuest as QF_RelationshipMarriageFIN_00021382
Actor spouse = myQuest.Alias_LoveInterest.GetActorRef() ;This is the actor player is married to

I decided that if a child is around in a player owned house it is either an adopted child, a child follower or a child created by one of the 'give birth' mods. I still need to make a patch for BeingFemale 'children'.

If(akTarget.IsChild())
        If(akTarget.GetParentCell().GetFactionOwner() == PlayerFaction)
            ;Actor is a child related to the player in some friendly manner
        endIf
endIf
Link to comment

I will also think about, how I can support this. Right now the only vanilla way is the "GiftChild" property or by using papyrus.

 

This is the most popular way to check for children using papyrus (SKSE required):

bool function IsChild2(actor a)
    Race ActorRace = a.GetLeveledActorBase().GetRace()
    String RaceName = ActorRace.GetName()
 
    if ActorRace.IsRaceFlagSet(0x4) || StringUtil.Find(RaceName, "Child") != -1 || StringUtil.Find(RaceName, "Little") != -1 || StringUtil.Find(RaceName, "117") != -1 || (StringUtil.Find(RaceName, "Monli") != -1 && a.GetScale() < 0.93) || StringUtil.Find(RaceName, "Elin") != -1 || StringUtil.Find(RaceName, "Enfant") != -1
        return true
    endIf
    return false
endfunction
Link to comment

 

I will also think about, how I can support this. Right now the only vanilla way is the "GiftChild" property or by using papyrus.

 

This is the most popular way to check for children using papyrus (SKSE required):

bool function IsChild2(actor a)
    Race ActorRace = a.GetLeveledActorBase().GetRace()
    String RaceName = ActorRace.GetName()
 
    if ActorRace.IsRaceFlagSet(0x4) || StringUtil.Find(RaceName, "Child") != -1 || StringUtil.Find(RaceName, "Little") != -1 || StringUtil.Find(RaceName, "117") != -1 || (StringUtil.Find(RaceName, "Monli") != -1 && a.GetScale() < 0.93) || StringUtil.Find(RaceName, "Elin") != -1 || StringUtil.Find(RaceName, "Enfant") != -1
        return true
    endIf
    return false
endfunction

 

Thank you very much, I have added it to my 'utils' script basically as is.

 

 

 

 

 

 

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use