The Extended THK Library - Ezekial711/MonsterHunterWorldModding GitHub Wiki

The Leviathon language specification supports syntactical operations and compilation that go beyond the limits of traditional naked THK files. This capabilities are added as part of the Extended THK Library (ETL). The ETL allows the game to interpret a number of functions beyond the ones it's natively coded with. Additionally it empowers a few existing functions.

Installation

The ETL itself is distributed with the Amsterdam Bucharest Compiler, however the ETL relies on Fexty's MHW THK Extender. The ETL.dll and ETL.json files go in nativePC\plugins\thk-extensions while the main mhw-thk-extender.dll goes in nativePC\plugins.

Usage and Conditions

Without the MTE and the ETL plugins, lines of code that depend on ETL functionality will simply evaluate to False. So if you depend on functionality provided by the ETL (which is explicitly defined by the Leviathon Language Reference) your users must separately download the MTE and ETL. The ETL is provided for free use and bundling with mods that depend on it, as long as the upload site for the mod does not require ownership transfer (for example Nexus Mods has such requirements and thus the ETL download must be done separately by your users if your mod is hosted there).

The MHW THK Extender

The MHW THK Extender is a plugin framework designed by Fexty and AsteriskAmpersand and written and maintained by Fexty. It enables extending the existing library of functions already present in the game, allowing checking non-standard or more complex conditions than existing checks and also powering more adventurous edits of monster state and behavior.

An example extension is provided within the repository. Additionally one specifies the function ID to be used in a JSON file named the same as the DLL generated from compiling the extension.

For example, if we had test-extension.dll with a function TestExtension that we wished to assign to ID 0x1001, our JSON would look like:

{
"functions": [
              {"name": "TestExtension",
               "id": "0x1001"}
             ]
}

It's recommended to start from the range of 0x1XXX and avoid values below that as they will conflict with in-game checks. Additionally the range on 0x3XXX is also reserved for the ETL.

It's then possible to introduce this function into the compiler so one can call it by a friendly identifier within NACK Files. To do this, copy the default.fexty file and add your entries at the bottom following the FEXTY File Syntax.

For example in the previous case we'd add the following at the end of the file:

1001: isRathian()

And we could call our check within a NACK file through

def node
   self.isRathian() -> self.takeoff()
endf

Remember to pass the FEXTY file to the compiler through the -fexty flag. Otherwise the compiler will not be able to recognize your additional functions.