sauvva Posted October 29, 2025 Share Posted October 29, 2025 (edited) i made a hole in the ground that finds nearby petals and move them towards it, then it was suposed to store the item in the inventory just like the mole does, so i can dig it later, but i cant find a way to pick a prefab and move it to the inventory aditionally i would also like for it to pick flowers as if a player had picked and then droped it in the ground, so they can be targeted by this effect the idea is to make it look like invisible ants are harvesting the flowers i used this code: local food = GetClosestInstWithTag("cattoy", inst, 30) if food then if food:GetDistanceSqToPoint(inst:GetPosition())< 1 then inst.components.inventory:GiveItem(food) else move_food(food) end end and i got this error: master_server_log.txt Edited October 29, 2025 by sauvva Link to comment https://forums.kleientertainment.com/forums/topic/168559-how-to-move-an-item-from-the-ground-to-an-inventory/ Share on other sites More sharing options...
FerniFrenito Posted November 1, 2025 Share Posted November 1, 2025 [00:01:14]: [string "scripts/components/inventoryitem_replica.lu..."]:217: attempt to index field 'classified' (a nil value) LUA ERROR stack traceback: scripts/components/inventoryitem_replica.lua:217 in (method) SetPickupPos (Lua) <211-219> scripts/components/stackable.lua:7 in (field) ? (Lua) <3-9> scripts/class.lua:43 in () ? (Lua) <36-45> scripts/components/stackable.lua:181 in (method) Put (Lua) <142-186> scripts/components/inventory.lua:1001 in (method) GiveItem (Lua) <908-1074> ../mods/sauvva/scripts/prefabs/anthill.lua:34 in (field) fn (Lua) <30-40> scripts/scheduler.lua:186 in (method) OnTick (Lua) <164-216> scripts/scheduler.lua:409 in (global) RunScheduler (Lua) <407-415> scripts/update.lua:240 in () ? (Lua) <224-298> I think you are running this code on client side, in that side "classified" doesn't exists, so you need to modify your code to run it on the server side, whether using an RPC or a validation check. That depends on how you handle the code you posted here. 1 Link to comment https://forums.kleientertainment.com/forums/topic/168559-how-to-move-an-item-from-the-ground-to-an-inventory/#findComment-1841664 Share on other sites More sharing options...
sauvva Posted November 7, 2025 Author Share Posted November 7, 2025 (edited) anthill.lua it is working now that i included a check, but how was running in the client when i only called doaction after checking if it was mastersim? Edited November 7, 2025 by sauvva Link to comment https://forums.kleientertainment.com/forums/topic/168559-how-to-move-an-item-from-the-ground-to-an-inventory/#findComment-1842273 Share on other sites More sharing options...
sauvva Posted November 7, 2025 Author Share Posted November 7, 2025 well, false alarm, the erros still happens, even checking before calling the function and before calling the function that calls the function anthill.lua Link to comment https://forums.kleientertainment.com/forums/topic/168559-how-to-move-an-item-from-the-ground-to-an-inventory/#findComment-1842281 Share on other sites More sharing options...
FerniFrenito Posted November 8, 2025 Share Posted November 8, 2025 Send me the full mod so I can see what's going on. Link to comment https://forums.kleientertainment.com/forums/topic/168559-how-to-move-an-item-from-the-ground-to-an-inventory/#findComment-1842307 Share on other sites More sharing options...
sauvva Posted November 9, 2025 Author Share Posted November 9, 2025 sauvva_mod.zip the entire mod, with the offending part comented Link to comment https://forums.kleientertainment.com/forums/topic/168559-how-to-move-an-item-from-the-ground-to-an-inventory/#findComment-1842404 Share on other sites More sharing options...
FerniFrenito Posted November 18, 2025 Share Posted November 18, 2025 On 11/8/2025 at 10:52 PM, sauvva said: sauvva_mod.zip the entire mod, with the offending part comented I apologize for the long wait. I have found a solution for your case: -- Anthill.lua local function store_pickable(inst,pickable) local pos = inst:GetPosition() if (not pickable:IsInLimbo()) and pickable.Physics~=nil then pickable.Physics:Teleport(pos:Get()) inst.components.inventory:GiveItem(pickable) end end The issue pops up because that function calls twice. The second time, however, the object is in a state the game calls "limbo." In this state, the object doesn't have certain components because it is a state designed for the inventory system. 1 Link to comment https://forums.kleientertainment.com/forums/topic/168559-how-to-move-an-item-from-the-ground-to-an-inventory/#findComment-1843215 Share on other sites More sharing options...
sauvva Posted November 18, 2025 Author Share Posted November 18, 2025 thank you for the help so, that is the limbo ? i saw the term when using target_tags for aoe damage and thought it was related to the insanity monsters Link to comment https://forums.kleientertainment.com/forums/topic/168559-how-to-move-an-item-from-the-ground-to-an-inventory/#findComment-1843225 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now