Jump to content

Recommended Posts

You could probably make a function similar to that of a spider hat and put it in your hats prefab file. Like this, for example:

local function OnEquip(inst) -- Name of the function
	local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner -- Defining who's the owner
	if owner then -- If owner exists...
		owner:AddTag("deerclopsdisguise") -- Add a tag
	end
end

 

Adding this function as an OnEquip function will make the player have the tag when they're wearing the hat.

Make one for OnUnEquip as well:
 

local function OnUnEquip(inst) -- Function name
	local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner -- Define the owner
	
	if owner then -- If owner exists...
		if owner:HasTag("deerclopsdisguise") then -- And has the "deerclopsdisguise" tag...
			owner:RemoveTag("deerclopsdisguise") -- Remove it
		end
	end
end

 

Now, to make deerclops not target entities with this tag add it to its "RETARGET_CANT_TAGS" tags with AddPrefabPostInit:

AddPrefabPostInit("deerclops", function(inst)
	local RETARGET_CANT_TAGS = { "prey", "smallcreature", "INLIMBO", "deerclopsdisguise" }
end)

 

This should do the trick.

  • Like 1

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...