Unturned

Unturned

Creative Survivors Needed
Download and play community created maps, items, vehicles, models, translations and more!
Learn More
HOLY_YH4 5 27 Oct, 2022 @ 7:01am
How to edit vanilla spawn tables in unturned?
Im trying to create a mod that increases the max capacity of ammo boxes. Ive gotten the item itself created with some Bundle override lines and im able to spawn it in, but i dont know how to go about getting them to spawn on their own in place of the vanilla ammo boxes. The spawn table files are really confusing.

Using this website, https://unturned.gameinfo.io/items/44-low-caliber-civilian-ammunition-box, i was able to find what spawn table folder each ammo box is located in and i replaced the id of the vanilla ammo box with the new ammo box of my own. I also changed the guid and added bundle override lines, and when i try to look in game only the vanilla ammo boxes spawn. I feel like i have to edit the ID's of every spawn table dat file for this to work, but im not 100% sure because of how weird the files are named. Could i get some help with this?
< >
Showing 1-13 of 13 comments
Ongjming 24 2 Nov, 2022 @ 9:37am 
Refer to : https://github.com/SmartlyDressedGames/U3-Docs/blob/3a95a6ce39ab23ab8e2cbce0a208191df04941d1/SpawnAsset.md

You don't have to add the bundle override lines for the spawn .dats. (Just need them for the items)
You need to have the spawntable present in the mod together with your items.

The thing you are probably gonna look at is Root_#_override. It clears the existing spawn table that your spawntable is rooted to and makes the game check out whatever it is inside your spawn table instead.

So for example, police ammo spawn's .dat file is:
Type Spawn
ID 100
Tables 1
Table_0_Asset_ID 44
Table_0_Weight 10


Don't touch that file, but create a file of your own, you can name it anything but the folder it is in should have the same name.

That file should contain almost the same thing above (its own GUID or you want the game to auto generate, Type Spawn, ID any number but not conflicting with vanilla IDs but not higher than 60000+ I think)

Roots 8 (Around 8 vanilla spawntables spawns civ ammo)
Root_0_Spawn_ID 100 (ID of police ammo spawntable)
Root_0_Override (This line tells game to check this file instead of the vanilla spawntable values, without this line, whatever weight you placed below will compete with existing weights in the vanilla spawntable. In the Police ammo case, the vanilla ammo has weight of 10)
Root_0_Weight 100 (Only important if your other mods also tag onto the vanilla spawn table to spawn something, otherwise any value will do, since it is the only spawntable tagged to that vanilla spawntable)

So on and so forth for Root_1 till Root_7...

Tables 1
Table_0_Asset_ID (Whatever ID you gave your mod item)(Using this instead of Spawn_ID since you want this one item to spawn instead of having it look into yet another spawntable)
Table_0_Weight (Whatever value will do, since it is the only item)


You can add more table lines though, if you want more variety of items to potentially spawn.
Last edited by Ongjming; 2 Nov, 2022 @ 9:50am
HOLY_YH4 5 6 Nov, 2022 @ 5:48pm 
Originally posted by Ongjming:
Refer to : https://github.com/SmartlyDressedGames/U3-Docs/blob/3a95a6ce39ab23ab8e2cbce0a208191df04941d1/SpawnAsset.md

You don't have to add the bundle override lines for the spawn .dats. (Just need them for the items)
You need to have the spawntable present in the mod together with your items.

The thing you are probably gonna look at is Root_#_override. It clears the existing spawn table that your spawntable is rooted to and makes the game check out whatever it is inside your spawn table instead.

So for example, police ammo spawn's .dat file is:
Type Spawn
ID 100
Tables 1
Table_0_Asset_ID 44
Table_0_Weight 10


Don't touch that file, but create a file of your own, you can name it anything but the folder it is in should have the same name.

That file should contain almost the same thing above (its own GUID or you want the game to auto generate, Type Spawn, ID any number but not conflicting with vanilla IDs but not higher than 60000+ I think)

