vedan77 Posted April 6, 2021 Share Posted April 6, 2021 Hi, I've created three followers by now and I want to implement a nice feature: They all have one dialogue line which I want them to say at once by pressing a key. How do I do that? Bb Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 6, 2021 Share Posted April 6, 2021 I would think that you would give each of them a script. On that script the keypress to listen to would be registered. And then when the keypress is made, trigger the dialogue. See the following for more information: RegisterForKeyOnKeyDownSay Simple example - not tested - Requires SKSE functions: ScriptName FollowerAliasScript Extends ReferenceAlias Int Property myKey Auto ; assign the DXScanCode for the desired key (uses decimal value) Topic Property myTopic Auto ; assign what you want them to say Event OnInit() RegisterForKey(myKey) EndEvent Event OnKeyDown(Int KeyCode) If KeyCode == myKey (Self.GetReference() as Actor).Say(myTopic) EndIf EndEvent Registering in the OnInit event means that a new game is required. You could however, have a player alias script running the OnPlayerLoadGame event and have it call a function on the follower alias script to do the registering. Link to comment Share on other sites More sharing options...
maxarturo Posted April 6, 2021 Share Posted April 6, 2021 Just to contribute on IsharaMeradin post. - Never use the "Say()" function on actors, this is purely made for use with 'Talking Activators', when use on actors the CTD is guaranteed. - Instead use a "Say Package". RegisterForKey OnKeyDown Global.SetValue() EvaluatePackage() Link to comment Share on other sites More sharing options...
vedan77 Posted April 7, 2021 Author Share Posted April 7, 2021 (edited) Just to contribute on IsharaMeradin post.- Never use the "Say()" function on actors, this is purely made for use with 'Talking Activators', when use on actors the CTD is guaranteed.- Instead use a "Say Package".RegisterForKeyOnKeyDownGlobal.SetValue()EvaluatePackage() Alright, guys - thanks a lot for giving me this info! What I did so far:Opened NPC BloodCaleb, click on "AI Data" tab, added a new papyrus script in the left section, then found out I can edit it when I rightclick it and select "edit source".Opened his quest BloodCaleb1, opened "Misc" tab and added a Shared_Info topic & named it CalebReflexTopic. Added a NPC GetIsID condition for correct voicetype & recorded a line for testing.Checked IsharaMeradin's "Drop that coin" mod for an easy example script (and noticed he uses an OnKeyPressed event, which I guess should be OnKeyDown, since reference explicitely mentions its resource behaviour).I pasted & modifed the Event-code like this: Scriptname BloodCalebScript01 extends ObjectReference Topic Property CalebReflexTopic Auto Event OnKeyDown(Int KeyCode) If KeyCode == 11 Debug.MessageBox("Caleb should talk now!"); Say(CalebReflexTopic); EndIf EndEventIt compiles, but does not trigger :sad: Since you mentioned NOT to use the "Say" command this way: How do? I could not find any reference on that info you mention in a way I could use it? Thx! Edited April 7, 2021 by vedan77 Link to comment Share on other sites More sharing options...
maxarturo Posted April 7, 2021 Share Posted April 7, 2021 (edited) - Create a "Global Variable" and set it to "0". - Create a 'Dialogue Topic'. - Create a "Package" with template "SAY" and assign your 'Dialogue Topic' to the "Say Package". - To the 'Say Package" add the condition "GetGlobalValue". S > GetGlobalValue > MyGlobalValue > == 1 - Add your "Say Package" to your npc and be sure that it's at the TOP of the package stack. - Create a "Quest" and put the actor on a "ALIAS". - Your script should look something like this and it needs to be added to the reference alias, this is just an example: <extends Alias> GlobalVariable Property MyGlobal Auto Event OnInit() RegisterForKey(11) EndEvent EVENT OnKeyDown(Int KeyCode) If KeyCode == 11 MyGlobal.SetValue( 1 ) Actor ActorNPC = MyAlias.GetActorReference() ActorNPC.EvaluatePackage() Utility.Wait(2.0) ; We wait the time needed for the topic to finish MyGlobal.SetValue( 0 ) EndIf ENDEVENT I hope it helps. Have a happy modding. EDIT: Forgot the "OnInit()" event.... Edited April 8, 2021 by maxarturo Link to comment Share on other sites More sharing options...
Recommended Posts