Jump to content

help needed with mod slots


Recommended Posts

I just recently changed some T0 equipment to not have any mod slots.

 

Not sure if 8 will work (you might have to adjust the UI) but here is the code that you would need to change:

 

Look for this line in the items.xml file

 

        <passive_effect name="ModSlots" operation="base_set" value="1,1,2,2,3,4" tier="1,2,3,4,5,6"/>

 

Tier is the quality level of the item, value is the number of slots available at that quality level

Link to comment
Share on other sites

thank you, but I need the append set code to get it to work

 

this is what I have, and it doesn't work

 

<set xpath="/items/item[starts-with(@name, 'gun')]/effect_group[starts-with(@name, 'gun')]/passive_effect[@name='ModSlots']/@value">8,8,8,8,8,8</set>

 

I've tried a lot of ways and nothing

Edited by dragonslayer770 (see edit history)
Link to comment
Share on other sites

22 minutes ago, dragonslayer770 said:

thank you, but I need the append set code to get it to work

 

this is what I have, and it doesn't work

 

<set xpath="/items/item[starts-with(@name, 'gun')]/effect_group[starts-with(@name, 'gun')]/passive_effect[@name='ModSlots']/@value">8,8,8,8,8,8</set>

 

I've tried a lot of ways and nothing

 

First, what is not working exactly?  Do you have this code between <config> </config>?  Are you getting any errors in the console regarding mods when you load up a game?  Does your modlet have a ModInfo.xml file?

 

I copied and paste your code into my modlet and I saw the following:

 

  • No errors on loading
  • I picked three weapons out of creative menu:  one at Q1, one at Q5, and one at Q6 (hunting rifle, lever action rifle, pipe machine gun).
  • All 3 weapons had 6 mod slots.

 

The code is definitely changing the mod slots available, but it doesn't display more than 6.  This could either be a hard limit in the game or an UI (user interface) issue.  You might not be seeing more than 6 because there is not enough screen space.  If that is the case (and not because of a hard limit on mod slots which I doubt there is), you will also need to adjust the sizes of those slots to get more on the screen (kind of like the bigger backpack mods).

Link to comment
Share on other sites

6 hours ago, dragonslayer770 said:

hi all , im trying to give all guns and tools random 0-8 mods slots.

can some one help with the set code if possible, thank you.

 

Hi dragonslayer770

 

You could download the Dough mod is for A19, maybe it will work on A20, it would be a matter of checking it.
Regards

 

 

Link to comment
Share on other sites

4 hours ago, BFT2020 said:

First, what is not working exactly?  Do you have this code between <config> </config>?  Are you getting any errors in the console regarding mods when you load up a game?  Does your modlet have a ModInfo.xml file?

when i craft one any level it has one mod slot, yes the code is between <config> </config>, no errors and yes the modlet has a ModInfo.xml file.

so what i want is to craft a gun any level and have it give a random number of mod slots.

Link to comment
Share on other sites

so im getting this 

IOException: Sharing violation on path C:\Users\DRAGO\AppData\Roaming\7DaysToDie\GeneratedWorlds\Xasavuja Valley\dtm_processed.raw
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.File.OpenRead (System.String path) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at IOUtils+<CalcCrcCoroutine>d__4.MoveNext () [0x0002b] in <121d1e4a719c47f49c224fa4fc9d63b1>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00026] in <544fca0986d54eca88fc7c56e2a8b4b4>:0

no sure what it is does anyone know what this means

Link to comment
Share on other sites

Hello :)

If you're using the mod named "Doughs-UI-Add-2ModSlots" version 19.2.1.0 has not been tested/converted to work with a20 experimental (as mentioned above) BUT

I put just that single mod into the "Mods" folder of the game and started a new map using Navezgane on the latest 20 exp build and it appears to work in a few weapons I checked (I did not spend any time really checking it though, like adding weapon mods, etc).

 

What I was looking for was:

- The mod loads without apparent errors: it does

- The mod adds 2 more slots: it does

 

Based on how it worked in a20 exp, I'm reasonably sure its not generating that "IOException: Sharing violation on path..." error.  However it appears you may be attempting to create a mod of your own from it. Note: my mod only (very clumsily) makes it so all weapons have 2 mod slots (8 total). It doesn't do this and make the UI pretty either, nor does it do it randomly as you're trying to do. I don't know how to easily make it random unless there's some way to do logic in that part and perform a random number check and then choose the slot count based on that...and just looking at weapons items.xml it appears that for to be "random" it has to already be "a random thing" the game accepts ( like a range) or it has to be a triggered effect, and ModSlots appears to be a passive effect. I could *easily* be wrong about this though as I haven't brushed up on modding in a bit and I never got into all the minute differences like this. here's an example for a "random roll" for a triggered effect for the junk sledge so show what "RandomRoll" looks like to determine if it ragdolls when it hits something (I am guessing) and it only triggers a ragdoll if its 30% of the time:

