Jump to content

Recommended Posts

Hi! Sorry if this is a stupid question but I wanted to make a custom helmet that hides the face of my character, however I was wondering if there was a way to keep it on the head during animations? like for example when go through a wormhole the helmet flies off and reveals the headless body, is there a way to keep it on the head like the void cowl?

--So if you look into the hats.lua you'll see that it does this for I think the void cowl and the lunar variant(Forgot it lmao).

 

    fns.fullhelm_onequip = function(inst, owner)
        if owner:HasTag("player") then
            _base_onequip(inst, owner, nil, "headbase_hat")

            owner.AnimState:Hide("HAT")
            owner.AnimState:Hide("HAIR_HAT")
            owner.AnimState:Hide("HAIR_NOHAT")
            owner.AnimState:Hide("HAIR")

            owner.AnimState:Hide("HEAD")
            owner.AnimState:Show("HEAD_HAT")
            owner.AnimState:Hide("HEAD_HAT_NOHELM")
            owner.AnimState:Show("HEAD_HAT_HELM")

            owner.AnimState:HideSymbol("face")
            owner.AnimState:HideSymbol("swap_face")
            owner.AnimState:HideSymbol("beard")
            owner.AnimState:HideSymbol("cheeks")

            owner.AnimState:UseHeadHatExchange(true)
        else
            _base_onequip(inst, owner)

            owner.AnimState:Show("HAT")
            owner.AnimState:Hide("HAIR_HAT")
            owner.AnimState:Hide("HAIR_NOHAT")
            owner.AnimState:Hide("HAIR")
        end
    end

--and this

 

    fns.fullhelm_onunequip = function(inst, owner)
        _onunequip(inst, owner)

        if owner:HasTag("player") then
            owner.AnimState:ShowSymbol("face")
            owner.AnimState:ShowSymbol("swap_face")
            owner.AnimState:ShowSymbol("beard")
            owner.AnimState:ShowSymbol("cheeks")

            owner.AnimState:UseHeadHatExchange(false)
        end
    end

 

-- it also has this but so long as you put the above parts into the onunequip and onequip properly, you should be fine.

 

       fullhelm_onequip = fns.fullhelm_onequip,
        fullhelm_onunequip = fns.fullhelm_onunequip, --I believe these were for skins

 

1 hour ago, Meepenator said:

--So if you look into the hats.lua you'll see that it does this for I think the void cowl and the lunar variant(Forgot it lmao).

 

    fns.fullhelm_onequip = function(inst, owner)
        if owner:HasTag("player") then
            _base_onequip(inst, owner, nil, "headbase_hat")

            owner.AnimState:Hide("HAT")
            owner.AnimState:Hide("HAIR_HAT")
            owner.AnimState:Hide("HAIR_NOHAT")
            owner.AnimState:Hide("HAIR")

            owner.AnimState:Hide("HEAD")
            owner.AnimState:Show("HEAD_HAT")
            owner.AnimState:Hide("HEAD_HAT_NOHELM")
            owner.AnimState:Show("HEAD_HAT_HELM")

            owner.AnimState:HideSymbol("face")
            owner.AnimState:HideSymbol("swap_face")
            owner.AnimState:HideSymbol("beard")
            owner.AnimState:HideSymbol("cheeks")

            owner.AnimState:UseHeadHatExchange(true)
        else
            _base_onequip(inst, owner)

            owner.AnimState:Show("HAT")
            owner.AnimState:Hide("HAIR_HAT")
            owner.AnimState:Hide("HAIR_NOHAT")
            owner.AnimState:Hide("HAIR")
        end
    end

--and this

 

    fns.fullhelm_onunequip = function(inst, owner)
        _onunequip(inst, owner)

        if owner:HasTag("player") then
            owner.AnimState:ShowSymbol("face")
            owner.AnimState:ShowSymbol("swap_face")
            owner.AnimState:ShowSymbol("beard")
            owner.AnimState:ShowSymbol("cheeks")

            owner.AnimState:UseHeadHatExchange(false)
        end
    end

 

-- it also has this but so long as you put the above parts into the onunequip and onequip properly, you should be fine.

 

       fullhelm_onequip = fns.fullhelm_onequip,
        fullhelm_onunequip = fns.fullhelm_onunequip, --I believe these were for skins

 

Hey! I tried adding them like you said but the game crashes upon loading with the error "variable 'fns' is not declared" any ideas? I'm still new to this so I don't know how to go about it