Roots 8 (Around 8 vanilla spawntables spawns civ ammo)
Root_0_Spawn_ID 100 (ID of police ammo spawntable)
Root_0_Override (This line tells game to check this file instead of the vanilla spawntable values, without this line, whatever weight you placed below will compete with existing weights in the vanilla spawntable. In the Police ammo case, the vanilla ammo has weight of 10)
Root_0_Weight 100 (Only important if your other mods also tag onto the vanilla spawn table to spawn something, otherwise any value will do, since it is the only spawntable tagged to that vanilla spawntable)

So on and so forth for Root_1 till Root_7...

Tables 1
Table_0_Asset_ID (Whatever ID you gave your mod item)(Using this instead of Spawn_ID since you want this one item to spawn instead of having it look into yet another spawntable)
Table_0_Weight (Whatever value will do, since it is the only item)


You can add more table lines though, if you want more variety of items to potentially spawn.

Thanks bro, i was able to get some 1 to 1 help via discord but this re-affirms what i was told. Ive modified multiple .dat files for spawns and ill show an example just to be sure. This one is for Camp_Ammo.dat

GUID 79d076988fcd422cb5606e861fde1fa0
Type Spawn
ID 17300 <Modified ID

Roots 1 <what's a root for?
Root_0_Spawn_ID 187 <Original ID
Root_0_Weight 500 <what does this mean?

Tables 2
Table_0_Asset_ID 381 <20 Gauge Shells (vanilla)
Table_0_Weight 10 <what does this mean?
Table_1_Asset_ID 17301 <Modified Ranger ammo
Table_1_Weight 10

Both items spawn normally but will the weight i set each item to and the weight i set the root to effect if the vanilla item spawns over the modded one?
HOLY_YH4 5 6 Nov, 2022 @ 5:58pm 
also i have another question, how can i stop the shotgun shells from automatically deleting themselves? im trying to make them stay so i can refill them with civilian ammo. this is what i got here on Shells_8

GUID e4262228a345427ab4ee008875be6b0d
Type Magazine
Rarity Rare
ID 17387

Size_X 1
Size_Y 1
Size_Z 0.25

Amount 8
Count_Min 2
Count_Max 8

Calibers 1
Caliber_0 8

Pellets 6

Tracer 48

Blueprints 2
Blueprint_0_Type Ammo
Blueprint_0_Supplies 1
Blueprint_0_Supply_0_ID 17387
Blueprint_0_Build 30
Blueprint_1_Type Ammo
Blueprint_1_Supplies 1
Blueprint_1_Supply_0_ID 17300
Blueprint_1_Build 30

Master_Bundle_Override core.masterbundle
Bundle_Override_Path /Items/Magazines/Shells_8
Ongjming 24 9 Nov, 2022 @ 10:04am 
Hey sorry for the late reply.

GUID 79d076988fcd422cb5606e861fde1fa0
Type Spawn
ID 17300 <All nicely done :)

Roots 1 <what's a root for? >The root is for attaching this spawn table to whatever is specified below
Root_0_Spawn_ID 187 <Original ID >So in this case this spawntable will attach to the ID187 Camp_Ammo spawntable.
Root_0_Weight 500 <what does this mean? >This meant that, without "Root_0_Override" line, this spawntable itself would have a weight of 500. So if something were to spawn from Camp_Ammo, it would take a look at this spawntable (500) and 20 gauge shells (10) in that weightage as it does a kinda dice roll.

Tables 2
Table_0_Asset_ID 381 <20 Gauge Shells (vanilla)
Table_0_Weight 10 <what does this mean? >This is similar to the above but within the spawntable itself. So if the dice roll for Camp_Ammo lands on this spawntable 17300 (500) instead of the 20 Gauge shells (10), it would then do another dice roll for the contents of this spawntable 17300, which are the stuff listed here under Tables.
Table_1_Asset_ID 17301 <Modified Ranger ammo
Table_1_Weight 10