<triggered_effect trigger="onSelfAttackedOther" action="Ragdoll" target="other" duration=".2" force="200">
	<requirement name="ProgressionLevel" progression_name="perkTurrets" operation="LTE" value="1"/>
	<requirement name="RandomRoll" seed_type="Random" min_max="0,100" operation="LTE" value="30"/>
</triggered_effect>

I'm not sure if you'd be able to use this logic with ModSlots... like make several of these rules and say 1 slot if 10%, 2 if 11-20%, 3 is 21-40%...etc. . I almost thing you'd need cvar or something to keep track of/set the ModSlots string, but I am not well versed on their usage.  I may be talking gibberish at this point...sorry :(

 

"IOException: Sharing violation" from what I believe (and I'm not super knowledgeable about Unity or anything it does, so I'm guessing a bit. not googling too much) is related to opening/closing/accessing files, and something tried to access/open/close a file that was already open/accessed by something else (e.g. "sharing" was not allowed). There are a few more clues as you read "down" into the error: "System.IO.FileAccess access" probably means "accessing the file" and "System.IO.File.OpenRead" likely means "trying to read the file" and errr...ummm... "CalcCrcCoroutine" might be Calculate Cyclic Redundancy Check Coroutine? and "InvokeMoveNext" is likely a literal attempt at reading the next byte(s) of the file or file handle or something.

 

ANYWAY: ***All guesses*** here:  from the error, I'm guessing the mod you're loading is messed up in a weid way (like the XML tags are not properly closed/formatted) that it messed up Unity trying to load it, or you have another issue with the game files (need to validate/redownload them maybe) or its possible its a file permissions thing where the file can be "seen" but when it tried to access (open) it it fails.  Another possibility might be you had the mod file(s) open in another program and it locked Unity out from reading them (usually files can be read by other programs while they are open... but maybe it was locked or something).

Edited by doughphunghus (see edit history)
Link to comment
Share on other sites

9 hours ago, BFT2020 said:

I think you have a different issue than the code above.

 

If you installed Doughs modlets and started getting that error, there might be an issue with the files going from Alpha19 to Alpha20.

i found what the problem was, it was z30k-itemstack mod.

thanks for the help.

 

 

5 hours ago, doughphunghus said:
<triggered_effect trigger="onSelfAttackedOther" action="Ragdoll" target="other" duration=".2" force="200">
	<requirement name="ProgressionLevel" progression_name="perkTurrets" operation="LTE" value="1"/>
	<requirement name="RandomRoll" seed_type="Random" min_max="0,100" operation="LTE" value="30"/>
</triggered_effect>

I'm not sure if you'd be able to use this logic with ModSlots... like make several of these rules and say 1 slot if 10%, 2 if 11-20%, 3 is 21-40%...etc. . I almost thing you'd need cvar or something to keep track of/set the ModSlots string, but I am not well versed on their usage.  I may be talking gibberish at this point...sorry

i will look into it thanks for the heads up.

Link to comment
Share on other sites

On 12/14/2021 at 10:58 PM, doughphunghus said:

Hello :)

If you're using the mod named "Doughs-UI-Add-2ModSlots" version 19.2.1.0 has not been tested/converted to work with a20 experimental (as mentioned above) BUT

I put just that single mod into the "Mods" folder of the game and started a new map using Navezgane on the latest 20 exp build and it appears to work in a few weapons I checked (I did not spend any time really checking it though, like adding weapon mods, etc).

 

What I was looking for was:

- The mod loads without apparent errors: it does

- The mod adds 2 more slots: it does

 

Based on how it worked in a20 exp, I'm reasonably sure its not generating that "IOException: Sharing violation on path..." error.  However it appears you may be attempting to create a mod of your own from it. Note: my mod only (very clumsily) makes it so all weapons have 2 mod slots (8 total). It doesn't do this and make the UI pretty either, nor does it do it randomly as you're trying to do. I don't know how to easily make it random unless there's some way to do logic in that part and perform a random number check and then choose the slot count based on that...and just looking at weapons items.xml it appears that for to be "random" it has to already be "a random thing" the game accepts ( like a range) or it has to be a triggered effect, and ModSlots appears to be a passive effect. I could *easily* be wrong about this though as I haven't brushed up on modding in a bit and I never got into all the minute differences like this. here's an example for a "random roll" for a triggered effect for the junk sledge so show what "RandomRoll" looks like to determine if it ragdolls when it hits something (I am guessing) and it only triggers a ragdoll if its 30% of the time:

