Jump to content

[LE] Automatically detect if a mod is installed (and active thus-optional content)


Recommended Posts

@NexusComa2:

Thanks, yes, and that's pretty much resolved.

The issue left is getting the voicetype to show in the CreationKit for creating voiced dialogues.

Fortunately:

 

@dylbill:

YUSSSS :smile: With some added tweaks, the FormList trick finally works, and now everything is in place. Thanks so for much for helping out! :smile: :smile:

 

I'll leave behind the refined final recipe for any other unfortunate soul who's looking for the same answer:

 

 

Notations: Mod being edited: Mod.esp, follower mod: Follower.esp, it's voicetype being FollowerVoicetype.

 

1) In Mod.esp, create a new voicetype called FollowerVoicetype.

2) In Mod.esp, create a formlist, ex. FollowerFormList. Add FollowerVoicetype to this formlist.

3) Create a dummy Actor, and give them FollowerVoicetype. I've found that there must be at least one Actor with a voicetype in order for the voicetype to be eligible for audio recording. But since the actual NPC comes from another mod, we need a placeholder dummy Actor with this voicetype to be able to record our dialogue.

4) The handler script: This will add Follower.esp's FollowerVoiceType's form to our formlist (if the mod is installed):

Make a new quest, create a Player alias. Attach this script, then set its properties accordingly:

Scriptname YourHandlerScript   extends ReferenceAlias
 
FormList Property FollowerFormList  Auto
 
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()
    ; you could possibly add a condition here to only do this once, that's just optimization and I was lazy do it yet. It's like 2 minutes to do though.
    if(Game.GetModByName("Follower.esp") != 255 )
        FollowerFormList.AddForm(Game.GetFormFromFile(0x000012de, "Follower.esp") as VoiceType)   ; <- For this, open TES5Edit, and check the voicetype's formID in Follower.esp. (The first two digits after 0x can be anything, it won't matter).
    endif
ENDEVENT

5) You can now add your voiced dialogues to the follower from the other mod! The condition for them in the dialouge window is Subject.GetIsVoiceType("FollowerFormList ") == 1. If all went well, the voicetype is now recognized by the CK too, you can record your dialogues, and it will be played properly in-game.

 

 

 

Thanks again to everyone :smile:

Edited by WhiteWolf424242
Link to comment
Share on other sites

  • Recently Browsing   0 members

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