Jump to content

Photo

Follower react to chained doors and owned beds


  • Please log in to reply
4 replies to this topic

#1
BarbWireBlonde

BarbWireBlonde

    Enthusiast

  • Supporter
  • PipPip
  • 169 posts

How do I get a custom follower to react to the player trying to activate a chained door or owned bed? I’ve been trying to work it out in Creation Kit but unfortunately I haven’t managed to get anywhere. I would appreciate the help. I’m not good with scripts at the moment, and I’ve been researching them but haven’t got anywhere yet.

Thank you!



#2
LarannKiar

LarannKiar

    Fan

  • Members
  • PipPipPip
  • 363 posts

The Owned Bed Part:

1. Open your Companion's Dialogue Quest (where their voice lines are located). In the "Misc" tab, you can create a Dialogue Topic with subtype: PlayerActivateFurniture.

2. Create a group where you'd like to place your Companion's "player activates an owned bed" lines. Give the conditions below to that group:

- IsOwner == 0 (Run on: Target)
- HasKeyword: IsSleepFurniture == 1 (Run on: Target)
- LocationHasPlayerOwnedWorkshop == 0

- GetIsID / GetIsAliasRef == your companion's ID / ReferenceAlias on this quest
- IsOwnedBy [TARGET] == 0 (Run on: Player)
 
The Chained Door Part:
 
Open the quest "DialogueGenericPlayer", click on the "PlayerDialogue" tab. Under "Branches", you can see the "PlayerActivateComment".

There, you can see the "PlayerActivateDoorChained" and "PlayerActivateDoorChainedSameSide" Dialogue Topics.

The dialogue topics use the PlayerActivateDoorChained and PlayerActivateDoorChainedSameSide keywords. Their FormIDs are: 19DDCE and 2B994.

There's a script called ChainedDoor which is attached to each objectreference of these chained doors. This script calls the "SayCustom" function when the "OnActivate" objectreference script event fires (so when you activate the door).

This function makes the player to say the lines:

Game.GetPlayer().SayCustom(PlayerActivateDoorChained)

I think there are two ways to make a companion says their custom lines too.

1. TopicInfo Script.

Add a script to each Player line. Search for a "Chained door" player line (like "Chained on the other side..."). You can add a script like this to each player line:

Actor Property YourCompanionReference Auto Const
Keyword Property CustomKeyword Auto Const     ;create a keyword (you can duplicate the PlayerActivateDoorChained keyword)

Event OnBegin(ObjectReference akSpeakerRef, bool abHasBeenSaid)    (YourCompanionReference).SayCustom(CustomKeyword)
EndEvent

Don't forget to fill your script's Properties. What does this do: when the player starts saying their voice line, the OnBegin event fires (just like the OnActivate event on the ChainedDoor script).

2. ObjectReference Script:
 
Modify the ChainedDoor script. You can add custom lines for your companion. Place them below the vanilla lines:

Actor Property YourCompanionReference Auto Const
Keyword Property CustomKeyword Auto Const          ;create a keyword (you can duplicate the PlayerActivateDoorChained keyword in the Creation Kit)
Keyword Property CustomKeyword_SameSide Auto Const           ;create a second keyword (you can duplicate the PlayerActivateDoorChainedSameSide keyword in the Creation Kit)

Game.GetPlayer().SayCustom(PlayerActivateDoorChained)    ;vanilla script line (for the Player). No need to edit.
YourCompanionReference.SayCustom(CustomKeyword)          ;custom line for your Companion


;Don't forget the "PlayerActivateDoorChainedSameSide" line

Game.GetPlayer().SayCustom(PlayerActivateDoorChainedSameSide)  ;vanilla one. No need to edit.
YourCompanionReference.SayCustom(CustomKeyword_SameSide)       ;custom line for your Companion

If you choose this option instead of the TopicInfo Script, you'd have to fill the Properties (YourCompanionReference, CustomKeyword_SameSide, CustomKeyword) on ALL objectreferences of chained doors. Well, it's a bit time consuming..


Edited by LarannKiar, 12 April 2021 - 05:44 AM.


#3
BarbWireBlonde

