Jump to content

How can I HAIR_HAT on at all times?


Recommended Posts

So awhile back they made it so characters did not have the HAIR_HAT enabled when first spawning into the world so a lot of characters with "ears" would be earless. Aka Anthromorphic characters.

I know this is probably solved already but I cant find it so my google-fu is probably horrible. This is what I have right now:

    inst:ListenForEvent("unequip", function(inst, data)
        print("I'm wearing something.")
        inst.AnimState:Show("HAIR_HAT")
    end)

Which makes the HAIR_HAT sprites reappear after unequipping. Is there a way to just keep HAIR_HAT sprites enabled at all times rather than this specific condition? 

Edited by rons0n
Link to comment
Share on other sites

Not tested, but try this:

local _Hide_Old = inst.AnimState.Hide
inst.AnimState.Hide = function(x,y,z)
	if x=="HAIR_HAT" then return end
	return _Hide_Old(x,y,z)
end

EDIT: Just tested and this doesn't work. AnimState isn't a table.

Edited by JohnWatson
Link to comment
Share on other sites

7 minutes ago, JohnWatson said:

Not tested, but try this:


local _Hide_Old = inst.AnimState.Hide
inst.AnimState.Hide = function(x,y,z)
	if x=="HAIR_HAT" then return end
	return _Hide_Old(x,y,z)
end

Thanks for helping Watson, unfortunately I was greeted with:

[00:01:09]: [string "../mods/Elphelt Valentine/scripts/prefabs/e..."]:93: attempt to index field 'AnimState' (a userdata value)

Im probably stupid and misplaced it as I added it to the master_postinit then the common_postinit within the characters.lua. (Not a coder unfortunately </3). Any ideas?

Link to comment
Share on other sites

AnimState is not a "real" table, but a userdata (a pointer to a block of memory that the C API can use to perform its own business), so we don't have access to it.

I would override the onequip instead

Edited by ZupaleX
Link to comment
Share on other sites

Thanks for the help guys, I'll mess with the code some more just incase. If by any chance you guys do find a more permanent solution I'd really appreciate it. 

Again, thanks for looking into it! 

I'll update my thread if i manage to find it by happenstance

Link to comment
Share on other sites

As someone who doesn't used "eared" characters I'm curious as to what the problem is. If you want the hair_hat sprites to always be visible, why wouldn't you just make them identical to the non-hat hair sprite? What am I missing?

Link to comment
Share on other sites

Sorry i'm might be stupid but I dont understand what you mean. Are you saying why not just use another sprite altogether as a workaround? Its been a year since ive messed with modding so a lot of basic ideas are lost to me. If thats what you meant yeah, but i like the slight jiggle the ear_hat provides and some of my mods use both pigtails and ear_hat that I can't use anything else as a replacement.

But i did manage to do a workaround still using hair_hat which was basically my original idea then adding inst.AnimState:Show("HAIR_HAT") to onbecamehuman and onload.

Nvm i get what you mean, use the normal hair sprites right? Well i didnt think about it till' now, does using the normal hair sprite work? I remember years ago there was a reason not to do it but I guess thats been resolved(maybe)

Edited by rons0n
Link to comment
Share on other sites

2 hours ago, rons0n said:

Nvm i get what you mean, use the normal hair sprites right? Well i didnt think about it till' now, does using the normal hair sprite work? I remember years ago there was a reason not to do it but I guess thats been resolved(maybe)

The texture size and animation for hair and hair_hat are completely identical as far as I'm aware. Generally hair_hat is just a copy of the hair texture with the bits you don't want sticking out of the hat chopped off. So it should be functionally the same if you just put everything you wanted to be visible into the hair texture.

So I'd suggest putting all the bits you want to be visible in both states into both textures.

Edited by code4240
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
 Share

×
  • Create New...