I modified monster.lua so that specific players could apply statuses to monsters based on a percentage. What happens to the original one, and what happens if another mod changes monster.lua?
If you add any file in a mod, you will replace that file. The exception is .patch files which patch(instead of replace) any sort of JSON type. You can't make a .patch file for LUA scripts, but there are usually other options. Now if you replaced this file, and other mod also replaced this file, which ever mod loaded last would replace the other so one of the mods will be broken. You can coordinate changes, but... that's not the most viable of solutions given who knows how many mod authors out there. The better way in most cases is being more surgical about it. You can hook functions. Functions are a data type, and one nameSpace can be assigned another function. Likewise more than one nameSpace can point to the same function. Code: local old_update = update update = function(dt) --your code here old_update(dt) --your code here end The hook will at some point (depending on what you need to do) call the old function. In some cases though, you might replace the old function instead of hooking. Still better than replacing the whole script when you only need to edit one part, and add a few more functions. To get another script in there, you can patch the monster entities(or scripted entities). Consider this from /monsters/generated/bonebird.monstertype Code: "baseParameters" : { "scripts" : [ "/monsters/monster.lua" ], "scripts" is an array, and you just need your own script at the end. Thus this patch. Code: [ { "op" : "add", "path" : "/baseParameters/scripts/-", "value" : "/monsters/ThornyFlora_monsters.lua" } ] And when I mean your script, I don't mean the entire vanilla script with some edits, but just the changes you need so to minimize the chance for incompatibility with other mods. Mods often hook the player environment, for example. FU alone has 5 scripts doing this - check the player.config.patch file to see what I mean. Then look at the scripts it references there.
In that case, yes every monster type you want to change. But that's just copying the same patch file and renaming for each one. It's easier for npcs because they use a system of prototyping so patching the base type would cover all npcs. Not sure why monsters don't use this too.