Jump to content

Recommended Posts

Hello.

I currently have a small problem with my character. It's not important but slightly annoying.

First of all, my character has a hat and even after dying he keeps his hat. So far so good.
The only problem is, if the character dies while wearing the hat, then gets resurrected the hat becomes invisible. It's still equipped but it isn't shown on my character. Is there maybe a line that could auto unequip-equip right after resurrecting?

Thanks in advance

You could somehow reload the animation because you probably don't need to unequip-equip after resurrecting.

(Also, are you playing with the no-drop mod? Because you should drop the hat.)

Edited by decduck3
11 hours ago, decduck3 said:

You could somehow reload the animation because you probably don't need to unequip-equip after resurrecting.

(Also, are you playing with the no-drop mod? Because you should drop the hat.)


No the things is, I don't want him to drop the hat. I want him to keep it after resurrecting.

How do I reload the animation?

Should work:

--unequip
local skin_build = inst:GetSkinBuild()
if skin_build ~= nil then
	owner:PushEvent("unequipskinneditem", inst:GetSkinName())
end

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

if owner:HasTag("player") then
    owner.AnimState:Show("HEAD")
    owner.AnimState:Hide("HEAD_HAT")
end

--equip
local skin_build = inst:GetSkinBuild()
if skin_build ~= nil then
	owner:PushEvent("equipskinneditem", inst:GetSkinName())
	owner.AnimState:OverrideItemSkinSymbol("swap_hat", skin_build, symbol_override or "swap_hat", inst.GUID, fname)
else
	owner.AnimState:OverrideSymbol("swap_hat", fname, symbol_override or "swap_hat")
end

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

if owner:HasTag("player") then
	owner.AnimState:Hide("HEAD")
    owner.AnimState:Show("HEAD_HAT")
end

You are effectively equipping and unequip, but just the animation.

Edited by decduck3

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