BarbWireBlonde

    Enthusiast

  • Supporter
  • PipPip
  • 169 posts

Thank you LarannKiar for your help. This is a wealth of information. I will give it a go. I’m working further on Dual Survivors Nate extended dialogue add on which I have already edited, but I want to expand upon his dialogue even further. So this is a big help!



#4
BarbWireBlonde

BarbWireBlonde

    Enthusiast

  • Supporter
  • PipPip
  • 169 posts

Ok, so I’ve been trying to make my first ever script in Creation Kit, and I paste in the above in step one for the chained door and changed the yourcompanionreference to NateAlias, and where it says customkeyword I put playeractivatedoorchained. I’m not sure if this is right or not.
How do I link this to Nate’s dialogue? Do I create a new topic in player dialogue or a new quest or new scene, then link the script in scripts section of the new line of dialogue?
I’m sorry if this sounds completely dumb, scripting is new territory for me. 
I have been watching tutorials on YouTube and reading stuff, but my brain is in freeze mode lol! 



#5
LarannKiar

LarannKiar

    Fan

  • Members
  • PipPipPip
  • 363 posts
Okay, this should work. Try these steps:
 
1. Create a ReferenceAlias on Nate's dialogue quest. Fill this quest alias with the proper reference, not Abraham Finch :smile:. You can use the Fill Type "Unique Actor".
 
iIL08Px.png
 
2. Create a Keyword with Type: Dialogue Subtype. I used: playeractivatedoorchained_Custom. You shouldn't use the vanilla "playeractivatedoorchained". Instead, create a new one.
 
lXHWYIP.png
 
 
The Dialogue Part. (I used the quest "DialogueGenericPlayer" for Nate's dialogue stuffs but you should use your own quest).
 
3. So go to Nate's dialogue quest, then "Player Dialogue". Create a New Branch (they are on the left side). I used: NateChainedDoorLines_Branch.
4. Click on the Branch you created. Click on the "Keyword". From the dropdown menu, select your keyword. I selected: playeractivatedoorchained_Custom.
5. Create the dialogue lines. Optionally, you can create a Group for them. I used: NateChainedDoorLines_Group.
6. Don't forget to add this Condition to the group / dialogue lines: Run On: Subject -- GetIsAliasRef: NateAlias == 1.
 
After completing Step 3 - 6, Nate's dialogue branch, dialogue topic (and the optional dialogue group) should look like this:
 
akBGl8p.png
 
 
The Script part:
 
The Script should be attached to the player's "Chained Door" dialogue lines. They are in this group: "ChainedDoorLines" in quest "DialogueGenericPlayer". Group's FormID is: 2B039. (Yes, use the vanilla player dialogue quest because this is where the player's lines can be found).
 
oidiFQF.png
 
The Script should look like this. The script's name can be different (you can give another name to your script). The "Scriptname" and the "extends TopicInfo Const" should be there though.
 
Scriptname ChainedDoor:ChainedDoor_NateLine_Script extends TopicInfo Const

ReferenceAlias Property NateAlias Auto Const
Keyword Property playeractivatedoorchained_Custom Auto Const


Event OnBegin(ObjectReference akSpeakerRef, bool abHasBeenSaid)
    (NateAlias.GetReference() as Actor).SayCustom(playeractivatedoorchained_Custom)
EndEvent

If you're using a "ReferenceAlas" for Nate instead of "Actor" property, you have retrieve the reference your alias is pointing at.
 
Just choose one of these:
NateAlias.GetActorRef()
NateAlias.GetActorReference()
(NateAlias.GetReference() as Actor)
 
I used the (GetReference() as Actor).
 
After you type this code, press Ctrl+S to compile an save it. It should write: 1 Compiled, 0 failed.
 
rFKVnXO.png
 
Don't forget to fill the Properties of the script. (I used the quest "DialogueGenericPlayer" as Nate's dialogue quest, but you should use your own quest. The alias property should look like this: alias NateAlias on quest "Nate's Dialogue Quest").
 
B9Yxn8J.png

Edited by LarannKiar, 12 April 2021 - 05:54 AM.





IPB skins by Skinbox
Page loaded in: 0.980 seconds