Jump to content

How to get the hair color of the head nif In script ?


pxd2050

Recommended Posts

With SKSE there's GetHairColor and SetHairColor for ActorBase: https://www.creationkit.com/index.php?title=GetHairColor_-_ActorBase

Thank 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

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 global

Which 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

 

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 global

Which 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 by pxd2050
Link to comment
Share on other sites

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

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 by pxd2050
Link to comment
Share on other sites

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 by pxd2050
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...