Nappy Posted June 24, 2020 Share Posted June 24, 2020 So I am trying to make interacting with an object yield 2 items instead of one. I started with adding a new pick function to double the input on Pickable:SetUp and then wrote new code for calling Pickable:Pick(picker) in varying ways to support looting 1 item and 2 items. On one of the iterations it worked, but now I cant duplicate it. So I moved on to try to force the game to add an item to the players inventory when told to pick in the items code itself. I thought using local loot1 = SpawnPrefab("X") GetPlayer().components.inventory:GiveItem(loot1, nil, Vector3(TheSim:GetScreenPos(self.inst.Transform:GetWorldPosition()))) would work, but it is failing as well. Any help would be appreciated. Maybe I am just doing it an overly complicated way? Link to comment https://forums.kleientertainment.com/forums/topic/119458-lfhelp-calling-componentsinventorygiveitem/ Share on other sites More sharing options...
Nappy Posted June 24, 2020 Author Share Posted June 24, 2020 (edited) Just an FYI, I was able to solve the problem by editing the components.pickable.lua more and having it pick 2 different items. So I can now pick cave bananas/berries and occasionally get a banana/berry and additional seed for planting in the same action! So excited... However, I am still interested to know how to use the GiveItem function if anyone would still care to explain. THANKS! Edited June 24, 2020 by Nappy Link to comment https://forums.kleientertainment.com/forums/topic/119458-lfhelp-calling-componentsinventorygiveitem/#findComment-1347530 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