That was just the base game code, take out the parts that have fns and just use the onequip parts like this, this *should* work

 

 local function OnEquip(inst, owner)
            owner.AnimState:OverrideSymbol("swap_hat", "insertyourhathere_swap","swap_hat") --this either goes here and has your item swamp in the middle

 if owner:HasTag("player") then

         -- owner.AnimState:OverrideSymbol("swap_hat", "insertyourhathere_swap","swap_hat") --or here

            owner.AnimState:Hide("HAT")
            owner.AnimState:Hide("HAIR_HAT")
            owner.AnimState:Hide("HAIR_NOHAT")
            owner.AnimState:Hide("HAIR")

            owner.AnimState:Hide("HEAD")
            owner.AnimState:Show("HEAD_HAT") 
            owner.AnimState:Hide("HEAD_HAT_NOHELM")
            owner.AnimState:Show("HEAD_HAT_HELM")

            owner.AnimState:HideSymbol("face")
            owner.AnimState:HideSymbol("swap_face")
            owner.AnimState:HideSymbol("beard")
            owner.AnimState:HideSymbol("cheeks")

      owner.AnimState:UseHeadHatExchange(true)
        else

            owner.AnimState:Show("HAT")
            owner.AnimState:Hide("HAIR_HAT")
            owner.AnimState:Hide("HAIR_NOHAT")
            owner.AnimState:Hide("HAIR")
        end

        

    end

    local function OnUnequip(inst, owner)
       
        owner.AnimState:ClearOverrideSymbol("swap_hat") -- this should go here

        if owner:HasTag("player") then
            owner.AnimState:ShowSymbol("face")
            owner.AnimState:ShowSymbol("swap_face")
            owner.AnimState:ShowSymbol("beard")
            owner.AnimState:ShowSymbol("cheeks")

            owner.AnimState:UseHeadHatExchange(false)
        end        
    end

1 hour ago, Meepenator said:

That was just the base game code, take out the parts that have fns and just use the onequip parts like this, this *should* work

 

 local function OnEquip(inst, owner)
            owner.AnimState:OverrideSymbol("swap_hat", "insertyourhathere_swap","swap_hat") --this either goes here and has your item swamp in the middle

 if owner:HasTag("player") then

         -- owner.AnimState:OverrideSymbol("swap_hat", "insertyourhathere_swap","swap_hat") --or here

            owner.AnimState:Hide("HAT")
            owner.AnimState:Hide("HAIR_HAT")
            owner.AnimState:Hide("HAIR_NOHAT")
            owner.AnimState:Hide("HAIR")

            owner.AnimState:Hide("HEAD")
            owner.AnimState:Show("HEAD_HAT") 
            owner.AnimState:Hide("HEAD_HAT_NOHELM")
            owner.AnimState:Show("HEAD_HAT_HELM")

            owner.AnimState:HideSymbol("face")
            owner.AnimState:HideSymbol("swap_face")
            owner.AnimState:HideSymbol("beard")
            owner.AnimState:HideSymbol("cheeks")

      owner.AnimState:UseHeadHatExchange(true)
        else

            owner.AnimState:Show("HAT")
            owner.AnimState:Hide("HAIR_HAT")
            owner.AnimState:Hide("HAIR_NOHAT")
            owner.AnimState:Hide("HAIR")
        end

        

    end

    local function OnUnequip(inst, owner)
       
        owner.AnimState:ClearOverrideSymbol("swap_hat") -- this should go here

        if owner:HasTag("player") then
            owner.AnimState:ShowSymbol("face")
            owner.AnimState:ShowSymbol("swap_face")
            owner.AnimState:ShowSymbol("beard")
            owner.AnimState:ShowSymbol("cheeks")

            owner.AnimState:UseHeadHatExchange(false)
        end        
    end

I'm so sorry to bother you again but I've seem to run into another issue, I was able to get in the game without crashing now but when I put the hat on both the hat itself and the characters face go invisible while the head remains no matter what I do

So the thing is, I think you need to actually change the anim of the hat itself, I'm trying to make it work on my end but    owner.AnimState:UseHeadHatExchange(false)   this is what would stop the hat from flying off, and you kinda need             owner.AnimState:Show("HEAD_HAT")             owner.AnimState:Show("HEAD_HAT_HELM") to work properly. I'll keep looking into it but I think you need to actually have those specific anim states.

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