Jump to content
  • entries
    39
  • comments
    154
  • views
    60,993

Snippet: Scripted body color changes


DeepBlueFrog

907 views

blog-0524715001410472420.pngAfter wasting time fighting random crashes with Skyrim (which turned out to be a mix of a somehow corrupted .ini file and issues with SexLab Defeat 4.1), I finally took the time to think about a long standing idea - how to change the skin of the player by script.

 

Applications could be interesting. Think dynamic dirt on the face of slaves, make-up on demand, sun-tan... on in my current application, hormonal effects of repeated sexual activity.

 

A side mod I am working on tracks the player's sexual activity and applies changes to the body over time. Too much activity and the body gains weight and increases sensual curves, Not enough activity and the changes revert back to a flatter body.

 

I wanted the skin color to change accordingly - colder with low activity, and warmer with high activity (along with red lips and dark eyeliner).

 

Thanks for @jbezorg for pointing me to the direction of the source scripts for RaceMenu.... here is the code I came up with:

; SKIN TONE =======================================================		; Types		; 0 - Frekles		; 1 - Lips		; 2 - Cheeks		; 3 - Eyeliner		; 4 - Upper Eyesocket		; 5 - Lower Eyesocket		; 6 - SkinTone		; 7 - Warpaint		; 8 - Frownlines		; 9 - Lower Cheeks		; 10 - Nose		; 11 - Chin		; 12 - Neck		; 13 - Forehead		; 14 - Dirt		; Sets the tintMask color for the particular type and index		int rgb = 0		int alpha = 1		int color = Math.LogicalOr(Math.LogicalAnd(rgb, 0xFFFFFF), Math.LeftShift((alpha * 255) as Int, 24))	 	int type = 6 ; SkinTone	 	int index_count = Game.GetNumTintsByType(type)	 	int index = 0	 	while(index < index_count)	 		Game.SetTintMaskColor(color, type, index)	 		index = index + 1	 	EndWhile	 	Game.UpdateTintMaskColors()	 	If SKSE.GetPluginVersion("NiOverride") >= 1	 	 	NiOverride.ApplyOverrides(PlayerActor)	 	 	NiOverride.ApplyNodeOverrides(PlayerActor)	 	Endif

You need to install the NiOverride plugin for SKSE to get this to work.

 

A first round of tests are promising :)

2 Comments


Recommended Comments

After more tests alongside weight changes, I ended up running into repeated crash when I tried to update skin colors.

 

Here is what made it work in the end.

 

It seems that using both 'Game.UpdateTintMaskColors' and 'QueueNiNodeOverride' at the same time is a sure recipe for a crash.

 

What I ended up doing was to first apply all changes to nodes - weight, tint masks and adjustments to breasts, butt and belly - and then, only one call to finalize the changes.

    If SKSE.GetPluginVersion("NiOverride") >= 1
         NiOverride.ApplyOverrides(PlayerActor)
        NiOverride.ApplyNodeOverrides(PlayerActor)
    Endif

    If PlayerActor.IsOnMount()
        ; Game.UpdateHairColor()
        Game.UpdateTintMaskColors()
    Else
        PlayerActor.QueueNiNodeUpdate()
    Endif 

I don't know if 'NiOverride' calls are necessary, but I kept them because of RaceMenu.

 

Same thing with testing for Mount(). I know calling a 'QueueNiNodeUpdate' while mounted messes up the physics, so I kept the test. 

 

I haven't tested if the game still crashes on 'UpdateTintMaskColors' while mounted yet.

Link to comment
Guest kimbale

Posted

Ooooh, i didn't know about the NiOverride stuff for SKSE. Thanks for showing how it can be used!

It just starts to dawn to me what awesome stuff could be done with this...

Link to comment
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use