pxd2050 Posted April 10, 2021 Share Posted April 10, 2021 I am making a mod to change actors hair color, I find GetHairColor() return null when some actors has not set HCLF(hair color) .So mod can't change color on those actors.I need a ColorForm to setcolor(color) and I find "ColorForm _hairColor" just a Pointer to ColorForm no a Value of ColorForm.How to make a ColorForm to SetHairColor() ? Scriptname outfit__MainScript extends ReferenceAlias ColorForm _hairColor Function HairColor_Set() ......... int color = 65536*red + 256*green + blue _hairColor = ActorB.GetHairColor() _hairColor.setcolor(color) ActorB.SetHairColor(_hairColor) ActorRef.QueueNiNodeUpdate() EndFunction Link to comment Share on other sites More sharing options...
dylbill Posted April 10, 2021 Share Posted April 10, 2021 I don't think you can create a colorform with script. You can create a bunch in the CK and put them in formlists to track them though. Formlist Property MyColorForms Auto ;Fill with color forms in the CK Formlist Property UnusedColorForms Auto ;Empty list Formlist Property UsedColorForms Auto ;Empty list Event OnInit() Int M = MyColorForms.GetSize() While M > 0 M -= 1 UnusedColorForms.AddForm(MyColorForms.GetAt(M)) ;add all forms to UnusedColorForms list so they can be removed later if needed. EndWhile Endevent Function HairColor_Set() int color = 65536*red + 256*green + blue Colorform _hairColor = ActorB.GetHairColor() If _hairColor == None If UnusedColorForms.GetSize() > 0 _hairColor = UnusedColorForms.GetAt(0) as Colorform UnusedColorForms.RemoveAddedForm(_hairColor) UsedColorForms.AddForm(_hairColor) Else Debug.Notification("Can't set hair color. No forms left.") Endif Endif _hairColor.setcolor(color) ActorB.SetHairColor(_hairColor) ActorRef.QueueNiNodeUpdate() EndFunction Link to comment Share on other sites More sharing options...
pxd2050 Posted April 10, 2021 Author Share Posted April 10, 2021 (edited) I don't think you can create a colorform with script. You can create a bunch in the CK and put them in formlists to track them though. Formlist Property MyColorForms Auto ;Fill with color forms in the CK Formlist Property UnusedColorForms Auto ;Empty list Formlist Property UsedColorForms Auto ;Empty list Event OnInit() Int M = MyColorForms.GetSize() While M > 0 M -= 1 UnusedColorForms.AddForm(MyColorForms.GetAt(M)) ;add all forms to UnusedColorForms list so they can be removed later if needed. EndWhile Endevent Function HairColor_Set() int color = 65536*red + 256*green + blue Colorform _hairColor = ActorB.GetHairColor() If _hairColor == None If UnusedColorForms.GetSize() > 0 _hairColor = UnusedColorForms.GetAt(0) as Colorform UnusedColorForms.RemoveAddedForm(_hairColor) UsedColorForms.AddForm(_hairColor) Else Debug.Notification("Can't set hair color. No forms left.") Endif Endif _hairColor.setcolor(color) ActorB.SetHairColor(_hairColor) ActorRef.QueueNiNodeUpdate() EndFunction Thank you so much. That's what I need. You are a genius and a good mentor. :thumbsup: :thumbsup: :thumbsup: Edited April 10, 2021 by pxd2050 Link to comment Share on other sites More sharing options...
dylbill Posted April 11, 2021 Share Posted April 11, 2021 Lol no problem. Happy modding :) Link to comment Share on other sites More sharing options...
Recommended Posts