Currently, there's an issue with core script modding. Right now, a single core script handles all events triggered on the object. This is bad for modding because if someone makes a change to the core script in one place, that mod will conflict with a mod that changes the core script somewhere else, even if they're not related. The best way to handle this is to break the core scripts apart so that each event is handled in its own separate ncs file. For example, in my "Items Received" mod, I added a line of code to the function in the player_core script that is called on an INVENTORY_ADDED event. In testing, I found that I could move the contents of this function to another script called pc_he_Inventory (for "Player core, handle event inventory" the name doesn't really matter but it's important to have a consistent naming scheme) and replace this function with
int HandleEvent_InventoryEvent(event ev)
{
HandleEvent(ev,R"pc_he_Inventory.ncs");
return TRUE;
}In reality, if I was doing more than just testing, I should have kept the switch statement in the original function and had separate scripts for the INVENTORY_ADDED and the INVENTORY_REMOVED events which are both currently handled in the InventoryEvent function.
Doing this with how the core scripts handle all events would greatly reduce the potential for conflicts from mods. I also suspect that, unlike the core scripts, the handle event scripts could be located in Addins for easy management.
Modifié par KaylaKaze, 14 novembre 2009 - 07:56 .