(Cross posted from Discord)
More progress has been made on doing some patching in KotOR 1!
Here I demonstrate adding in a simple test function mto the NWScript VM, and running it in-game.
The summarize what all is happening here:
We patch the space allocated and existing bounds checks for script IDs (I extend the space such that we could have up to 1000 total functions, but I can always extend it more in the future)
I patch the existing initialize commands function in the game to continue onto my own block of code where I initialize this new `TestScriptExtension` command to call a simple execution script (using an identical pattern to the existing scripts in this game)
I added this command to nwscript.nss so `nwnnsscomp.exe` would recognize and compile the script with this new function (special thanks to Edward T. Smith for making a tool that is so well designed that it works out of the box for our very custom situation here)
Set it to run when I talked to carth
The actually function just prints some debug text to Windows Debug, however, we can also have them call other game functions, implement custom stack logic, among other things.
There's still A LOT of work to be done:
I want to clean up the patcher/launcher so that using it is actually intuitive
I want to add a bunch more commands to the script extender
I want to tutorialize the creation of both new commands and patches, so that the lovely and creative people of kotor modding world can contribute in the future
Setting up Kotor 2 compatibility
much much more
Let me know if ya got any questions!