-
Notifications
You must be signed in to change notification settings - Fork 18
Using Mod Organizer 2
You can use the VSCode Papyrus extension with Mod Organizer 2 to help keep your files more organized as you develop a mod. This is especially helpful for Skyrim development because Skyrim CK wants to throw all of your scripts into the same directory with the game's scripts.
MO2 will use user space virtual file system (usvfs) to capture the file creation and write calls from the creation kit and store the files to your own mod directory instead of the game's data directory. This makes things much easier if you want to use git for example to version your files.
If you haven't already then download and install Mod Organizer 2.
Launch Mod Organizer 2 if you haven't already.
Use the tool menu to Create Empty Mod as shown below:
Name the mod whatever you want, but for the purposes of this guide we will assume that you named it "Sample Project Mod".
Select Tools->Profiles... and create yourself a profile dedicated to development of this particular mod (name it the same thing as the mod e.g. "Sample Project Mod").
Set this new profile to be active, then disable most of your mods except the ones you want to test with. Make sure to enable "Sample Project Mod". (The reason for having a separate profile per mod under development is that the tool launcher setting described below is profile-specific, so you can switch all your tools easily by changing profile.)
Select Tools->Executables... and set up (or edit if you already did) an executable for Creation Kit as shown below.
Make sure to check the Create Files in Mod instead of Overwrite checkbox and select your new template mod ("Sample Project Mod") from the popup list. Then hit Apply and OK.
You might also want to set up other tools this way (such as xEdit). Notice that this setting is profile-specific so when you switch profile this will go back to default or switch to a different overwrite mod directory depending on how you configured this when each profile was active. Therefore you could be working on two new mods at once, and switching profile would switch all the tools to write to the other mod directory.
Now launch VSCode and install the papyrus-lang extension if you haven't already. Go into the configuration by clicking the little gear icon. Change the Mod Directory Path* to match the path of the "mods" directory where MO2 stores your installed mods. It will look something like this:
Now, in VSCode, click the scroll (papyrus) icon and then click that little menu icon in the upper right of the project explorer. Select Create ... Project Files for the appropriate game. (If you disabled a game it won't show up in the menu.)
This will open a Select Folder dialog window. Browse to where your "Sample Project Mod" (the empty mod you just created) is and select that as the folder. This will create some files in the directory.
Now, use File->Open Workspace... and browse to the "Sample Project Mod" directory, then select and open the file that ends with the .code-workspace extension. If you want, rename the Papyrus.code-workspace file to something else as long as it ends with the extension .code-workspace
Launch the Creation Kit with Mod Organizer 2 (you must launch it with MO2 so it will use the usVFS and write to your new empty mod) and use it to create a new plugin ESP. The new ESP file will appear in your new mod directory as long as you did the Tools->Executables... configuration properly and launched CK using MO2. Do whatever, create some scripts etc and they will appear in Source\Scripts inside your new mod directory.
Always create new scripts inside Creation Kit because this is needed for usVFS to map the filename properly for CK. Otherwise CK won't "see" the new .psc and .pex files until you quit CK and relaunch it with MO2. You don't absolutely have to do this, but you'll have to quit and reload the creation kit to get it to see the new files so it's less trouble if you do.
Back in VSCode, open up the .ppj file and confirm that everything looks good. Now you can use the Terminal->Run Task... to build all of your scripts at once using Pyro.
Please join us on the Discord if you have any questions.
Extension
Features
- Language Definition
- IntelliSense
- Code Navigation
- Refactoring
- Compilation
-
Debugging
- Debug View
- [Debug Console](Debug Console)
- [Assembly View](Assembly View)
Creation Engine
Language
Help