Jump to content

[LE] Making Different NPCs Follow you to a Place


Recommended Posts

Ok, so I have a topic within I dialogue view that is set up to show on NPC under a very broad condition (everyone with a relationshiprank of 3 or higher with the player). When I select this dialogue option as a player, I want the NPC I was talking to to follow me until I talk to them again and tell them to stop following. I know this is probably a fairly simple question, but I'm having trouble finding any resources that go over how to do something like this, so if anyone could explain how to make something like this work, or link to a relevant tutorial, that would be a huge help. Thanks in advance.

Link to comment
Share on other sites

To do this, you need to make a bunch of reference alias's in your quest and put a follow AI package on each of them. Fill -Type: Specific Reference and leave them on none. Make sure the Optional and Allow Reuse in Quest boxes are checked. Then, on your dialogue fragment script, add a new property: ReferenceAlias and check the Array box. After adding the property click Edit Value and put all the reference alias's you made in the array. I would suggest making around 10 reference alias's. For this example I'll just call the referenceAlias array property MyAliasArray.

 

Put this script on the Follow dialogue Begin fragment:

 

 

Int M = MyAliasArray.Length 
While M > 0
    M -= 1
    If MyAliasArray[M].GetActorReference() == None ;If the ReferenceAlias is empty
        M = 0
        MyAliasArray[M].ForceRefTo(akSpeaker)
    Endif
EndWhile 

Put this script on your stop follow dialogue begin fragment. Note, you have to add the MyAliasArray property to this dialogue script fragment too.

Int M = MyAliasArray.Length 
While M > 0
    M -= 1
    If MyAliasArray[M].GetActorReference() == akSpeaker ;If the ReferenceAlias is filled with the speaker
        M = 0
        MyAliasArray[M].Clear() ;Clears / removes speaker from alias
    Endif
EndWhile 

In short, the follow dialogue script forces the speaker into an empty reference alias with a follow AI Package. The stop follow dialogue script finds the reference alias the speaker is in, and clears it.
Edited by dylbill
Link to comment
Share on other sites

 

To do this, you need to make a bunch of reference alias's in your quest and put a follow AI package on each of them. Fill -Type: Specific Reference and leave them on none. Make sure the Optional and Allow Reuse in Quest boxes are checked. Then, on your dialogue fragment script, add a new property: ReferenceAlias and check the Array box. After adding the property click Edit Value and put all the reference alias's you made in the array. I would suggest making around 10 reference alias's. For this example I'll just call the referenceAlias array property MyAliasArray.

 

Put this script on the Follow dialogue Begin fragment:

 

 

Int M = MyAliasArray.Length 
While M > 0
    M -= 1
    If MyAliasArray[M].GetActorReference() == None ;If the ReferenceAlias is empty
        M = 0
        MyAliasArray[M].ForceRefTo(akSpeaker)
    Endif
EndWhile 

Put this script on your stop follow dialogue begin fragment. Note, you have to add the MyAliasArray property to this dialogue script fragment too.

Int M = MyAliasArray.Length 
While M > 0
    M -= 1
    If MyAliasArray[M].GetActorReference() == akSpeaker ;If the ReferenceAlias is filled with the speaker
        M = 0
        MyAliasArray[M].Clear() ;Clears / removes speaker from alias
    Endif
EndWhile 

In short, the follow dialogue script forces the speaker into an empty reference alias with a follow AI Package. The stop follow dialogue script finds the reference alias the speaker is in, and clears it.

 

Hi, I followed your instructions up until the point where I was to put a script on the follow dialogue begin fragment. However, when I attempted to compile the script you gave me, I got thrown 3 compiler errors. For reference, here is the full script I used:

Scriptname StartFollowScript extends TopicInfo

Alias[] Property MyAliasArray  Auto  

Int M = MyAliasArray.Length 
While M > 0
    M -= 1
    If MyAliasArray[M].GetActorReference() == None ;If the ReferenceAlias is empty
        M = 0
        MyAliasArray[M].ForceRefTo(akSpeaker)
    Endif
EndWhile 

And here is the compiler output:

Starting 1 compile threads for 1 files...
Compiling "StartFollowScript"...
E:\Programs\Windows\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\StartFollowScript.psc(5,8): no viable alternative at input 'MyAliasArray'
E:\Programs\Windows\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\StartFollowScript.psc(5,20): required (...)+ loop did not match anything at input '.'
E:\Programs\Windows\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\StartFollowScript.psc(5,4): Unknown user flag MyAliasArray
No output generated for StartFollowScript, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on StartFollowScript

I'm not really familiar enough with the exact syntax of papyrus to understand what any of this really means, do you have any idea what's going on here?

Link to comment
Share on other sites

Instead it should be ReferenceAlias[] Property MyAliasArray Auto. Although for fragments, I would add the property directly in the creation kit, and also compile directly in the creation kit.

 

To do this, first put ; in the the begin fragment in the creation kit and hit compile. You should then see a TIF script on the right under script name. Click on the script, then Properties then Add Property. Choose ReferenceAlias and check the array box. If the Add Property button is greyed out, close the quest and then open it again and it should work.

Link to comment
Share on other sites

Alright, sorry for the late reply, I haven't been doing any modding for a couple of days. Anyhow, I'm still having problems with this solution and I don't know how to go about troubleshooting it. I think the most likely issue is that the follow Package I'm using isn't working properly (it's a base game package called FollowPlayer). The other thing I can think of is that .forceAlias isn't working for some reason. If you're still replying to this, do you know of a specific package I should be using for this purpose, or maybe a way to log a list of an Actor's aliases to the debug log so I could check whether or not it's being assigned properly? Thanks in advance.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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