Jump to content

How to get valu of HairTintColor in head nif with script function?


Recommended Posts

No idea.. if next is what are you looking for. Hair Tint Color #252525

RGB -> Red = 0x25, Green = 0x25, Blue = 0x25

 

now a bit mathematic for understanding: left hexadecimal, right decimal number

0x0F = 15 0x1F = 31 0x25 = 37
0x10 = 16 0x20 = 32 0xFF = 255

 

(1) look at SKSE script "Headpart.psc"

 

Scriptname HeadPart extends Form Hidden

    HeadPart Function GetHeadPart(string name) native global

; Returns the head part type
    int Function GetType() native

int Property Type_Misc = 0 AutoReadOnly
int Property Type_Face = 1 AutoReadOnly
int Property Type_Eyes = 2 AutoReadOnly
int Property Type_Hair = 3 AutoReadOnly
int Property Type_FacialHair = 4 AutoReadOnly
int Property Type_Scar = 5 AutoReadOnly
int Property Type_Brows = 6 AutoReadOnly

 


(2) look at SKSE script "ColorForm.psc"

 

Scriptname ColorForm extends Form Hidden

    int Function GetColor() native

    int Function GetRed()
        return ColorComponent.GetRed(Self.GetColor())
    EndFunction

    int Function GetGreen()
        return ColorComponent.GetGreen( Self.GetColor() )
    EndFunction

    int Function GetBlue()
        return ColorComponent.GetBlue( Self.GetColor() )
    EndFunction

    Float Function GetValue()
        return ColorComponent.GetValue( Self.GetColor() )
    EndFunction

 

 

 

code snippets

 

;------------------------------------------
HeadPart FUNCTION myF_GetHairHP(Actor aRef)
;------------------------------------------
; https://forums.nexusmods.com/index.php?/topic/6074573-changing-headparts-via-script/

    actorBase AB = aRef.GetBaseObject() as ActorBase
    RETURN AB.GetNthHeadPart(3)                            ; get headpart of hair
ENDFUNCTION


;----------------------------------------------
ColorForm FUNCTION myF_GetHairColor(Actor aRef)
;----------------------------------------------
; https://pastebin.com/95zqxkne
; https://www.creationkit.com/index.php?title=GetHairColor_-_ActorBase

    actorBase AB = aRef.GetBaseObject() as ActorBase
    RETURN AB.GetHairColor()                            ; get color of hair
ENDFUNCTION


;------------------------------------
Int FUNCTION myF_GetColor(Actor aRef)
;------------------------------------
; https://www.creationkit.com/index.php?title=ColorForm_Script

    colorForm CF = myF_GetHairColor(aRef)
    RETURN CF.GetColor() + 0xFF000000        ; the RGB value, set alpha as 0xFF
ENDFUNCTION

;----------------------------------
Int FUNCTION myF_GetRed(Actor aRef)
;----------------------------------
; https://www.creationkit.com/index.php?title=GetRed_-_ColorForm

    colorForm CF = myF_GetHairColor(aRef)
    RETURN CF.GetRed()                        ; amount of red in actors hair
ENDFUNCTION

;------------------------------------
Int FUNCTION myF_GetGreen(Actor aRef)
;------------------------------------
; https://www.creationkit.com/index.php?title=GetRed_-_ColorForm

    colorForm CF = myF_GetHairColor(aRef)
    RETURN CF.GetGreen()                    ; amount of green in actors hair
ENDFUNCTION

;-----------------------------------
Int FUNCTION myF_GetBlue(Actor aRef)
;-----------------------------------
; https://www.creationkit.com/index.php?title=GetBlue_-_ColorForm

    colorForm CF = myF_GetHairColor(aRef)
    RETURN CF.GetBlue()                        ; amount of blue in actors hair
ENDFUNCTION