<triggered_effect trigger="onSelfAttackedOther" action="Ragdoll" target="other" duration=".2" force="200">
	<requirement name="ProgressionLevel" progression_name="perkTurrets" operation="LTE" value="1"/>
	<requirement name="RandomRoll" seed_type="Random" min_max="0,100" operation="LTE" value="30"/>
</triggered_effect>

I'm not sure if you'd be able to use this logic with ModSlots... like make several of these rules and say 1 slot if 10%, 2 if 11-20%, 3 is 21-40%...etc. . I almost thing you'd need cvar or something to keep track of/set the ModSlots string, but I am not well versed on their usage.  I may be talking gibberish at this point...sorry :(

 

"IOException: Sharing violation" from what I believe (and I'm not super knowledgeable about Unity or anything it does, so I'm guessing a bit. not googling too much) is related to opening/closing/accessing files, and something tried to access/open/close a file that was already open/accessed by something else (e.g. "sharing" was not allowed). There are a few more clues as you read "down" into the error: "System.IO.FileAccess access" probably means "accessing the file" and "System.IO.File.OpenRead" likely means "trying to read the file" and errr...ummm... "CalcCrcCoroutine" might be Calculate Cyclic Redundancy Check Coroutine? and "InvokeMoveNext" is likely a literal attempt at reading the next byte(s) of the file or file handle or something.

 

ANYWAY: ***All guesses*** here:  from the error, I'm guessing the mod you're loading is messed up in a weid way (like the XML tags are not properly closed/formatted) that it messed up Unity trying to load it, or you have another issue with the game files (need to validate/redownload them maybe) or its possible its a file permissions thing where the file can be "seen" but when it tried to access (open) it it fails.  Another possibility might be you had the mod file(s) open in another program and it locked Unity out from reading them (usually files can be read by other programs while they are open... but maybe it was locked or something).

So after reading this thread, I tried making a mod based off your mod, very simple, I just want 4 mod slots regardless of the tier.

It doesn't work. I didn't use the window.xml since unless I am reading it and the original file wrong (which is highly possible) it doesn't actually do anything as the defaults are already 6. Which also doesn't make much sense to me other than when they were first introduced you could use 6 and this is code that no longer does anything?

 

Anywho, this is what I did which doesn't work:

<Krougal>

	<set xpath="/items/item/effect_group/passive_effect[contains(@name, 'ModSlots')][@value='1,1,2,2,3,4']/@value">4,4,4,4,4,4</set>

</Krougal>

 

Did you ever get a chance to see if your mod still works?

Edited by Krougal (see edit history)
Link to comment
Share on other sites

1 hour ago, Krougal said:

Anywho, this is what I did which doesn't work

I made my mod look like you posted above, and it actually works :) there's a weirdness with the game that you might be seeing that I found.  So, just to test if it works on your system, do this:

- Load up your existing game you were testing thw mod slots with your mod with all the 4's. Make sure creative mode is enabled!

- search for "gun" and choose a few new guns from the search results.  Make them of different tiers ( hopefully tier 1 and tier 6)

- These guns should have 4 mod slots in them.

- Choose one of the guns you had in earlier saves.  Try to choose Tier 1 or 6 if you have them. Note how the mod slots are likely *not* 4!

 

What appears to be happening is that once you pick up a gun, it has the mod slots "hardcoded" into it based on the current game settings.  If you shut down the game, and mod the mod slots, then start the game back up , the new mod slot counts only takes effect on "new" guns you pick up.

 

So if you want *all* existing and new guns to have 4 mod slots *in an existing saved game* it appears you'll have to scrap all your existing weapons that were created/picked up that had more or less than 4 slots before you added your 4 slot mod.

1 hour ago, Krougal said:

Did you ever get a chance to see if your mod still works?

My mod still works (did very light testing just now).  The extra code in the windows.xml as to visually add 2 more slots so you could see mods you loaded.  Its not too important to see the slots below the "recipe" area, but its a bit more important to see them in the "available mod slots" area as you can't easily add/remove mods unless you can click on the mod.  I'm not sure but I think I had to include them as the game hard coded a limit of 6 visible slots and I had to make it add 2 more.  When you only have 4 slots ( as you want) then yep the windows.xml file isn't needed as its less than 8 slots.

 

