Jump to content
tormentedmage

(Solved)How can I remove items from the game?

Recommended Posts

Posted (edited)

I need a mod to remove items from the original distribution table.

Some people have asked the same question before but unfortunately no answers were given.

 

https://steamcommunity.com/app/108600/discussions/0/1639801448929046416/

https://steamcommunity.com/app/108600/discussions/0/1368380934239576475/

 

 

As far as I know,there are no answers on the web now.

Does anyone know how to remove items from the game?

Edited by tormentedmage

Share this post


Link to post
Share on other sites
Posted (edited)

You need to add custom function. It may be simple or may be complicated like this one:

require "Items/ItemPicker"
require "Items/SuburbsDistributions"
require "Items/ProceduralDistributions"
require "Vehicles/VehicleDistributions"

--Duplicate loot chances (or remove loot)
local function CopyLoot(old_name, new_name, mult)
	local cache = {}
	local function patch(t)
		for i=#t,1,-1 do
			if t[i] == old_name then
				local num = (t[i+1] or 0.01) * mult;
				if old_name == new_name then
					t[i+1] = num; --overwrite
				elseif new_name == 0 then
					table.remove(t,i)
					table.remove(t,i)
				else
					table.insert(t, new_name)
					table.insert(t, num)
				end
			end
		end
	end
	mult = mult or 1;
	for room,r in pairs(SuburbsDistributions) do
		for container,c in pairs(r) do
			if c.items and not cache[c.items] then
				cache[c.items] = true
				patch(c.items)
			end
		end
	end
	for proc,p in pairs(ProceduralDistributions.list) do
		if p.items and not cache[p.items] then
			cache[p.items] = true
			patch(p.items)
		end
		if p.junk and not cache[p.junk] then
			cache[p.junk] = true
			patch(p.junk)
		end
	end
	for vehicle,p in pairs(VehicleDistributions) do
		if p.items and not cache[p.items] then
			cache[p.items] = true
			patch(p.items)
		end
		if p.junk and not cache[p.junk] then
			cache[p.junk] = true
			patch(p.junk)
		end
	end
end

CopyLoot('Thread', 'Thread', 4) -- thread loot x4
CopyLoot('Umbrella', 'Umbrella', 2) -- umbrella loot x2

CopyLoot('Needle', 'MyMod.MySuperNeedle', 0.3) --rare super needle
CopyLoot('Needle', 0) --Then remove needle from all loot tables

 

Edited by Maris

Share this post


Link to post
Share on other sites

Thank you for the answer and sorry about the late reply.

I thought nobody answered the question .

I'm sure your answer will be very helpful for many people in the future.

Thank you!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...