Wonderlarr Posted July 30, 2020 Share Posted July 30, 2020 While developing my character I realized I need to make other characters not be able to pick up my character's custom items. I found Ultroman's tutorial on the tutorial collection page, where they say to paste the code at the bottom of the item's fn() function. Doing this seems to partially work, triggering the characters talker quote for not being able to pick up, but even on the correct character, and it seems that no matter what, all characters are able to pick up the restricted item. How can I solve this? (Of course I pasted my character's prefab where it says to in my code, this is just the snippet from the tutorial.) local oldOnPickup = inst.components.inventoryitem.OnPickup inst.components.inventoryitem.OnPickup = function(self, pickupguy) if pickupguy.prefab == "YOUR_CHARACTER_PREFAB_NAME" then if not self.inst.itemowner then self.inst.itemowner = pickupguy end if pickupguy == self.inst.itemowner then oldOnPickup(self, pickupguy) elseif pickupguy.components.talker then pickupguy.components.talker:Say("That item is not mine.") end elseif pickupguy.components.talker then pickupguy.components.talker:Say("I cannot wield that.") end end Link to comment 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