Jump to content

custom item help


Recommended Posts

Define character specific?
If you mean only your character can make like wickerbottom's books or wigfrid. Then you need to add your character's unique tag to the items recipe.
If you mean the item can only be equipped or picked up by your character like Lucy, then you would have to emulate something similar.

Link to comment
Share on other sites

IronHunter is right.

In order to keep other characters from picking up the item, and preventing duplicate characters from picking up each other's items, you'd have to do something like this:

AddPrefabPostInit("YOUR_ITEM_PREFAB_NAME", function(inst)
	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
end)

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...