Wacko Posted July 9, 2023 Share Posted July 9, 2023 (edited) Hiya guys/gals, Relatively new to modding, can read xml's etc and have tinkered for years with others but trying something new for a change. <!-- metal garbage can--> <lootcontainer name="garbage" count="1,2" size="6,2" sound_open="UseActions/open_trashcan" sound_close="UseActions/close_trashcan" loot_quality_template="qualBaseTemplate"> <item group="groupGarbage"/> </lootcontainer> How do I create a modlet to add the code destroy_on_close="true" to it? I have looked at the code from a modlet all ready about adding loot and destroying on close to the wine barrels but can't for the life of me work out how to add destroy on close for the garbage can that all ready has a loot table. I tried the below but I get a red error saying "EXC Duplicate lootlist entry with name garbage" <!-- metal garbage can--> <append xpath="/lootcontainers"> <lootcontainer name="garbage" count="1,2" size="6,2" sound_open="UseActions/open_trashcan" sound_close="UseActions/close_trashcan" loot_quality_template="qualBaseTemplate" destroy_on_close="true"> <item group="groupGarbage"/> </lootcontainer> </append> SOLVED <remove xpath="/lootcontainers/lootcontainer[@name='garbage']" /> <append xpath="/lootcontainers"> <lootcontainer name="garbage" count="1,2" size="6,2" sound_open="UseActions/open_trashcan" sound_close="UseActions/close_trashcan" loot_quality_template="qualBaseTemplate" destroy_on_close="true"> <item group="groupGarbage"/> </lootcontainer> </append> ** Posted in wrong forum, sorry, don't know how to delete or move ** Edited July 9, 2023 by Wacko Posted in wrong forum :( (see edit history) Link to comment Share on other sites More sharing options...
BFT2020 Posted July 10, 2023 Share Posted July 10, 2023 Sorry I didn’t see this earlier, but another way is to use setattribute when you are adding a new attribute to a node. Link to comment Share on other sites More sharing options...
Wacko Posted July 10, 2023 Author Share Posted July 10, 2023 Thanks mate, I guess the way I did it isn’t optimal, but it worked. How would setattribute work when the destroy isn’t there to begin with? These xml edits take a bit getting use to but I’m trying. Link to comment Share on other sites More sharing options...
BFT2020 Posted July 11, 2023 Share Posted July 11, 2023 Setattribute would add the destroy on close variable to the node itself. So as an example <setattribute xpath="//lootcontainer[@name='hardenedChestT5']" name="destroy_on_close">true</setattribute> So assuming I got my pathing right, if you were to enter this code, the T5 reinforced loot chests would now get the destroy on close variable and would behave like a nest now after you loot and close it. On 7/9/2023 at 10:46 PM, Wacko said: Thanks mate, I guess the way I did it isn’t optimal, but it worked. Yeah, not optimal which is why I said it was another way. This way you don't have to remove the code first, and then re-enter it again (reduces your 7 lines of code down to 1 in this example). Another advantage of doing it this way if in future updates they make some minor changes to the other parts of it, your code would still work (most of the time). 1 Link to comment Share on other sites More sharing options...
Wacko Posted July 13, 2023 Author Share Posted July 13, 2023 On 7/11/2023 at 11:35 PM, BFT2020 said: Setattribute would add the destroy on close variable to the node itself. So as an example <setattribute xpath="//lootcontainer[@name='hardenedChestT5']" name="destroy_on_close">true</setattribute> So assuming I got my pathing right, if you were to enter this code, the T5 reinforced loot chests would now get the destroy on close variable and would behave like a nest now after you loot and close it. Yeah, not optimal which is why I said it was another way. This way you don't have to remove the code first, and then re-enter it again (reduces your 7 lines of code down to 1 in this example). Another advantage of doing it this way if in future updates they make some minor changes to the other parts of it, your code would still work (most of the time). You my friend are a champ Just edited and all works a treat. Cheers for the help. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now