Glowy Squiddy Posted November 11, 2020 Share Posted November 11, 2020 (edited) Hello, I wan't to make a mod which adds a hat similar to spider hat, but it controls Deerclops. Is it possible? Edited November 11, 2020 by Glowy Squiddy Link to comment https://forums.kleientertainment.com/forums/topic/123327-how-to-make-a-custom-hat-behave-as-a-spider-hat/ Share on other sites More sharing options...
Glowy Squiddy Posted November 11, 2020 Author Share Posted November 11, 2020 Why does this post have views but not replies??? Link to comment https://forums.kleientertainment.com/forums/topic/123327-how-to-make-a-custom-hat-behave-as-a-spider-hat/#findComment-1390042 Share on other sites More sharing options...
penguin0616 Posted November 11, 2020 Share Posted November 11, 2020 Because people viewed your post and didn't reply. And yes, it's possible. 1 Link to comment https://forums.kleientertainment.com/forums/topic/123327-how-to-make-a-custom-hat-behave-as-a-spider-hat/#findComment-1390053 Share on other sites More sharing options...
-LukaS- Posted November 11, 2020 Share Posted November 11, 2020 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. 1 Link to comment https://forums.kleientertainment.com/forums/topic/123327-how-to-make-a-custom-hat-behave-as-a-spider-hat/#findComment-1390132 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