EDIT: Also, upon looking at the code, this mod will likely sent *everything* to 4 mod slots.  Weapons, armor, probably anything with mod slots except vehicles.  It just says "which everything with this ModSlots pattern to this other one, no matter what it is". Mine does the same thing but makes them all 8. It likely applies to any item/weapon that has "item quality" which is why it doesn't affect vehicles.

Edited by doughphunghus (see edit history)
Link to comment
Share on other sites

8 hours ago, doughphunghus said:

I made my mod look like you posted above, and it actually works :) there's a weirdness with the game that you might be seeing that I found.  So, just to test if it works on your system, do this:

- Load up your existing game you were testing thw mod slots with your mod with all the 4's. Make sure creative mode is enabled!

- search for "gun" and choose a few new guns from the search results.  Make them of different tiers ( hopefully tier 1 and tier 6)

- These guns should have 4 mod slots in them.

- Choose one of the guns you had in earlier saves.  Try to choose Tier 1 or 6 if you have them. Note how the mod slots are likely *not* 4!

 

What appears to be happening is that once you pick up a gun, it has the mod slots "hardcoded" into it based on the current game settings.  If you shut down the game, and mod the mod slots, then start the game back up , the new mod slot counts only takes effect on "new" guns you pick up.

 

So if you want *all* existing and new guns to have 4 mod slots *in an existing saved game* it appears you'll have to scrap all your existing weapons that were created/picked up that had more or less than 4 slots before you added your 4 slot mod.

My mod still works (did very light testing just now).  The extra code in the windows.xml as to visually add 2 more slots so you could see mods you loaded.  Its not too important to see the slots below the "recipe" area, but its a bit more important to see them in the "available mod slots" area as you can't easily add/remove mods unless you can click on the mod.  I'm not sure but I think I had to include them as the game hard coded a limit of 6 visible slots and I had to make it add 2 more.  When you only have 4 slots ( as you want) then yep the windows.xml file isn't needed as its less than 8 slots.

 

EDIT: Also, upon looking at the code, this mod will likely sent *everything* to 4 mod slots.  Weapons, armor, probably anything with mod slots except vehicles.  It just says "which everything with this ModSlots pattern to this other one, no matter what it is". Mine does the same thing but makes them all 8. It likely applies to any item/weapon that has "item quality" which is why it doesn't affect vehicles.

Thanks for the info! Yes, I do want it to apply to all items not just guns. Newly crafted t4 still have 2 slots and cheated in items have defaults. The mod is loading fine according to the log. I'm going to try making a new save to see if that works.

 

Made a new save, made a t1 stone axe and it worked. Ok, even more bizarre, after doing that I went back to my other 2 saves and the mod works now. 

 

Edited by Krougal (see edit history)
Link to comment
Share on other sites

1 hour ago, Krougal said:

Made a new save, made a t1 stone axe and it worked. Ok, even more bizarre, after doing that I went back to my other 2 saves and the mod works now. 

That is weird. I’ve seen issues somewhat like this when messing with changing Localization.txt via modding. It seems (my belief) that some things persist unless you completely exit out of the game all the way to Steam. Like if you make a Localization.txt change, and don’t exit the game all the way to Steam, then the changes you made might not get applied.

 

additionally, the “something is weird, and I’ve modded, so make a new game” is also kinda a fix in some other instances and no one seems to know why it works, it just sometimes does. Like “turn it on and off again”.

 

there is a “modded xml cache” (of sorts) the game creates… I wonder if either it doesn’t always get cleared or certain modding actions or files don’t trigger it to clear? Just me musing here if anyone reads this.

Link to comment
Share on other sites

59 minutes ago, doughphunghus said:

there is a “modded xml cache” (of sorts) the game creates… I wonder if either it doesn’t always get cleared or certain modding actions or files don’t trigger it to clear? Just me musing here if anyone reads this.

 

You could be onto something, since I do restart the game completely in between modlet edits (I was under the impression they only got loaded on launching the game)

Link to comment
Share on other sites

Some changes you can continue a save game, others require you to start a new save, while some require restarting the game completely.  I typically start a new save when trying something new.  If that doesn't work, I verify by restarting the game before I assume I made a mistake somewhere.

Link to comment
Share on other sites

  • 2 weeks later...

hello all I'm having a problem I'm getting a sharing violation here's the code

 

