Is there a way to use a LUA to make a mod that automatically replaces all instances of an item in the world it is used in with a different item?
Should be possible, whip up a function that checks for the existance of the item in some way and returns the item (searching X tiles around the player for the item, or something along those lines. PoraComp mop actions does something similar and would be a good way to see how it’s done. ) Then just rewrite the item.type attribute to whatever item you want it replaced with.
Thank you. And now time to experiment and Frankencode.
What do you want a kind of a blacklist or what?
Actually, there’s JSON code that does this. I think it’s an obsoletion entry or something?
What I am trying to do is make the combat knife add a new underbarrel mod slot when it is attached so that it doesn’t block a foregrip or something like that. However that did not work so my first assumption was that it was a hard coded thing (like how it could originally only be attached to the underbarrel). So instead of make a mod that modifies every instance of a vanilla knife spawn why not just make a mod that when I was in proximity it would replace the old one with a new one thus circumventing that problem. Unfortunately I just tried making a modded copy of the combat knife and it also does not add that additional underbarrel slot so yeah that is kinda disappointing.
NEVERMIND I found out why the add underbarrel mod on the combat knife wasn’t working. I just had it set up wrong (needs to be in the gunmod data section of its entry).