Jump to content

Changing the version of the head for a specific hat (Solved)

Recommended Posts


I'm attempting to use postinit to make it load "HEAD" instead of "HEAD_HAT", However it seems like it's ignoring it.

I guess it's running the postinit before the normal onequip function so Show("HEAD_HAT") gets said after it.

Is there something I'm missing or is it just not possible from this direction? I'll do it from his character script if need be but this way seemed like it'd be easier.


local function PartHeadHider(pref)
    if GLOBAL.TheWorld.ismastersim then 
        local OldEquip = pref.components.equippable.onequipfn
            pref.components.equippable.onequipfn = function(inst, owner, symbol_override)
            if owner:HasTag("woog_bennyboy") then
            OldEquip(inst, owner, symbol_override)
        local OldUnequip = pref.components.equippable.onunequipfn
        pref.components.equippable.onunequipfn = function(inst, owner)
            if (owner:HasTag("woog_bennyboy")) then
            OldUnequip(inst, owner)

AddPrefabPostInit("hivehat", PartHeadHider)

I use a similar code to hide hairfront when wearing full head hats. Because the ears poke out the top.

I may just make an alternate head for this and a few other problem-hats. But I already have 3 alternate heads because I have the "beard" as headbase textures


EDIT: After reviewing the block like 50 times I think I spotted the problem. And I really should've sooner. 
It was the problem. The "OldEquip" needed to be moved. I thought it was weird that it was running after the original code...

Edited by woogigooie
Link to comment
Share on other sites

You could of just listenforevent equip/unequip and undid the show/hide for "HEAD" and "HEAD_HAT" this keep the code isolated to just your character and fix it for just your character rather than needing to postinitprefab it for every specific hat that you may need it for.

With how small your character's head is in the first place I wonder do you even need your head_hat to be so small? As it looks like it would be incompatible with just about every head slot item that would do something similar.

Edited by IronHunter
  • Like 1
Link to comment
Share on other sites

I'll be honest, I thought his head was way too big for a while.

There's only a small handfull of hats that pose a problem like this, most of them work fine.

The only reason I specified certain hats in postinit was because most arent problematic, so applying it to all of them would cause alot of clipping.

And while yes, some do clip and it certainly could work better. The clipping is relatively minimal compared to the likes of the hive hat. Solely because on the side shot the forehead of the hat was so far receded compared to the front. The front looked fine for the most part.


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

  • Create New...