WS: Script Compilation Errors overrides
When you install multiple mods you can encounter Script Compilation Errors - just like in the screenshot above. Here’s why that happens and how to solve that issues.
This error is caused because multiple mods edit the same files. The scripts are compiled when the game starts and that’s when you will be notified about conflicting files causing issues.
Script Merger
If two or more mods edit the same files, you need to merge the script files with Script Merger - which is a free community tool available on http://nexusmods.com.
To avoid that problem in the first place, create your mods using script overrides which were introduced in the game patch on 06.06.2024 so users only need to worry about priority.
Annotations
Script files supports a number of annotations.
Their main purpose is to add/modify functionality in existing game functions and classes.
To use annotation, create a new .ws file for your mod or workspace with your annotated code.
@wrapMethod(class)
@wrapmethod requires you to define a function with the same signature as an existing in-game method, effectively wrapping that method. When the original method is called, your function will execute instead, but it must also call the original method using the special identifier wrappedMethod
. This annotation also supports chaining multiple wrappers, allowing incremental additions to the method's functionality. This approach helps maintain compatibility between different mods that modify the same methods.
@wrapMethod( CPlayer ) function CheatGod2(on : bool)
{
wrappedMethod(on); // this will call the original CheatGod2
thePlayer.AddMoney(300);
}
Will fail to compile if the class does not exist, or if wrappedMethod
has not been specified.
@addMethod(class)
Adds a newly defined method to the specified class.
@addMethod(CPlayer) public function scriptextAdd()
{
dummy = 12345;
}
Will fail to compile if the class does not exist.
@replaceMethod(class) and replaceMethod
Replaces an existing function in the specified class. Your function will replace the existing method.
@replaceMethod(CPlayer) function CheatGod2(on : bool)
{
thePlayer.AddMoney(2000);
}
To replace a global function do not specify a class.
@addField(class)
Adds a field to the specified target class.
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.