Haravikk Posted September 12, 2017 Share Posted September 12, 2017 So I'm taking my first foray into making a mod with dialogue. Unfortunately, and somewhat typically for me, what I want to do isn't covered by any of the dialogue tutorials I could find :smile: Basically, what I need to do is somehow make my dialogue branches dependent upon the result of a global function. Essentially, if it returns true, some options will be shown, while if it's false some other options are shown, all organised under a single opening branch. Unfortunately the function is Actor dependent, so I can't fudge it using quest stages or such, as the check needs to be made for every matching NPC the player might speak to. So, with that in mind, what is the best way to do something like this? If there any existing Skyrim quests, or mod quests, that do something like this then feel free to let me know; I don't mind poking around myself to figure it out. If however someone does feel compelled to summarise the steps involved, please bear in mind that although I'm a programmer by trade, I am totally new to Papyrus, so while I have the syntax down, the API and organisation of scripts is another matter! Also, on a related note, is "the dialogue bug" still a problem with the latest version of Skyrim? I was going to make my "quest" one started by default, but it's not crucial for it to be active during Helgen for example. Link to comment Share on other sites More sharing options...
simtam Posted September 12, 2017 Share Posted September 12, 2017 Split your line with check in two parts. The first can have totally unimportant text, and in the onbegin fragment you call your function, and store the result into, say, a global variable that the second part will check in condition. Link to comment Share on other sites More sharing options...
PeterMartyr Posted September 12, 2017 Share Posted September 12, 2017 Use SKSE register for Dialogue Menu to trigger Function on multiple NPC, for the condition. Don't use a over kill globals. Use Virtual Machine Quest Condition, as Custom Dialogue Conditions. Before I get bag for bagging a global and calling it overkill.(by others) The Game uses VMQuest Conditions, on Scripted Quest Conditional Script with Bools, not Globals. Has Dialogue Conditions, in what appears to be your case. So I am just coping Beth, with SKSE to help. Cheers buddy & good luck. PS you don't need to use second level dialogue has well.. it should work out of the box, but your dialogue is your own. Other options OnActivate Event with an NPC Alias to trigger the function, or trigger the Function from the TIF EntryTopic Yep that it. Link to comment Share on other sites More sharing options...
foamyesque Posted September 12, 2017 Share Posted September 12, 2017 (edited) Depending on what precisely you want to do, there's ways to create per-Actor tracking that can be pulled from the dialogue system. Is this a boolean condition or a multi-fork case, is it applicable to just unique actors or are things like guards involved, and do you actually need to track the results on a long term basis or can you just call the function every time dialogue starts? Edited September 12, 2017 by foamyesque Link to comment Share on other sites More sharing options...
Haravikk Posted September 12, 2017 Author Share Posted September 12, 2017 Depending on what precisely you want to do, there's ways to create per-Actor tracking that can be pulled from the dialogue system. Is this a boolean condition or a multi-fork case, is it applicable to just unique actors or are things like guards involved, and do you actually need to track the results on a long term basis or can you just call the function every time dialogue starts? In this specific case I don't think there should be any problem with just calling the function each time, it's not a demanding function and the dialogue is fairly superficial, though I do have another possible case that may be better tracked per-actor somehow so information about that would be great too! Link to comment Share on other sites More sharing options...
Haravikk Posted September 14, 2017 Author Share Posted September 14, 2017 Use SKSE register for Dialogue Menu to trigger Function on multiple NPC, for the condition. Don't use a over kill globals. Use Virtual Machine Quest Condition, as Custom Dialogue Conditions. Are there any good examples anywhere of how to do what you're describing, or mods with quests I could look at to see how this is done exactly? I've managed to get my mod working with the global variables; they may be something worth avoiding where possible, but they're dead easy to use ;) You're right though that I'd rather avoid them if I can, as in future it would be better if I could use a bitfield/Int actually, so I'm interested to know how to do this the right way. But I'm just not sure what exactly you're describing; are you talking about adding dialogue menus via script rather than through conditions? Some examples or code snippets would really help. Link to comment Share on other sites More sharing options...
foamyesque Posted September 14, 2017 Share Posted September 14, 2017 (edited) Depending on what precisely you want to do, there's ways to create per-Actor tracking that can be pulled from the dialogue system. Is this a boolean condition or a multi-fork case, is it applicable to just unique actors or are things like guards involved, and do you actually need to track the results on a long term basis or can you just call the function every time dialogue starts? In this specific case I don't think there should be any problem with just calling the function each time, it's not a demanding function and the dialogue is fairly superficial, though I do have another possible case that may be better tracked per-actor somehow so information about that would be great too! Okay, functionally, you need a condition that: 1. The condition system can actually see;2. Nothing else will touch;3. Can be different for each actor;4. Can store the appropriate type of data;5. Doesn't need to be explicitly specified as to target. It's possible to create custom conditionals and have those be accessed through the dialogue system via GetVMQuestVariable and GetVMScriptVariable. GetVMScriptVariable would be the desired choice here, but it can only be targeted at a single specific reference. Parameters won't work (annoyingly), so it's out for your needs. Howerver, there's workarounds. For example, adding them to a custom faction, which can be used either as a boolean (is/isn't in the faction) or to control various cases (by faction rank). If you create the faction yourself you can be pretty confident nothing else will modify it. Edited September 14, 2017 by foamyesque Link to comment Share on other sites More sharing options...
Recommended Posts