Jump to content

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


tormentedmage

Recommended Posts

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
Link to comment
Share on other sites

  • 2 weeks later...

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
Link to comment
Share on other sites

  • 1 month later...

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...