Near4422 4 Report post Posted February 24 How to simply specify the character that can use the item? And add item recipe that is only avaiable for him (not global)? Share this post Link to post Share on other sites
TheSkylarr 18 Report post Posted February 24 Do you want others to not be able to pick it up? Or be able to use some special action on it? I can help with both, I just need to know. As for crafting, you can specify a Tag characters need to have in order to craft in AddRecipe, I believe it is the 9th argument. Share this post Link to post Share on other sites
Near4422 4 Report post Posted February 24 25 minutes ago, TheSkylarr said: Do you want others to not be able to pick it up? Or be able to use some special action on it? I can help with both, I just need to know. As for crafting, you can specify a Tag characters need to have in order to craft in AddRecipe, I believe it is the 9th argument. Hmmm... I think other characters could pick it up if that's easier... just not be able to use it - it's weapon and tool. If it's easier it could be completely not pickable.. dunno. Makes no differace to me. Altough I think it would be harder to prevent usage than pick up at all. As it is for crafting - Yeah - now i remember. Gonna work on that Thanks! Share this post Link to post Share on other sites
TheSkylarr 18 Report post Posted February 25 (edited) 23 hours ago, Near4422 said: Hmmm... I think other characters could pick it up if that's easier... just not be able to use it - it's weapon and tool. If it's easier it could be completely not pickable.. dunno. Makes no differace to me. Altough I think it would be harder to prevent usage than pick up at all. As it is for crafting - Yeah - now i remember. Gonna work on that Thanks! Oh, sorry I guess I forgot to respond haha, the custom items in my character mod are only able to be picked up by my character, I pasted this inside the OnEquip code for the items I wanted to limit, make sure to paste it ABOVE the already existing code. Also, be sure to customize the TAG part, and of course whatever lines you want. if not owner:HasTag("TAG") then --Replace TAG with a tag only your character has inst:DoTaskInTime(0, function() if owner:HasTag("player") then owner.components.inventory:DropItem(inst) --Drops the item if they don't have the above TAG if owner:HasTag("mime") then owner.components.talker:Say("") --Nothing, mimes aren't able to talk elseif owner.prefab=="wx78" then owner.components.talker:Say("ERROR: READ-ONLY ITEM") --Custom WX line, he is a robot. elseif owner.prefab=="wilbur" then owner.components.talker:Say("Ooo")-- Wilbur is monkee else owner.components.talker:Say("I can't pick that up!")-- Generic line return end end) return end Edited February 25 by TheSkylarr Share this post Link to post Share on other sites
Near4422 4 Report post Posted February 25 Hmm... for some reason this code doesn't allow me even compile the mod. I get error whenever i try to launch a server :c local function onequip(inst, owner) local owner = inst.components.inventoryitem.owner or nil if not owner:HasTag("scarecrow") then --Replace TAG with a tag only your character has inst:DoTaskInTime(0, function() if owner:HasTag("player") then owner.components.inventory:DropItem(inst) --Drops the item if they don't have the above TAG if owner:HasTag("mime") then owner.components.talker:Say("") --Nothing, mimes aren't able to talk elseif owner.prefab=="wx78" then owner.components.talker:Say("ERROR: READ-ONLY ITEM") --Custom WX line, he is a robot. elseif owner.prefab=="wilbur" then owner.components.talker:Say("Ooo")-- Wilbur is monkee else owner.components.talker:Say("I can't pick that up!")-- Generic line return end end) return end owner.AnimState:OverrideSymbol("swap_object", "swap_scare_scythe", "scare_scythe") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end I've literarly this code above. Uhm... nevermind... i've been impatient... I just cut the code for the custom character lines and it worked.. weird but... I am fine with that.... Thank you for your time! Share this post Link to post Share on other sites
TheSkylarr 18 Report post Posted February 26 48 minutes ago, Near4422 said: Hmm... for some reason this code doesn't allow me even compile the mod. I get error whenever i try to launch a server :c local function onequip(inst, owner) local owner = inst.components.inventoryitem.owner or nil if not owner:HasTag("scarecrow") then --Replace TAG with a tag only your character has inst:DoTaskInTime(0, function() if owner:HasTag("player") then owner.components.inventory:DropItem(inst) --Drops the item if they don't have the above TAG if owner:HasTag("mime") then owner.components.talker:Say("") --Nothing, mimes aren't able to talk elseif owner.prefab=="wx78" then owner.components.talker:Say("ERROR: READ-ONLY ITEM") --Custom WX line, he is a robot. elseif owner.prefab=="wilbur" then owner.components.talker:Say("Ooo")-- Wilbur is monkee else owner.components.talker:Say("I can't pick that up!")-- Generic line return end end) return end owner.AnimState:OverrideSymbol("swap_object", "swap_scare_scythe", "scare_scythe") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end I've literarly this code above. Uhm... nevermind... i've been impatient... I just cut the code for the custom character lines and it worked.. weird but... I am fine with that.... Thank you for your time! Nice to see you got it working, just so you know, OnEquip already knows the owner of the item automatically, no need to define owner again like you've done with local owner = inst.components.inventoryitem.owner or nil 1 Share this post Link to post Share on other sites
Ultroman 725 Report post Posted March 1 (edited) Just for future reference, the post linked below explains how to make character-specific recipes and making an item like Thor's Hammer which can only be picked up by your character. Deceptively simple. Handling it in OnEquip (like the posts above) gives more flexibility, in that you can ask a friend to bring the item to you, but if the item is usable or equippable, then you could have some complex stuff to handle about who can use it etc.. If your use-case is pretty simple, which it seems this OPs is, the examples above are just fine. Edited March 1 by Ultroman Share this post Link to post Share on other sites