;------------------------------
FUNCTION myF_Action(Actor aRef)
;------------------------------
    headPart HP = myF_GetHairHP(aRef)

    int i = myF_GetColor(aRef)                ; i has the color of hair you need
    Debug.Trace(" HairColor = " +i+ " HeadPart = " +HP)

    myF_GetTintMasks()
    Debug.Trace("-- TintMaskColors --")

    int j = 1

    i = 0
    WHILE (j > 0)
        j = _tintColors[i]
        Debug.Trace(j)
        i = i + 1
    ENDIF

;
;; updates the actors nodes to allow new thinks to display
;    aRef.QueueNiNodeUpdate()
ENDFUNCTION


  Int[]    _tintTypes    ; = None
  Int[]    _tintColors   ; = None
  String[] _tintTextures ; = None

;--------------------------
FUNCTION myF_GetTintMasks()
;--------------------------
; ; https://pastebin.com/95zqxkne

    int iMax = Game.GetNumTintMasks()        ;  totalTints

    IF ( _tintTypes )
        ; arrays already initialized
    ELSE
        _tintTypes = new int[128]
        _tintColors = new int[128]
        _tintTextures = new string[128]
    ENDIF

    IF (iMax > 128)        ; safety condition
        iMax = 128
    ENDIF

    int i = 0
    WHILE (i < 128)
        IF (i < iMax)
            _tintTypes[i]    = Game.GetNthTintMaskType(i)
            _tintColors[i]   = Game.GetNthTintMaskColor(i)
            _tintTextures[i] = Game.GetNthTintMaskTexturePath(i)
        ELSE
            _tintTypes[i]    = 0
            _tintColors[i]   = 0
            _tintTextures[i] = ""
        ENDIF
        
        i = i + 1
    ENDWHILE
ENDFUNCTION

 

 

 

I have no experience with SKSE functions.

Edited by ReDragon2013
Link to comment
Share on other sites

No idea.. if next is what are you looking for. Hair Tint Color #252525

 

RGB -> Red = 0x25, Green = 0x25, Blue = 0x25

 

now a bit mathematic for understanding: left hexadecimal, right decimal number

0x0F = 15 0x1F = 31 0x25 = 37

0x10 = 16 0x20 = 32 0xFF = 255

 

(1) look at SKSE script "Headpart.psc"

 

Scriptname HeadPart extends Form Hidden

    HeadPart Function GetHeadPart(string name) native global

; Returns the head part type
    int Function GetType() native

int Property Type_Misc = 0 AutoReadOnly
int Property Type_Face = 1 AutoReadOnly
int Property Type_Eyes = 2 AutoReadOnly
int Property Type_Hair = 3 AutoReadOnly
int Property Type_FacialHair = 4 AutoReadOnly
int Property Type_Scar = 5 AutoReadOnly
int Property Type_Brows = 6 AutoReadOnly

 

 

(2) look at SKSE script "ColorForm.psc"

 

Scriptname ColorForm extends Form Hidden

    int Function GetColor() native

    int Function GetRed()
        return ColorComponent.GetRed(Self.GetColor())
    EndFunction

    int Function GetGreen()
        return ColorComponent.GetGreen( Self.GetColor() )
    EndFunction

    int Function GetBlue()
        return ColorComponent.GetBlue( Self.GetColor() )
    EndFunction

    Float Function GetValue()
        return ColorComponent.GetValue( Self.GetColor() )
    EndFunction

 

 

 

code snippets

 

;------------------------------------------
HeadPart FUNCTION myF_GetHairHP(Actor aRef)
;------------------------------------------
; https://forums.nexusmods.com/index.php?/topic/6074573-changing-headparts-via-script/

    actorBase AB = aRef.GetBaseObject() as ActorBase
    RETURN AB.GetNthHeadPart(3)                            ; get headpart of hair
ENDFUNCTION


;----------------------------------------------
ColorForm FUNCTION myF_GetHairColor(Actor aRef)
;----------------------------------------------
; https://pastebin.com/95zqxkne
; https://www.creationkit.com/index.php?title=GetHairColor_-_ActorBase

    actorBase AB = aRef.GetBaseObject() as ActorBase
    RETURN AB.GetHairColor()                            ; get color of hair
