WS: Create your first script mod
Let’s create a simple script-based mod.
Go to your The Witcher 3: The Wild Hunt installation folder and create a new folder called mods inside it (if it doesn’t exist yet). This will be the place where all your mods are placed.
Folder structure
In the mods folder, create another new folder for your mod, following this naming convention: “modXXXX”.
We will use: modScriptsTutorial.
“mod” is needed in the folder name because of the way the game loads in mods. Find out more, here: Managing mods.
In the modScriptsTutorial you need to add three more nested folders:
content
scripts
local.
In the last folder create a new file with the extension .ws (you can use the Notepad app and save an empty text file with this extension).
For example: scriptstutorial,ws.
Exec function
In the world of The Witcher 3: The Wild Hunt scripts there is a special kind of function called the “exec function”.
It allows you to create code snippets that you can trigger via the developer console in-game. A very simple example could look like this:
exec function scripts_tutorial_test()
{
GetWitcherPlayer().DisplayHudMessage('Hello');
}
Enter the text in the scriptstutorial.ws file and save it.
Launch the game, open the developer console (~ button) and type in scripts_tutorial_test()
.
Good news! CTRL+V works in the debug console!
Press enter and… you should see the “Hello” message on the screen!
Congrats you have just made your first script mod!
Table of contents:
______________________________________
The Witcher 3: Wild Hunt Complete Edition © 2024 CD PROJEKT S.A. Published by CD PROJEKT S.A. Developed by CD PROJEKT RED. CD PROJEKT®, The Witcher®, REDengine® are registered trademarks of CD PROJEKT Capital Group. All rights reserved. The Witcher game is set in the universe created by Andrzej Sapkowski in his series of books. All rights reserved.