In that case, when placed in the game, Camp_Ammo now would have a 1.96% chance of spawning 20 gauge shells outright, 98% chance of going onto roll the modded table.
Upon reaching the modded table, the 20 Gauge shells would have 50% chance of spawning, while the modded ranger ammo also have 50% chance of spawning.

The effective percentage would be 50.98% for 20 gauge shells and 49.01% for the modded ranger ammo.
Ongjming 24 9 Nov, 2022 @ 10:15am 
Originally posted by Kreslavskiy:
also i have another question, how can i stop the shotgun shells from automatically deleting themselves? im trying to make them stay so i can refill them with civilian ammo. this is what i got here on Shells_8


Blueprints 2
Blueprint_0_Type Ammo
Blueprint_0_Supplies 1
Blueprint_0_Supply_0_ID 17387
Blueprint_0_Build 30
Blueprint_1_Type Ammo
Blueprint_1_Supplies 1
Blueprint_1_Supply_0_ID 17300
Blueprint_1_Build 30

Hey, everything is nicely done. Just this portion.
For the supply ID part it is correct. (I am assuming you wanted it to be refillable by itself.)
Under Blueprint_1_Supply_0_ID you need to change it to 44 (Which is the ID for vanilla civ ammo)

By right without the "Delete_Empty" line, the magazine shouldn't disappear even when emptied. Not sure if it is because it is the hardcoded default for shotgun weapons or something, very likely I remembered wrongly. Shotgun weapons here meant "Action_Pump" weapons. Devil's Bane is a "Action_Trigger" shotgun, which isn't affected.

Am Assuming that 17300 isn't another modded item's ID and that you mixed up this with the spawntable's ID.

Usual vanilla Shells will still disappear. By right only this magazine should stay without disappearing.

You can change the blueprint portion to the below:
Blueprints 3
Blueprint_0_Type Ammo
Blueprint_0_Supplies 1
Blueprint_0_Supply_0_ID 17387 (Itself)
Blueprint_0_Build 30
Blueprint_1_Type Ammo
Blueprint_1_Supplies 1
Blueprint_1_Supply_0_ID 44 (Civ Ammo)
Blueprint_1_Build 30
Blueprint_2_Type Ammo
Blueprint_2_Supplies 1
Blueprint_2_Supply_0_ID 113 (The Shell_8)
Blueprint_2_Build 30
Ongjming 24 9 Nov, 2022 @ 10:19am 
Yeap, on a cursory search I found: https://github.com/SmartlyDressedGames/Unturned-3.x-Community/issues/1647

Seemed like it was probably never resolved if your modded mag still disappear in guns like Bluntforce (or other "Action_Pump" "Action_Break" guns)
HOLY_YH4 5 13 Nov, 2022 @ 5:45pm 
Originally posted by Ongjming:
Yeap, on a cursory search I found: https://github.com/SmartlyDressedGames/Unturned-3.x-Community/issues/1647

Seemed like it was probably never resolved if your modded mag still disappear in guns like Bluntforce (or other "Action_Pump" "Action_Break" guns)
hey sorry for the late response, i was able to get it fixed. i did try using Delete_Empty and it do anythingm i forgot to mention that.
Ongjming 24 14 Nov, 2022 @ 10:13am 
Originally posted by Kreslavskiy:
i was able to get it fixed. i did try using Delete_Empty and it do anythingm i forgot to mention that.

I am curious, how did you managed to fix it?
HOLY_YH4 5 16 Nov, 2022 @ 7:57am 
Originally posted by Ongjming:
Originally posted by Kreslavskiy:
i was able to get it fixed. i did try using Delete_Empty and it do anythingm i forgot to mention that.

I am curious, how did you managed to fix it?
For the bluntforce and every other shotgun that directly reloads with shells, i added Should_Delete_Empty_Magazines False and on Shells_8 and Shells_2 i set the minimum to 0, and i also deleted the Delete_Empty line
Last edited by HOLY_YH4; 16 Nov, 2022 @ 8:10am
HOLY_YH4 5 16 Nov, 2022 @ 8:12am 
Originally posted by Ongjming:
Hey sorry for the late reply.

