WhiteWolf424242 Posted November 24, 2020 Share Posted November 24, 2020 Hello, I'm trying to add optional content (player dialogues) to one of my mods (call it Mod.esp), that is only visible if another mod is also installed. (Say FollowerExample.esp). I want to do this:- without making FollowerExample.esp a master/requirement for my Mod.esp. It should be optional: if the user has it installed then it's there, if not, then not.- Without making a dedicated 3rd patch-plugin. I know that it would be possible to make a patch esp that loads up my Mod.esp and FollowerExample.esp, and then adds the dialogues there, but I want to save everyone a plugin space - so no patch plugin. I certainly know that this is definitely possible - many mods do that: Vilja does this with Inigo, and Lucien does this with a lot of other followers: there's dialogues with them if they are installed, but they are not a requirement, and also there's no additional esp's doing this. So my question is, how do you achieve that? Because what I had in mind doesn't really work.In order to add dialogue to the follower, I figured that I definitely need to have at least their Voicetype as a record in my mod. However, this still can't be done without making FollowerExample.esp a master for Mod.esp. (at least this is what Tes5Edit tells me when I want to copy it as override. If I copy it as a new record instead, then the FormID's won't match, so it won't work.) If anyone could help me out with this, that would greatly appreciated :) Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 24, 2020 Share Posted November 24, 2020 Requires SKSE If Game.GetModByName("FollowerExample.esp") != 255 ;mod is present - do something Else ;mod is not present - do something else or nothing EndIfIf you want to skip SKSE you can go directly to using Form SomeForm = Game.GetFormFromFile(0x00166151,"FollowerExample.esp") If SomeForm ;form returned valid - mod is present - do something Else ;form returned null - mod is not present - do something else or nothing EndIf Should be noted that the hex value is the FormID of the record in question with the initial two load order digits set to 00 with the whole thing prefixed by 0x to tell papyrus that it is a hex value. Also note: this will spit out an error in the papyrus log if the mod in question is not present. It is harmless and nothing to be alarmed about. For your reading pleasure:GetModByNameGetFormFromFile Link to comment Share on other sites More sharing options...
WhiteWolf424242 Posted November 24, 2020 Author Share Posted November 24, 2020 (edited) Sounds good, thanks :smile: My mod already uses skse, requiring it is no problem. So how would I then activate the dialogues?Let's say that FollowerExample.esp contains a Follower with a unique FollowerVoiceType.What's the correct condition to the dialogues with this follower? I guess that in the <if mod is present> section I can then use GetFormFromFile to save the Follower's ID to a global, and then I could useSubject.GetIsID() == [ticked Use-Global-box] the previously set global?I'm not sure if this is correct. Would the CK find the voicetype so that voice dialogue could be saved for it? EDIT:Or maybe I could add FollowerVoiceType to Mod.esp, as a new record, and just use that as the condition for the dialogues. Then to make it work, use the <if mod is present> section to somehow make this voicetype "equal" to the voicetype in FollowerExample.esp? I don't know how this would be possible though. I don't suppose that just Voicetype Property FollowerVoiceType Auto ; set to the voicetype in CK If Game.GetModByName("FollowerExample.esp") != 255 FollowerVoiceType = GetFormFromFile( <checked formID of the Voicetype from other mod>, FollowerExample.esp) as Voicetype EndIf would work? EDIT2Nah, this would surely just make the script property equal to the other one, but not the actual forms in the CK. I'm out of ideas :( Edited November 24, 2020 by WhiteWolf424242 Link to comment Share on other sites More sharing options...
dylbill Posted November 25, 2020 Share Posted November 25, 2020 You can just make a new global variable that's set to 0 by default. Then use OnInit or OnPlayerLoadGame() to check if the mod is installed and set it to 1 if it is. Then in your dialogue condition just put the condition GetGlobalValue MyGlobalVariable == 1. Link to comment Share on other sites More sharing options...
WhiteWolf424242 Posted November 25, 2020 Author Share Posted November 25, 2020 (edited) But that would apply the dialogue to all NPCs, if said mod is installed.I want to apply the dialogues only to the one follower that is actually contained by the mod we're checking for (and also be able to record/copy voices for him. That means that the CK must recognize the voicetype). What is the condition for that?Since I can't just use GetIsID or GetIsVoiceType out of the box, because the follower's id and voicetype are not records of my mod. Edited November 25, 2020 by WhiteWolf424242 Link to comment Share on other sites More sharing options...
ReDragon2013 Posted November 25, 2020 Share Posted November 25, 2020 (edited) maybe something like this.. you will need a new quest with playeralias ww42PlayerAliasScript Scriptname ww42PlayerAliasScript extends ReferenceAlias ; https://forums.nexusmods.com/index.php?/topic/9331613-automatically-detect-if-a-mod-is-installed-and-active-thus-optional-content/ ; How to: ; create a new quest, check run once on start ; add new alias player as <unique player> and attach this script ; use as dialogue condition (GetIsVoiceType == vtFollower0X) VoiceType PROPERTY vtFollower01 auto Hidden Conditional VoiceType PROPERTY vtFollower02 auto Hidden Conditional ; -- EVENTs -- EVENT OnInit() ; mod first time installed RegisterForSingleUpdate(1.0) ENDEVENT EVENT OnPlayerLoadGame() ; mod baken in game and loaded a second time at least RegisterForSingleUpdate(1.0) ENDEVENT EVENT OnUpdate() Debug.Trace(" OnUpdate() - has been called for " +self.GetOwningQuest()) ; just a little info myF_GetVoiceTypes() ENDEVENT ; -- FUNCTIONs -- 2 ;------------------------------------------ VoiceType FUNCTION myF_Get(String s, Int i) ; helper to avoid redundant code ;------------------------------------------ IF (Game.GetModByName(s) == 0x0FF) ; 0xFF = 255 RETURN None ; mod not installed ENDIF ;--------- RETURN Game.GetFormFromFile(i, s) as VoiceType ENDFUNCTION ;--------------------------- FUNCTION myF_GetVoiceTypes() ;--------------------------- vtFollower01 = myF_Get("Follower01Example.esp", 0x00123456) ; <-- use Tes5Edit to get the right formID vtFollower02 = myF_Get("Follower02Example.esp", 0x00123456) ; <-- use Tes5Edit to .. ENDFUNCTION You wrote: "What is the condition for that?" https://www.creationkit.com/index.php?title=Papyrus_Introduction#Writing_Custom_Functions Edited November 25, 2020 by ReDragon2013 Link to comment Share on other sites More sharing options...
WhiteWolf424242 Posted November 25, 2020 Author Share Posted November 25, 2020 Hmm, so this still essentially does what I wrote in the code block 3 posts above:Use the "GetFormFromFile as VoiceType" to make the VoiceType property of my mod's esp equal to the one from the other mod.But the thing I worried there about is, that wouldn't this just make only the script property equal to it? Will the CK too actually then recognize this as that voicetype? This is why I discarded this idea. You're saying it would still work? Oh whatever, I guess only one way to find out - I'll test your code soon, thanks :) Link to comment Share on other sites More sharing options...
dylbill Posted November 25, 2020 Share Posted November 25, 2020 (edited) Ahh, I understand better now. What you could do is make a new faction, and add the NPC from the mod to that faction, using GetFormFromFile to reference the NPC. Then in your dialogue condition you can put GetInFaction MyFaction. That way it will only apply to that 1 NPC. Edited November 25, 2020 by dylbill Link to comment Share on other sites More sharing options...
WhiteWolf424242 Posted November 25, 2020 Author Share Posted November 25, 2020 (edited) @ReDragon2013:As I feared, this code doesn't work. The dialogue is not there. I suspect that it's because the script only makes its own variables equal to each other, but for the CK, though the editorIDs are the same, the formIDs of the VoiceTypes are still different. Therefore when I write (GetIsVoiceType == vtFollower0X), it won't activate for the follower. The CK is looking for vtFollower0X with my esp's formID, but the followers voicetype's formID is different. @dylbill:Now that sounds plausible, that will certainly get the dialogue to appear, but how do I solve the voicetype issue? I'd like to make the dialogues voiced, for which the CK needs to be able to indentify the npc's voicetype.According to the wiki, the conditions which allow the CK to do that are:GetAllowWorldInteractionsGetFactionRankGetInFactionGetIsAliasRefGetIsCreatureGetIsCreatureTypeGetIsClassGetIsFormTypeGetIsIDGetIsPlayableRaceGetIsRaceGetIsReferenceGetIsSexGetIsVoiceTypeIsChildIsInList Now I wonder if placing the npc into a formlist and then using IsInList, or placing the npc into an alias and then using GetIsAliasRef are viable alternatives. I'll try soon. EDIT:Placing the NPC into an alias doesn't work either. Dialogue is OK, but as you can see, there's no way to record voices for it, since the CK cannot find a voicetype for it: Edited November 25, 2020 by WhiteWolf424242 Link to comment Share on other sites More sharing options...
dylbill Posted November 25, 2020 Share Posted November 25, 2020 You can put the voice type into a formlist, and then use the condition GetIsVoiceType MyFormlist == 1. GetIsVoiceType can also work with formlists that contain voicetypes. Link to comment Share on other sites More sharing options...
Recommended Posts