IOException: Sharing violation on path C:\Users\DRAGO\AppData\Roaming\7DaysToDie\GeneratedWorlds\Suyovihu Mountains\dtm_processed.raw
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.File.OpenRead (System.String path) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at IOUtils+<CalcCrcCoroutine>d__4.MoveNext () [0x0002b] in <2ba1bc1bbbe64fe49f53fe5235fb7038>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00026] in <544fca0986d54eca88fc7c56e2a8b4b4>:0

 

I'm not sure way I'm getting it I had a mod that worked and I added this line of code

 

<set xpath="/items/item/property[@name='Weight' and (@value='0')]/@value">10</set>

and now it doesn't work. but if I tack out that line of code it still don't work. any thoughts, and thanks.

 -----Update-----

i thank i fixed it, the mod folder name was different from the mod name.

Edited by dragonslayer770 (see edit history)
Link to comment
Share on other sites

5 hours ago, dragonslayer770 said:

hi all, I'm trying to make a modlet that makes  everything scrapable but I'm not sure of the code this is what I'm trying to use

<set xpath="/items/item/property[@name='Weight' and (@value='0')]/@value">1,2,3,4,5,6,7,8,9,10</set>

any thoughts? thanks.

I think what you want is materials in the items file actually (not an expert).  This looks to tell the game what the item scraps back to.

 

This is from the stone axe

    <property name="Material" value="Mstone"/>

 

iron axe

    <property name="Material" value="Mmetal"/>

 

pump shotgun

 

    <property name="Material" value="MShotgunParts"/>

 

Not sure on what the purpose of weight is as it is not on every object in the items file (maybe it limits the resources back?).  Also not sure you can change 0 to 1,2,3,4,5,6,7,8,9,10.  It probably is limited to a single value (say from 0 to 6).

Link to comment
Share on other sites

as I'm looking throw the items xml, I found that an item with Mparts have a weight to tell how much parts to give like the gunRifleT1HuntingRifle, I thank when we scrap it, we get 3 MRifleParts since the value starts at 0. so, it go's 0,1,2,3, exc.

where a weight value of 4 would give you 3 MRifleParts.

<property name="Material" value="MRifleParts"/> <property name="Weight" value="4"/>

but what I can't found is the Mresource  weight value to tell how mush resource to give like the 

gunRifleT0PipeRifle it has a Mmetal but no weight value, and you can scrap it, you get 30 scrap iron from it.

so what part of the code says its scrapable and how much MResources to giv?

Link to comment
Share on other sites

  • 1 year later...
On 12/14/2021 at 6:55 AM, BFT2020 said:

 

First, what is not working exactly?  Do you have this code between <config> </config>?  Are you getting any errors in the console regarding mods when you load up a game?  Does your modlet have a ModInfo.xml file?

 

I copied and paste your code into my modlet and I saw the following:

 

  • No errors on loading
  • I picked three weapons out of creative menu:  one at Q1, one at Q5, and one at Q6 (hunting rifle, lever action rifle, pipe machine gun).
  • All 3 weapons had 6 mod slots.

 

The code is definitely changing the mod slots available, but it doesn't display more than 6.  This could either be a hard limit in the game or an UI (user interface) issue.  You might not be seeing more than 6 because there is not enough screen space.  If that is the case (and not because of a hard limit on mod slots which I doubt there is), you will also need to adjust the sizes of those slots to get more on the screen (kind of like the bigger backpack mods).

hello, im currently tying to add more mod slots to UndeadL mod, but i believe I'm having a UI limit issue. think you could point me in the right direction?

Max mod slots is 5, any more added after that, can't be seen when slotted into item.

Link to comment
Share on other sites

On 5/5/2023 at 7:18 PM, OutLaw 24Osx said:

hello, im currently tying to add more mod slots to UndeadL mod, but i believe I'm having a UI limit issue. think you could point me in the right direction?

Max mod slots is 5, any more added after that, can't be seen when slotted into item.

Darkness Falls added more than 5 mod slots so Khaine's mod has examples of modifying the UI to account for more than 5.

Link to comment
Share on other sites

  • 8 months later...

So I'm trying to fix my modslots mod, not sure what I need to change to get it to work, but this is what I have,

 

Items

<set xpath="/items/item/effect_group/passive_effect[contains(@name, 'ModSlots')][@value='1,1,2,2,3,4']/@value">2,3,4,5,6,7</set>

 

windows

<set xpath="/windows/window[@name='windowAssemble']/panel[@name='content']/rect/rect/grid[@name='parts']/@rows">6</set>

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...