Jump to content

Remove all items on the ground with Console


Recommended Posts

Hi , i hope created the topic right place.

i want to delete items on whole world and on the ground. like cut grass silk seed and another items like them. 

not mandrakes flowers and placed things like structure. So can i do that with console command ? 

Sorry for bad english. iam trying to learn

Link to comment
Share on other sites

for k, v in pairs(Ents) do if v.components.inventoryitem and v.components.inventoryitem.owner == nil and not v:HasTag("irreplaceable") then v:Remove() end end

Removes any object that can be picked up that isn't in a container or a player's inventory, except irreplaceables. I'd advise caution, but what's the fun in that?

A less nuclear option: define a function c_cleanup:

c_cleanup = function(prefab) for k, v in pairs(Ents) do if v.prefab == prefab and v.components.inventoryitem and v.components.inventoryitem.owner == nil then v:Remove() end end end

Then choose what prefab to remove, e.g.: c_cleanup"flint" .

Link to comment
Share on other sites

Klei should come up with something that could clean-up unwanted items that gets randomly dropped all over the map, these unwanted items is causing lag, glitches, crashes and all sorts of errors in the game or at least in my experience in the game.

I know this might be unpopular but I really HATE twig trees, it drops so much twigs everywhere in my map causing my game to get weird glitches and sometimes it even crashes. I'd much rather have saplings than twig trees upper map and underground map but unfortunately saplings is only available in the caves in my map, my ground map is twig trees :(

I tried to get rid of the twig trees by chopping them off but it keeps regrowing  more and more causing more issues in-game. What I mean by issues is the item stacking glitch that Klei said they have fixed but it's not really fixed... my game still crashes from time to time and I have glitchy errors all over the map, I think the cause is the twig tree drops and rots all over the time -- i always find the a bunch of twigs on the ground shaking all over the map, it's annoying me and I think this is the stacking glitchy error. 

Link to comment
Share on other sites

15 hours ago, Residays said:

There's actually a Steam Workshop Mod that does the same thing you just described. And it even is Server-side so only you will need it, nobody else. Shall I add all prefabs are up to you (Refer to The modoverrides.lua discussion ) .

However, I'm gonna look trough the mod's code and reply here what you should do if you only want a console way.

i look this mod. but i saw comments they are say this mod despawn flowers and animals. and i dont want to loss my animals. i look the commands but its too complicated for me. but thanks for reply.

15 hours ago, alainmcd said:

for k, v in pairs(Ents) do if v.components.inventoryitem and v.components.inventoryitem.owner == nil and not v:HasTag("irreplaceable") then v:Remove() end end

Removes any object that can be picked up that isn't in a container or a player's inventory, except irreplaceables. I'd advise caution, but what's the fun in that?

A less nuclear option: define a function c_cleanup:


c_cleanup = function(prefab) for k, v in pairs(Ents) do if v.prefab == prefab and v.components.inventoryitem and v.components.inventoryitem.owner == nil then v:Remove() end end end

Then choose what prefab to remove, e.g.: c_cleanup"flint" .

if i write to console c_cleanup''flint' it will remove all flint in ground on map ? so is there any code for remove every items on ground ? Also i want to remove twig trees

Link to comment
Share on other sites

The first line removes ALL items left on the ground, including equippables (weapons, armour, clothing, ...) excluding only "irreplaceables" (Chester's Eyebone, Suspicious Marbles, ...).

To remove only a certain prefab, copy the second line into the console, then run c_cleanup"SOMEPREFAB", so yes, c_cleanup"flint" will remove all pieces of flint lying around.

To remove all Twiggy Trees, run:

for k, v in pairs(Ents) do if v.build == "twiggy" then v:Remove() end end

 

Link to comment
Share on other sites

Could be good if they added an animal that eat the twigs on ground / the rotten food cuz i'm tired of getting hurt each time i try to feed my Eyeplant the trash items i have , and the worst is that it doesn't work in winter :'(

Link to comment
Share on other sites

Thanks to everyone. 

5 hours ago, alainmcd said:

The first line removes ALL items left on the ground, including equippables (weapons, armour, clothing, ...) excluding only "irreplaceables" (Chester's Eyebone, Suspicious Marbles, ...).

To remove only a certain prefab, copy the second line into the console, then run c_cleanup"SOMEPREFAB", so yes, c_cleanup"flint" will remove all pieces of flint lying around.

To remove all Twiggy Trees, run:


for k, v in pairs(Ents) do if v.build == "twiggy" then v:Remove() end end

 

i think i rght understand. ill try and ill feedback thanks again

Link to comment
Share on other sites

i have copy it

for k, v in pairs(Ents) do if v.build == "twiggy" then v:Remove() end end

 

but isnt remove twiggies. please write just the command. because i dont know some words what mean. 

and about it. 

for k, v in pairs(Ents) do if v.components.inventoryitem and v.components.inventoryitem.owner == nil and not v:HasTag("irreplaceable") then v:Remove() end end

it remove items around or all map ? because i need remove att all map. sorry for my english and thanks for replies

Link to comment
Share on other sites

for k, v in pairs(Ents) do if v.build == "twiggy" then v:Remove() end end

Copy it into the console and press enter, that should do it. I just re-checked that it works. You have to be admin. If hosting a world with caves or playing on a dedicated server, make sure you see "Remote" next to the command line and be careful when copying, since Ctrl toggles the "Remote" status, you have to press Ctrl another time after pasting in the code.

There is no command to remove all Twiggy Trees, so you need a little bit of code.

--

for k, v in pairs(Ents) do if v.components.inventoryitem and v.components.inventoryitem.owner == nil and not v:HasTag("irreplaceable") then v:Remove() end end

It deletes all inventory and equippable items lying on the floor, all around the map.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...