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 Share on other sites More sharing options...
Nappy Posted June 24, 2020 Author Share Posted June 24, 2020 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! Link to comment Share on other sites More sharing options...
Recommended Posts
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.