Jump to content

Papyrus Function to add Custom NPC to faction


Skybroom

Recommended Posts

Messing with a Quest Dialogue in Creation Kit.

I want to add a script to a particular info that will add custom (not vanilla) NPC to a faction, making them potential follower and thus unlocking the "Follow me!" dialogue.

Can you help me figure out what kind of text should I compile for Papyrus Fragment!

I can't just type this, can I? :

<NPC Name>.AddToFaction(<Faction>)

Should I create an Alias for the NPC and use it as a script property?

Edited by Skybroom
typo
Link to comment
Share on other sites

If you have a quest with dialog for this NPC, you should have that NPC as an alias in that quest.   And you likely already have a QF_  script for this quest  with all the aliases as properties.    

For example,  I have a quest named  LilyRescue, and its fragment script is QF_LilyRescue, and it has:

ReferenceAlias Property Alias_Player   Auto
ReferenceAlias Property Alias_Lily     Auto

and also:
 

Faction Property PlayerFaction Auto
Faction Property PotentialFollowerFaction Auto
Faction Property CaptiveFaction Auto

And in this script, I have this function:
 

Function MakeLilyFollower()
    Actor LilyRef = Alias_Lily.GetActorRef()
    Actor PlayerRef = Alias_Player.GetActorRef()
    If(LilyRef.GetRelationshipRank(PlayerRef) < 2)
        LilyRef.SetRelationshipRank(PlayerRef, 2)
        LilyRef.SetFactionRank(PlayerFaction, 0)
        LilyRef.SetFactionRank(PotentialFollowerFaction, 0)
        LilyRef.RemoveFromFaction(CaptiveFaction)
    EndIf
EndFunction

So, in a dialogue topic, the fragment code looks like this:
 

(GetOwningQuest() as QF_LilyRescue).MakeLilyFollower()

 

Link to comment
Share on other sites

You have two options to get a custom NPC into a faction:

  1. Use AddToFaction at some point.
  2.  Pre-add them to the faction in the Creation Kit with a low-level rank (usually -1).

The stock followers are all already within the follower faction.  Their faction rank status gets changed when they become a follower. (see scorrp10's post for an example).

For your purpose, I would recommend pre-adding them to the faction rather than trying to script them into the faction.  If you pre-add them, you can follow scorrp10's advice on setting everything up.  

Link to comment
Share on other sites

  • Recently Browsing   0 members

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