Thial Posted November 5, 2016 Share Posted November 5, 2016 Hello. Is there some way to get a number of items in the stack ? The stack I want to check is lying on the ground. I want to remove one item from the stack but for that I need to know if the amount of items in that stack is greater than 1 so the script will know if it should remove just one item or remove the target which I'm pointing at with my mouse completely. Until now I was using target:Remove() but I was playing with single items only, now that I want to remove just one item I need a way of determining how many items there are in the stack and possibly a way to remove just one. Thank you in advance. Link to comment https://forums.kleientertainment.com/forums/topic/71447-lua-question-amount-of-items-in-stack/ Share on other sites More sharing options...
Lumina Posted November 5, 2016 Share Posted November 5, 2016 (edited) I know that when i have a stack of things in my inventory and want to use one and remove just one (for plantables files for ex), i use : inst.components.stackable:Get():Remove() I don't know how it work exactly (yeah, code is a little like chinese for me), but it doesn't remove all the stack, just one of the stack. It maybe not applies to your case but could help you to know where to search maybe. Edited November 5, 2016 by Lumina Link to comment https://forums.kleientertainment.com/forums/topic/71447-lua-question-amount-of-items-in-stack/#findComment-833889 Share on other sites More sharing options...
Thial Posted November 5, 2016 Author Share Posted November 5, 2016 That worked like charm . Actually it also removes the item when there's only one left which is exactly what I wanted :D. Thank you very much for help Link to comment https://forums.kleientertainment.com/forums/topic/71447-lua-question-amount-of-items-in-stack/#findComment-833896 Share on other sites More sharing options...
Lumina Posted November 5, 2016 Share Posted November 5, 2016 Glad it works fine Link to comment https://forums.kleientertainment.com/forums/topic/71447-lua-question-amount-of-items-in-stack/#findComment-833899 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