parityb1t Posted January 5, 2018 Share Posted January 5, 2018 (edited) In 'carrot' and 'berrybush' prefab files, the pickable component has 'carrot' and 'berries' prefab set, respectively, to be spawned when `Pick()` is called. This drops is directly into the inventory. product set: inst:AddComponent("pickable") inst.components.pickable.picksound = "dontstarve/wilson/pickup_plants" inst.components.pickable:SetUp("carrot", 10) extract from `Pick()` local loot = nil if picker and picker.components.inventory and self.product then loot = SpawnPrefab(self.product) ... picker.components.inventory:GiveItem(loot, nil, Vector3(TheSim:GetScreenPos(self.inst.Transform:GetWorldPosition()))) so we can use ACTIONS.PICK on 'carrot' and 'berrybush', but how could I make a character pick up 'carrot' or 'berries' if they are not in the inventory, i.e. on the ground and have already been harvested? How would I use ACTIONS.PICKUP? I cannot even seem to find the prefab files for the 'carrot' and 'berries' (only their planted version) and the code seems to suggest they do not have the component `inventoryitem` hence cannot be picked up. Edited January 5, 2018 by parityb1t Link to comment https://forums.kleientertainment.com/forums/topic/86151-cannot-use-actionspickup-on-carrot-and-berries/ Share on other sites More sharing options...
parityb1t Posted January 6, 2018 Author Share Posted January 6, 2018 Answering my own question. Still don't know where the prefab files for the produce are, but they are inventoryitem. Debugging showed me that my character was missing the ActionHandler for ACITONS.PICKUP in the stategraph, hence it was failing. Adding it solved it. Link to comment https://forums.kleientertainment.com/forums/topic/86151-cannot-use-actionspickup-on-carrot-and-berries/#findComment-990228 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