pxd2050 Posted February 22, 2021 Share Posted February 22, 2021 How to get the hair color of the head nif In script ? I want to make a mod to change the hair color base on HairTintColor in head nif, instead of HCLF-HairColor.I don't know what fucation Can do?Can you help me? Thank You Link to comment Share on other sites More sharing options...
dylbill Posted February 22, 2021 Share Posted February 22, 2021 With SKSE there's GetHairColor and SetHairColor for ActorBase: https://www.creationkit.com/index.php?title=GetHairColor_-_ActorBase Link to comment Share on other sites More sharing options...
pxd2050 Posted February 22, 2021 Author Share Posted February 22, 2021 With SKSE there's GetHairColor and SetHairColor for ActorBase: https://www.creationkit.com/index.php?title=GetHairColor_-_ActorBaseThank you for your reply. I tried it but it didn't work. That's why I sent this post. Function SyncHairColor() ActorBase ActorB = ActorRef.GetActorBase() ColorForm HairColorReference = ActorB.GetHairColor() ActorB.SetHairColor(HairColorReference) ActorRef.QueueNiNodeUpdate() EndFunction I don't Know GetHairColor() point to whether HairTintColor in head nif or HCLF-HairColor?but it don't work in my mod. Link to comment Share on other sites More sharing options...
dylbill Posted February 22, 2021 Share Posted February 22, 2021 So you want to get tint from the nif itself? Maybe you can try using NiOverride from Race Menu. There's this function: int Function GetSkinPropertyInt(ObjectReference ref, bool firstPerson, int slotMask, int key, int index) native globalWhich should get the tint directly from the node. For the key use 7 which is int - ShaderTintColor Edit: for the slotmask use 0x00000002 which is hair: https://www.creationkit.com/index.php?title=Slot_Masks_-_Armor Link to comment Share on other sites More sharing options...
pxd2050 Posted February 22, 2021 Author Share Posted February 22, 2021 (edited) So you want to get tint from the nif itself? Maybe you can try using NiOverride from Race Menu. There's this function: int Function GetSkinPropertyInt(ObjectReference ref, bool firstPerson, int slotMask, int key, int index) native globalWhich should get the tint directly from the node. For the key use 7 which is int - ShaderTintColor Edit: for the slotmask use 0x00000002 which is hair: https://www.creationkit.com/index.php?title=Slot_Masks_-_Armor Thank you,How to change Int to colorform? and what is wrong with this code? Function SyncHairColor() int skinColor = GetSkinPropertyInt(ActorRef,false,0x00000002,7,-1) debug.notification("skinColor is :" + skinColor) ;ActorBase ActorB = ActorRef.GetActorBase() ;ActorB.SetHairColor(skinColor as ColorForm) EndFunction in the game,debug display "skinColor is : 0" Edited February 22, 2021 by pxd2050 Link to comment Share on other sites More sharing options...
dylbill Posted February 22, 2021 Share Posted February 22, 2021 Hmm, at least for getting the color that looks right. Maybe instead you can try GetSkinPropertyInt(ActorRef as ObjectReference,false,0x00000002,7,-1) Not sure if that'll make a difference, but it might. Instead of using SetHairColor try using NiOverrides AddNodeOverrideInt. Link to comment Share on other sites More sharing options...
pxd2050 Posted February 23, 2021 Author Share Posted February 23, 2021 (edited) Hmm, at least for getting the color that looks right. Maybe instead you can try GetSkinPropertyInt(ActorRef as ObjectReference,false,0x00000002,7,-1) Not sure if that'll make a difference, but it might. Instead of using SetHairColor try using NiOverrides AddNodeOverrideInt.I don't think head NIF is in slot 31,Slot 31 is provided for the hair equipment added later.just as Slot 32 body.When you unequiped Slot 32 or 31,your hair and body don't take off. But wig (use Slot 31) can take off.these slot only provide for Override.So NiOverride can't do work with HairTintColor in head nif Edited February 23, 2021 by pxd2050 Link to comment Share on other sites More sharing options...
dylbill Posted February 23, 2021 Share Posted February 23, 2021 Hmm, I dunno then, you might be S.O.L other than making your own skse plugin which is beyond me. Link to comment Share on other sites More sharing options...
pxd2050 Posted February 23, 2021 Author Share Posted February 23, 2021 (edited) Hmm, I dunno then, you might be S.O.L other than making your own skse plugin which is beyond me.Sorry, I made a low-level mistake. I put the synchaircolor() function in the wrong place, so ActorRef is empty.Now GetSkinPropertyInt() can get HairTintColor in head nif.thank you very much. :dance: :dance: :dance: int niColor = GetSkinPropertyInt(ActorRef,false,0x00000002,7,-1) ColorForm haircolor hairColor.SetColor(niColor) ActorBase ActorB = ActorRef.GetActorBase() ActorB.SetHairColor(haircolor) ActorRef.QueueNiNodeUpdate() Edited February 23, 2021 by pxd2050 Link to comment Share on other sites More sharing options...
dylbill Posted February 23, 2021 Share Posted February 23, 2021 No problem, happy modding :) Link to comment Share on other sites More sharing options...
Recommended Posts