Jump to content

Recommended Posts

AddPrefabPostInit("spear", function(inst)
	if not GLOBAL.TheWorld.ismastersim then
		return
	end

	inst:ListenForEvent("equipped", function(inst, data)
		local owner = data.owner
		if owner and owner:HasTag("player") and not owner:HasTag("specialguy") then
			owner:DoTaskInTime(0, function(owner)
				owner.components.inventory:GiveItem(inst)
			end)
		end
	end)
end)

This makes spears unequip from people that doesn't have the "specialguy" tag.

1 hour ago, NeddoFreddo said:

@DarkXero Is there a way to make a whole item type unequippable by a character? (e.g. anything that goes in the character's headslot)

Thanks for helping if you can!

you do something similar but onto your character

inst:ListenForEvent("equip", function(inst,data)
	if data.item.components.equippable.equipslot == EQUIPSLOTS.HEAD then
		inst:DoTaskInTime(0, function(inst)
			inst.components.inventory:GiveItem(data.item)
		end)
	end
end)

 

13 hours ago, Aquaterion said:

you do something similar but onto your character


inst:ListenForEvent("equip", function(inst,data)
	if data.item.components.equippable.equipslot == EQUIPSLOTS.HEAD then
		inst:DoTaskInTime(0, function(inst)
			inst.components.inventory:GiveItem(data.item)
		end)
	end
end)

 

So... character.lua?

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
×
  • Create New...