About this mod
Instructions on how to get BlocTheWorker's AI working in Skyrim SE.
- Requirements
- Permissions and credits
This is a guide for people who want more explicit instructions on how to install BlocTheWorker's mod. Developers might prefer to follow the instruction on his GitHub page instead.
Below there are also instructions on how to integrate ElevenLabs voices (well, one voice at this point).
Demonstration video at the bottom.
2023-05-15 Update: There is an update coming from Bloc in the future. It might be best for modders to wait for the update before integrating this with other mods, as the update might cause versioning issues. Also, see his post under the Posts section of this mod page.
Disclaimer
This is my "three days' effort" integration of BlocTheWorkers awesome mod, which likely took a lot longer to create. Please consider supporting his work.
I could post a mod that does a lot of the work below, but that would require uploading assets that are not my own work. Therefore, I post detailed instructions instead.
Notes
These instructions were tested with version 1.5.97. It is provided "as-is", i.e. if you want to use it in newer or older versions, you need to adapt it accordingly.
To have the complete setup running, you need at least a trial account with Inworld AI (lasts 7 days) and the basic package with ElevenLabs ($5). Without a paid ElevenLabs account, you cannot create your own AI voices.
To-do list
>> Wait for the mod update from Bloc
> Allow for multiple voices
> Alternative to Python
> Dialogue integration (long-term)
Prerequisites
Inworld AI
Create an Inworld AI account from the signup page.
Be sure to use the Sign up with email option.
ElevenLabs (optional)
Create an ElevenLabs account from the signup page.
The signup option is not important.
Visual Studio
Download and install Visual Studio 2022. The free Community edition can be downloaded from the official download page.
During installation, under the "Workloads" tab, select the "Desktop development with C++" package.
vcpkg
Install vcpkg by following the "vcpkg" instructions on this GitHub page.
Node.js
Download and install Node.js from the download page.
Creation kit
Install the Skyrim Creation Kit
Build the InworldSkyrim mod
SKSE
Extract the files from the archive downloaded from BlocTheWorker's GitHub page.
Extract the files in the download section of this mod.
Launch Visual Studio 2022.
Select the "Open a local folder" option.
Navigate to the files extracted from the BlocTheWorker mod above and choose "Select Folder" for the SKSE folder.
If you open the Output view (Ctrl+Alt+O), you should see lines such as
CMake generation started for configuration: 'debug'.
with a couple of fetching and installing lines (11 packages to install), ending with
CMake generation finished.
Change the build type from "Debug" to "Release" (center top in Visual Studio window).
The Output view should again show the lines from earlier, but for the 'release' configuration.
Build by pressing Ctrl+Shift+B, or by selecting the Build > Build All menu.
In the directory where this project is located, navigate to the new SKSE/build/release folder.
Copy the "InworldSkyrim.dll" file to the folder downloaded from this mod page:
NPC AI for SSE/InworldSkyrim/SKSE/plugins/InworldSkyrim.dll
Create the temporary script mod
In ModOrganizer, create an empty mod and call it "Inworld Scripts Temp".
Open the mod in explorer and copy the contents of the "Papyrus" folder from the BlocTheWorker mod download to this mod folder.
Optional:
Create a "Scripts" folder and move the "Source" folder and "InworldConversation.pex" here.
This should match your Creation Kit scripts path, configurable in "Skyrim Special Edition/CreationKit.ini":
[Papyrus]
sScriptSourceFolder = Data\Scripts\Source
Creation kit
Open Skyrim Creation Kit using ModOrganizer, with the
UIExtensions
, iWantWidgets
and Inworld Scripts Temp
(created above) mods enabled.Load > enable the following:
Skyrim.esm
Update.esm
iWant Widgets.esl
SkyUI_SE.esp
Continue (no active file).
"Yes to all" for all warning popups.
Navigate to Character > Quest
Right-click somewhere in the list of quests and select "New".
The ID doesn't matter, but select something unique, such as "Quest_InworldSkyrim".
The Quest Name can be anything.
Close the dialog by selecting "Ok".
Hit "Save" in the Creation Kit window and name your ESP "InworldSkyrim.esp".
Open the "Quest_InworldSkyrim" item.
Navigate to the "Scripts" tab.
Click "Add".
Type "Inworld" in the search box without the quotes and select "InworldConversation".
NOTE:
Creation Kit sometimes doesn't register changes to quests.
To make sure the script is saved to the Quest, go back to the "Quest Data" tab and add any letter to the end of the "Quest Name" field.
Hit "Ok" to save changes to the quest.
Your Creation Kit window should have a "*" to indicate that there are unsaved changes.
Save the mod by selecting the save button on the Creation Kit window.
Close Creation Kit.
There should now be a "InworldSkyrim.esp" file in your ModOrganizer overwrites mod or the Creation Kit output mod.
Move this mod to the folder downloaded from this mod page:
NPC AI for SSE/InworldSkyrim/InworldSkyrim.esp
Disable the "Inworld Scripts Temp" mod.
Copy the "InworldConversation.pex" file from this mod to "NPC AI for SSE/InworldSkyrim/Scripts/InworldConversation.pex".
Inworld AI
Navigate to the Client folder of the extracted BlocTheWorker mod download.
Rename ".env.example" to ".env"
Open the file in a text editor
Replace all the text in quotes with your information from Inworld AI.
Open Command Prompt and navigate to the folder containing the ".env" file.
Enter the following command:
npm install
This should take a while. After it is done, enter the following:
npm start
It should generate the character models at the first start.
You will need to run this "npm start" command from this directory every time before you launch the game.
Create and run the mod
In ModOrganizer, create an empty mod and call it "InworldSkyrim".
Open this mod in Explorer.
In a separate window, navigate to "NPC AI for SSE/InworldSkyrim".
Select all of the folder contents using Ctrl+A.
Copy to the empty mod.
In ModOrganizer, enable the "InworldSkyrim" mod.
Launch the game.
Usage: press the "Y" key when close to these characters:
Lydia
Jarl Balgruuf
Jon Battle-Born
Carlotta Valentia
...other characters added by the BlocTheWorker mod.
ElevenLabs integration (optional)
The controversial part.
ElevenLabs voice clone
Download and install BAE.
Extract "Skyrim - Voices_en0.bsa" in BAE.
In the extracted folder, navigate to sound/voice/skyrim.esm/malenord.
Copy these files to a new folder:
dialoguewh__00019f6a_1
dialoguewh__00019f7a_1
dialoguewh__00019f69_1
dialoguewh__00019f77_1
dialoguewh__00019f78_1
dialoguewh__00019f79_1
dialoguewh__0001893c_1
dialoguewh__00018952_1
Download and install the Yakitori Audio Converter.
Convert the files to the WAV format.
On the ElevenLabs webpage, navigate to the "VoiceLab" page.
Add a new voice and call it "JarlBalgruuf_01".
Add the WAV files as voice samples.
Get an API token by selecting your account icon on the top right and selecting "Profile".
Python
Download the latest version of Python for Windows here.
After installation, open Command Prompt and run these commands:
pip install pyinstaller
pip install elevenlabs
Open the Python script downloaded with this mod in a text editor: NPC AI for SSE/Python/fetch_and_play.py
Copy and paste your ElevenLabs API key where indicated.
Open Command Prompt and navigate to the folder containing this Python script.
Run the following command:
python fetch_and_play --text_to_generate "Hello Dragonborn. How are you?"
This should play the text supplied, spoken by ElevenLabs Jarl Balgruuf.
In the same Command Prompt window, enter the following command:
pyinstaller --onefile fetch_and_play.py
A new "fetch_and_play.exe" file should be created under the dist/ folder.
Modified SKSE DLL
Open the SKSE folder as indicated above.
Add the following lines in the plugin.cpp file:
In line 8:
#include <Windows.h>
#include <chrono>
In line 96 (note that the 9000 == 9 seconds - modify this to have better synchronization with subtitles in game):
FetchAndPlayAudio(response);
std::this_thread::sleep_for(std::chrono::milliseconds(9000));
And in line 139, replacing the path as indicated:
private:
static void FetchAndPlayAudio(std::string message) {
// NOTE: replace the path below with the path to the Python EXE that you created
std::wstring executablePath = L"E:\\Modding\\Tools\\FetchAndPlay\\fetch_and_play.exe";
std::wstring message_wstr = std::wstring(message.begin(), message.end());
std::wstring call = L"fetch_and_play.exe --text_to_generate \"" + message_wstr + L"\"";
wchar_t* cmdArgs = _wcsdup(call.c_str());
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_FORCEOFFFEEDBACK;
si.wShowWindow = SW_SHOWMINNOACTIVE;
ZeroMemory(&pi, sizeof(pi));
if (!CreateProcess(executablePath.c_str(), cmdArgs, NULL, NULL, FALSE, CREATE_NEW_PROCESS_GROUP, NULL, NULL, &si, &pi)) {
printf("CreateProcess failed (%d).\n", GetLastError());
}
free(cmdArgs);
// Close process and thread handles.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
Build the project and export the DLL to the InworldSkyrim folder as was done above.
YouTube