ENDFUNCTION


;------------------------------------
Int FUNCTION myF_GetColor(Actor aRef)
;------------------------------------
; https://www.creationkit.com/index.php?title=ColorForm_Script

    colorForm CF = myF_GetHairColor(aRef)
    RETURN CF.GetColor() + 0xFF000000        ; the RGB value, set alpha as 0xFF
ENDFUNCTION

;----------------------------------
Int FUNCTION myF_GetRed(Actor aRef)
;----------------------------------
; https://www.creationkit.com/index.php?title=GetRed_-_ColorForm

    colorForm CF = myF_GetHairColor(aRef)
    RETURN CF.GetRed()                        ; amount of red in actors hair
ENDFUNCTION

;------------------------------------
Int FUNCTION myF_GetGreen(Actor aRef)
;------------------------------------
; https://www.creationkit.com/index.php?title=GetRed_-_ColorForm

    colorForm CF = myF_GetHairColor(aRef)
    RETURN CF.GetGreen()                    ; amount of green in actors hair
ENDFUNCTION

;-----------------------------------
Int FUNCTION myF_GetBlue(Actor aRef)
;-----------------------------------
; https://www.creationkit.com/index.php?title=GetBlue_-_ColorForm

    colorForm CF = myF_GetHairColor(aRef)
    RETURN CF.GetBlue()                        ; amount of blue in actors hair
ENDFUNCTION


;------------------------------
FUNCTION myF_Action(Actor aRef)
;------------------------------
    headPart HP = myF_GetHairHP(aRef)

    int i = myF_GetColor(aRef)                ; i has the color of hair you need
    Debug.Trace(" HairColor = " +i+ " HeadPart = " +HP)

    myF_GetTintMasks()
    Debug.Trace("-- TintMaskColors --")

    int j = 1

    i = 0
    WHILE (j > 0)
        j = _tintColors[i]
        Debug.Trace(j)
        i = i + 1
    ENDIF

;
;; updates the actors nodes to allow new thinks to display
;    aRef.QueueNiNodeUpdate()
ENDFUNCTION


  Int[]    _tintTypes    ; = None
  Int[]    _tintColors   ; = None
  String[] _tintTextures ; = None

;--------------------------
FUNCTION myF_GetTintMasks()
;--------------------------
; ; https://pastebin.com/95zqxkne

    int iMax = Game.GetNumTintMasks()        ;  totalTints

    IF ( _tintTypes )
        ; arrays already initialized
    ELSE
        _tintTypes = new int[128]
        _tintColors = new int[128]
        _tintTextures = new string[128]
    ENDIF

    IF (iMax > 128)        ; safety condition
        iMax = 128
    ENDIF

    int i = 0
    WHILE (i < 128)
        IF (i < iMax)
            _tintTypes[i]    = Game.GetNthTintMaskType(i)
            _tintColors[i]   = Game.GetNthTintMaskColor(i)
            _tintTextures[i] = Game.GetNthTintMaskTexturePath(i)
        ELSE
            _tintTypes[i]    = 0
            _tintColors[i]   = 0
            _tintTextures[i] = ""
        ENDIF
        
        i = i + 1
    ENDWHILE
ENDFUNCTION

 

 

 

I have no experience with SKSE functions.

Thank you for your reply. These functions have no effect on NIF. for example:GetHairColor() return HCLF ,but in the game npcs hair color Initial value is Hair Tint Color.

Some NPCs HCLF == Hair Tint Color, but many other NPCs HCLF != Hair Tint Color.

this why I want to find a function to get Hair Tint Color.

I tried nioverride.psc(racemenu), but the file function description is too confusing, I can't find the correct function.

It's been bothering me for a long time. Can you help me?

Thank you

Edited by pxd2050
Link to comment
Share on other sites

  • Recently Browsing   0 members

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