Jump to content

Change Head part with script


Recommended Posts


HeadPart Property ZZZ_headp1 Auto const mandatory;
HeadPart Property ZZZ_eyes Auto const mandatory;
HeadPart Property ZZZ_lashes Auto const mandatory;
HeadPart Property ZZZ_jaw Auto const mandatory;
HeadPart Property ZZZ_blankhair Auto const mandatory;
HeadPart Property ZZZ_blankeye Auto const mandatory;

HeadPart[] tHeadParts;
int nCount;

Event OnEquipped(Actor akActor)
	;Debug.MessageBox("ZZZ ARM equipped")
	tHeadParts = akActor.GetActorBase().GetHeadParts();
	nCount = tHeadParts.Length;
	
	int i = 0;
	while (i < nCount) 
		HeadPart tPart = tHeadParts[i];
		;Debug.MessageBox("Part " + i + " [" + tPart.GetName() + "]" + " is " + tPart.GetType());
		akActor.ChangeHeadPart(tHeadParts[i], true);
                i = i + 1;
	endwhile
	
	
	
	akActor.ChangeHeadPart(ZZZ_headp1);
	akActor.ChangeHeadPart(ZZZ_eyes);
	akActor.ChangeHeadPart(ZZZ_lashes);
	akActor.ChangeHeadPart(ZZZ_jaw);
	akActor.ChangeHeadPart(ZZZ_blankhair);
	akActor.ChangeHeadPart(ZZZ_blankeye);
	
endEvent

Event OnUnequipped(Actor akActor)
	;Debug.MessageBox("ZZZ arm unequipped")

	akActor.ChangeHeadPart(ZZZ_headp1, true, true);
	akActor.ChangeHeadPart(ZZZ_eyes, true, true);
	akActor.ChangeHeadPart(ZZZ_lashes, true, true);
	akActor.ChangeHeadPart(ZZZ_jaw, true, true);
	akActor.ChangeHeadPart(ZZZ_blankhair, true, true);
	akActor.ChangeHeadPart(ZZZ_blankeye, true, true);
	
	int i = 0;
	while (i < nCount) 
		HeadPart tPart = tHeadParts[i];
		;Debug.MessageBox("Part " + i + " [" + tPart.GetName() + "]" + " is " + tPart.GetType());
                akActor.ChangeHeadPart(tHeadParts[i]);
		i = i + 1;
	endwhile
endEvent
Was trying to apply another face to actor who equiping armor, with support for face expressions, mostly work, but have some small problems:
1)
akActor.ChangeHeadPart(tHeadParts, true);
don't work for hair, script can find hair but cant remove it
only when I apply blank (no mesh) head part with hair slot result in hair disappears, but I also cant return hair back
2)
How I can store head part for different actors in variable to return their headpart back when armor is unequipped
HeadPart[] tHeadParts = akActor.GetActorBase().GetHeadParts();
3)
When I equip, then unequip, then again equip I can see eye lashes from base face, and their will appear again each time armor equipping
Why they dont appear first time, I dont know how to remove them, blank eyes and lashes cant remove them
4)
When I select "facegen texture" for face slot model - face appearing with previous face texture (equipped before armor equip) and it is required to use looksmenu to apply proper textures
When I select non facegen - model in face slot dont appear first time when equipping armor
I saw example with facechange with "preset" option in looksmenu, but it ruin all bodygen morphs
Edited by Indarello
Link to comment
Share on other sites

4)Solution

BodyGen.SetSkinOverride(akActor, "Your id of textures in F4SE\Plugins\F4EE\Skin\youresp.esp\skin.json")

 

when remove outfit:

BodyGen.RemoveSkinOverride(akActor);

 

 

warning:RemoveSkinOverride before returning headparts, otherwise script may crash game

 

For other 3 I decided to dont return face parts and and leave the return of the previous preset to the user

Edited by Indarello
Link to comment
Share on other sites

  • Recently Browsing   0 members

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