imported>3Nd R1m |
|
(9 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
| The Skyrim Script Extender (SKSE) is a tool that expands scriptings capabilities and adds additional functionality to the game, as well as allowing modders to create plugins to further extend Skyrim's scripting capabilities. SKSE plugins take form as DLLs files that implement new functions into Papyrus, Creation Kit's scripting language. As you may guess, making an SKSE plugin is more difficult than a standard mod but the benefits of doing one are far greater. This guide focus on implementing new functions into Papyrus Scripting and debugging them.
| | [SKSE64 2.2.6 Revision] |
|
| |
|
| This page is actually '''incompleted''' as it doesn't actually provide a complete tutorial on how to make an SKSE plugin project. We try to figure out how to do it ourselves before guiding others, with our only sources being closed threads, incomplete guides and tutorials who never saw any updates. With any progression on our side will come further upgrade, until this guide is completed. Until then, be assured that everything that has already been laid out is correct and up-to-date.
| | ==Requirements== |
| | *Skyrim Special Edition |
| | *[https://skse.silverlock.org/ SKSE for Skyrim SE] (Also referred to as SKSE64), which you should already have installed. |
| | *[https://visualstudio.microsoft.com/ Visual Studio 2022 Build Tools]. You don't need to install the entire IDE if you won't use it. |
| | *An IDE like Visual Studio, VS Code or CLion. [[User:Xieve|xieve]] recommends using CLion if you have not used Visual Studio before, as it will manage installation of vcpkg automatically, among other things. |
|
| |
|
| == Sources ==
| | Ensure that your Windows and SKSE installations are up-to-date. If Skyrim Special Edition has not received an update in the previous week or so, you will want that up-to-date too. See the official SKSE page to see which version is currently supported. Please keep in mind that this guide does not guarantee backward/forward compatibility, and things keep breaking in unforeseen ways. |
| These are related sources that have inspired this guide. Please note that the instructions may differ from one source to another and that some might simply be completely wrong/outdated.
| |
|
| |
|
| * [http://forums.bethsoft.com/topic/1496168-wipz-skyrim-script-extender-skse/page-4#entry23595441 Zartar's "noob tutorial" on Bethesda's old forum.] The whole discussion may contain other helpful information too.
| | ==Setup== |
| * [https://github.com/Ryan-rsm-McKenzie/CommonLibSSE/wiki Ryan-rsm-McKenzie's Tutorial on GitHub]. However, his tutorial doesn't include a solution for the C2039 errors when compiling with modern SDK.
| | The easiest and recommended approach is to use a template plugin. [https://github.com/Monitor221hz/CommonLibSSE-NG-Template-Plugin This one] is currently (as of 2024-11-16) recommended for CommonLibSSE-NG. [https://commonlib.dev/ See here] for a comparison of the different CommonLibSSE versions. |
| * [https://www.reddit.com/r/skyrimmods/comments/bmg1z7/finally_aiming_for_my_first_skse_plugin_been/ This Reddit discussion]
| |
| * [https://github.com/xanderdunn This GitHub page]
| |
|
| |
|
| Credit goes to Bethesda, the SKSE Team, Ryan/Fuggyduff and every contributors of this page.
| | Follow the documentation that the template plugin of your choice provides, it will be more up-to-date and applicable than any external resource. |
|
| |
|
| == Requirements ==
| | Should you want to, you can set environment variables inside <code>CMakeLists.txt</code> like so: |
| * Skyrim Special Edition
| | set(ENV{VARIABLE_NAME} "Variable value") |
| * [https://skse.silverlock.org/ SKSE for Skyrim SE] (Also referred as SKSE64)
| | For example: |
| * SKSE64 source code which is included in the SKSE64 distribution
| | set(ENV{SKYRIM_MODS_FOLDER} "C:\\Games\\MO2\\mods") |
| * SKSE64 example plugin which ''should'' be included with the source code but actually isn't. A replacement one will be provided as soon as possible.
| |
| * [https://visualstudio.microsoft.com/vs/ Visual Studio 2019], but you can use an earlier version if you wish.
| |
| * And most importantly, you need to know C++ programming.
| |
|
| |
|
| To eliminate any potential trouble, be sure to have the most up-to-date versions of Windows, Skyrim Special Edition and any other toolset specified in this guide. Please keep in mind that this guide does not guarantee Backward/forward compatibility.
| | ==Resources== |
| | | {{:SKSE Plugin Development/Resources}} |
| == Setups == | |
| Before making a plugin, you need to set up the environment.
| |
| | |
| === Building SKSE ===
| |
| To make a plugin we'll first need SKSE's source code. However, SKSE was made with an earlier version of Visual Studio and still use outdated toolsets that aren't available within VS2019. Therefore additional setups must be performed.
| |
| #Within the SKSE zip files obtained from [https://skse.silverlock.org/ the official website] locate and extract the '''src/''' directory.
| |
| #Open the SKSE64 solution '''src\skse64\skse64.sln''' with Visual Studio 2019. VS2019 should already be associated with the .sln file type.
| |
| #Upon loading, you'll be prompted with the option to "Permanently remove source control association bindings". The SKSE team uses what is called "Source control", which is a way to share, update and checkout codes coming from multiple users. We won't (and can't) use their source control so we can permanently remove any source control association. [https://imgur.com/95b5KXK (image)]
| |
| #Just after that, a new window will appear and suggest to Retarget the Projects. The default options should be good enough and you can press '''"Ok"'''. [https://imgur.com/jnyPSWk (image)]
| |
| #; Why is that?
| |
| #: The SKSE project is made with an earlier version of the Visual C++ platform toolset (The 2015 version, there for two major versions behind). It's good development practice to keep your project's component up-to-date and, hopefully, Visual Studio can take care of that itself. However, some more configuration will be needed to successfully build the solution.
| |
| #Open the Property Pages for all projects.
| |
| #: We're gonna tweak some options within the Configuration Properties.
| |
| #: You can do so by selecting all projects within the solution explorer (Tip: select the first element and then the last one while holding '''SHIFT''' ) and press '''ALT'''+'''ENTER''' to open the Property Pages.
| |
| #: Also make sure that the '''Configuration''' field is set to '''All Configuration''', as we want them to apply for Debbuging as well as releasing.
| |
| ## Disable post-build events
| |
| ##: The project files include post-build events that we don't want (Such as automatically moving files into Skyrim's directory).
| |
| ##: To disable post-build events, navigate to '''Build Events => Post-Build Event''' and change the '''Use in build''' field to '''No'''.
| |
| ## Set C++ Language Standard
| |
| ##: Navigate to '''C/C++ => Language''' and set '''C++ Language Standard''' to '''ISO C++17 Standard (/std:c++17)'''.
| |
| ## Force-include <string>
| |
| ##: At this point, any attempt to build the solution will fail and there will be many errors [https://imgur.com/9jpNjtK (image)], with the most predominant one being <q>C2039: 'string' is not a member of 'std'</q>. In other words, many files are using the 'string' class without including the required header to do so.
| |
| ##: You can fix this without manually adding #include directives by instead navigating to '''C/C++ => Advanced''' and adding "string" (without quotation) in the '''Force Include File''' field. This will automatically include the string header whenever it's required.
| |
| ## Click "Apply" and then "Ok". [https://imgur.com/4DWpnzP (Image)]
| |
| | |
| SKSE should be ready to build. To test that, build the solution with the Release configuration. If no error occurs, congratulation! We can move on to the next section.
| |
| | |
| ==== Testing the build ====
| |
| This section is optional and aims to further validate our home-built SKSE by testing it.
| |
| Assuming you already have SKSE installed, go ahead and replace the original files from the Skyrim SE directory with the new ones located in '''src/skse64/x64/Release'''. The files to replace are '''skse_(version).dll''', '''skse_loader.exe''' and '''skse64_steam_loader.dll'''.
| |
| After replacing them, try to run '''skse_loader.exe'''. Skyrim should launch without any issues.
| |
| | |
| Note: Hypothetically, an SKSE built with updated configurations may give better performance than the default one provided by the SKSE team, but the opposite may also be true.
| |
| | |
| == What next? ==
| |
| At this point, we should start making the actual plugin. You can follow [https://github.com/Ryan-rsm-McKenzie/CommonLibSSE/wiki Ryan's Tutorial] while this page is being written.
| |
[SKSE64 2.2.6 Revision]
- Skyrim Special Edition
- SKSE for Skyrim SE (Also referred to as SKSE64), which you should already have installed.
- Visual Studio 2022 Build Tools. You don't need to install the entire IDE if you won't use it.
- An IDE like Visual Studio, VS Code or CLion. xieve recommends using CLion if you have not used Visual Studio before, as it will manage installation of vcpkg automatically, among other things.
Ensure that your Windows and SKSE installations are up-to-date. If Skyrim Special Edition has not received an update in the previous week or so, you will want that up-to-date too. See the official SKSE page to see which version is currently supported. Please keep in mind that this guide does not guarantee backward/forward compatibility, and things keep breaking in unforeseen ways.
The easiest and recommended approach is to use a template plugin. This one is currently (as of 2024-11-16) recommended for CommonLibSSE-NG. See here for a comparison of the different CommonLibSSE versions.
Follow the documentation that the template plugin of your choice provides, it will be more up-to-date and applicable than any external resource.
Should you want to, you can set environment variables inside CMakeLists.txt
like so:
set(ENV{VARIABLE_NAME} "Variable value")
For example:
set(ENV{SKYRIM_MODS_FOLDER} "C:\\Games\\MO2\\mods")
As of 2024-11-16, there is no definitive resource on SKSE plugin modding.
Please note that instructions may differ from one source to another and that some might simply be completely wrong/outdated.
Generally, SKSE plugin development heavily depends on a good IDE that allows you to browse the SKSE and CommonLibSSE sources, and on reading other people's source code on GitHub.
If you chose to use CLion, navigate to <Project Directory>\build\debug-msvc\vcpkg_install\vcpkg\pkgs\commonlibsse-ng_x64-windows-skse
, right-click it and select Mark directory as
→ Library Files
. Now, when you hit shift twice to invoke Search Everywhere, all the CommonLibSSE symbols will show up in your search!