Roots 1 <what's a root for? >The root is for attaching this spawn table to whatever is specified below
Root_0_Spawn_ID 187 <Original ID >So in this case this spawntable will attach to the ID187 Camp_Ammo spawntable.
Root_0_Weight 500 <what does this mean? >This meant that, without "Root_0_Override" line, this spawntable itself would have a weight of 500. So if something were to spawn from Camp_Ammo, it would take a look at this spawntable (500) and 20 gauge shells (10) in that weightage as it does a kinda dice roll.

Tables 2
Table_0_Asset_ID 381 <20 Gauge Shells (vanilla)
Table_0_Weight 10 <what does this mean? >This is similar to the above but within the spawntable itself. So if the dice roll for Camp_Ammo lands on this spawntable 17300 (500) instead of the 20 Gauge shells (10), it would then do another dice roll for the contents of this spawntable 17300, which are the stuff listed here under Tables.
Table_1_Asset_ID 17301 <Modified Ranger ammo
Table_1_Weight 10

So if I replace Root_0_Weight 500 with Root_0_Override, the game will always 100% choose my modified spawntable over the vanilla one?

And for the Table_0_Weight and Table_1_Weight, how could i get it to where the shells have a higher chance of spawning instead of the ranger ammo? Would i type Table_0_Weight 20 and leave Table_1_Weight at 10?
Last edited by HOLY_YH4; 16 Nov, 2022 @ 8:16am
Ongjming 24 16 Nov, 2022 @ 9:45am 
Originally posted by Kreslavskiy:
> So if I replace Root_0_Weight 500 with Root_0_Override, the game will always 100% choose my modified spawntable over the vanilla one?

If you add the Root_X_Override line, then yeap, whatever is in this spawntable will override the Root_X_ specified spawntable.
You will still need to have the Root_X_Weight line though.

Originally posted by Kreslavskiy:
And for the Table_0_Weight and Table_1_Weight, how could i get it to where the shells have a higher chance of spawning instead of the ranger ammo? Would i type Table_0_Weight 20 and leave Table_1_Weight at 10?

In your example yeap, to make the shell have a higher spawn rate compared to the modded ranger ammo, what you mentioned is in the right direction. Depending on if you want to make it extremely rare, you could skew the value even higher for Table_0_Weight (The 20 Gauge Shell).

Hope it helps :)
And thanks for answering my question about the shotguns :D It really helps!
HOLY_YH4 5 16 Nov, 2022 @ 11:19am 
Originally posted by Ongjming:
Originally posted by Kreslavskiy:
> So if I replace Root_0_Weight 500 with Root_0_Override, the game will always 100% choose my modified spawntable over the vanilla one?

If you add the Root_X_Override line, then yeap, whatever is in this spawntable will override the Root_X_ specified spawntable.
You will still need to have the Root_X_Weight line though.

Originally posted by Kreslavskiy:
And for the Table_0_Weight and Table_1_Weight, how could i get it to where the shells have a higher chance of spawning instead of the ranger ammo? Would i type Table_0_Weight 20 and leave Table_1_Weight at 10?

In your example yeap, to make the shell have a higher spawn rate compared to the modded ranger ammo, what you mentioned is in the right direction. Depending on if you want to make it extremely rare, you could skew the value even higher for Table_0_Weight (The 20 Gauge Shell).

Hope it helps :)
And thanks for answering my question about the shotguns :D It really helps!

No problemo. when i add the Root_#_Override line, where do i put it? Is it like this?
Roots 1
Root_0_Spawn_ID 771
Root_0_Override
Root_0_Weight 500
Ongjming 24 17 Nov, 2022 @ 9:35am 
Yeap, but make sure to check your Root_0_Spawn_ID is the correct one that you wanted your spawn table to be attached to.
Once you have the Root_0_Override line, your Root_0_weight can be anything so long it is above 0. (Unless you have more mods that also root to this spawn table, in that case the game would roll between them base on their weight value.)
< >
Showing 1-13 of 13 comments
Per page: 1530 50