Desiring to use some custom items in another play-through of the NWN Original Campaign, I discovered that I would need to modify each campaign Modules to enable Tag-Based Scripting. From those who have gone before, I learned that to enable Tag-Based Scripting in a Module, I would have to change the Module’s OnActivateItem
and OnModuleLoad
Event properties (run the NWN Toolset, open a Module, then Edit > Module Properties > Events
) to the built-in x2_mod_def_act
and x2_mod_def_load
scripts, respectively.
But, if the Module already has a script in one of those properties, to avoid breaking the Module, I would first have to merge the existing script with the Tag-Based Scripting script, or determine a way to handle the existing script. I found that for the OC Modules, they all had a pre-existing script in the OnActivateItem
Event, but that script existed for the sole purpose of handling the Stone of Recall item. In these cases, rather than try to merge the existing OnActivateItem
script with the x2_mod_def_act
script, theoretically I could use Tag-Based Scripting to handle the Stone of Recall by copying the pre-existing script to a new script nw_it_recall
(matching the Item Tag of the Stone of Recall). After creating this new script, I could then delete the pre-existing OnActivateItem
script and replace it with the x2_mod_def_act
script.
However, I have been encountering problems with this approach and I would like to know why. I have found that, starting with the basic 1.69 OC Module, then in the NWN Toolset, changing the OnActivateItem
to x2_mod_def_act
and OnModuleLoad
to x2_mod_def_load
, copying the former script (e.g. M2ACTIVATED
for Chapter 2) to nw_it_recall
, then deleting the former script from the Module before saving, in-game the Module behaves as if it has nothing in the OnActivateItem
Event. Even if I modify the script to add debug messages (SendMessageToPC
), the messages never display on the activation of the Stone of Recall or any other item.
If I take all of those steps, except leave the former script in the module instead of deleting it, then the Module behaves as it still has the former script for the OnActivateItem
Event, in that the Stone of Recall will work, but no item which uses Tag-Based Scripting will work.
If I leave the former script in the module, then edit it to match the contents of the x2_mod_def_act
script, and compile it, then Tag-Based Scripting does seem to work. For example, in my Chapter 2 module, I have Tag-Based Scripting working with x2_mod_def_act
as my OnActivateItem
Event script, but with M2ACTIVATED
still as a Script within the module and its content matching x2_mod_def_act
.
In summary, in all of these cases, the Module acts as if I never changed the OnActivateItem
Event script from the original script.
Initially, I had thought that my installation had issues, but then I tried on a different machine, and even with fresh installations and observed the same behavior. To me, this doesn’t make sense, and I’m wondering why I am encountering this behavior.