Jump to content

[Solved] Registering custom Sexlab Animation [Scripting]


Recommended Posts

Posted (edited)

Hey,

For a small project I'm working on, I made a custom SexLab animation that I want to register using scripts, something I've done previously in LE.

However, even though I'm using the same code with minor alterations (and I cross-checked with DDC's script that registers SexLab furniture animations, and which I more or less copied), mine refuses to play in-game.

By refuses to play in game I mean it does not show up in the SexLab animation list and when I try to get the animation by name it can't be found and defaults back to another one. 

Code:
 

Spoiler
Scriptname GoOn_SexLab_Anims extends sslAnimationFactory  

GoOn_Libs Property GLibs Auto
SexLabFramework Property SexLab Auto

function LoadAnimations()
    Debug.Notification("Registering SL Anims")
    Debug.Trace("GoOn is registering it's animations now", aiSeverity = 0)
    SexLab = SexLabUtil.GetAPI()

    If SexLab == None
        Debug.Trace("Animation registration failed: Sexlab is none.", aiSeverity = 2)
        Return
    EndIf
    SexLab.GetSetAnimationObject("GoOnLesbianFingerplay01", "CreateLesbianFingerplay01", GLibs)


    Debug.Notification("Finished Registering Animations")
EndFunction


Function CreateLesbianFingerplay01(int id)
    String asAnim1 = "FF_Fingerplay01"

    sslBaseAnimation Anim = Sexlab.GetAnimationObject("GoOnLesbianFingerplay01")

    if Anim != none && Anim.Name != "GoOnLesbianFingerplay01"
        Debug.Notification("Setting Anim: GoOnLesbianFingerplay01")
        Anim.Name = "GoOnLesbianFingerplay01"
        Anim.SetContent(Sexual)
        Anim.SoundFX = None

        Int B = Anim.AddPosition(Female)
        Anim.AddPositionStage(B, asAnim1 + "_A1_S1")
        Anim.AddPositionStage(B, asAnim1 + "_A1_S2")
        Anim.AddPositionStage(B, asAnim1 + "_A1_S3")

        Int A = Anim.AddPosition(Female)
        Anim.AddPositionStage(A, asAnim1 + "_A2_S1")
        Anim.AddPositionStage(A, asAnim1 + "_A2_S2")
        Anim.AddPositionStage(A, asAnim1 + "_A2_S3")

    
        Anim.AddTag("DomSub")
        Anim.AddTag("NoSwap")

        Anim.Save(id)
    EndIf
EndFunction

 

 

The way this code get's called then is by the GLibs scripts CheckUpdate function which in turn get's called when the player loads into game. 

 

Lastly I want to mention that all debug messages get tripped, so I am not exactly sure where it fails. 

Edited by Prime66
Posted (edited)

Why not do it the way SL itself does it in sslAnimationDefaults and sslAnimationFactory; or better yet, why not use SLAL?

 

sslAnimationSlots property Slots auto hidden

int id = Slots.Register(Registrar)
if id != -1
	sslBaseAnimation Slot = Slots.GetBySlot(id)
	Slot.Initialize()
	Slot.Registry = Registrar
	Slot.Enabled  = true
	
	...
	
	int a1 = Base.AddPosition(...)
	Base.AddPositionStage(a1, ...)
	...
endIf
Edited by traison
Posted

Thanks for the speedy response. To answer your questions, I actually tried doing it just like it's done in SexLab, but it still wasn't working, so I reverted to what used to work for me.

However, I did try again just now without any luck. The same goes for the example you provided, unless, of course, I cocked something up. :grimace:

 

If you would take another look, I would be greatly appreciative.

 

Spoiler
Scriptname GoOn_SexLab_Anims extends sslAnimationFactory  

GoOn_Libs Property GLibs Auto
SexLabFramework Property SexLab Auto

function LoadAnimations()
	Debug.Notification("Registering SL Anims")
	Debug.Trace("GoOn is registering it's animations now", aiSeverity = 0)
	SexLab = SexLabUtil.GetAPI()

	If SexLab == None
		Debug.Trace("Animation registration failed: Sexlab is none.", aiSeverity = 2)
		Return
	EndIf
	;SexLab.GetSetAnimationObject("GoOnLesbianFingerplay01", "CreateLesbianFingerplay01", GLibs)

	RegisterAnimation("CreateGoOnFingerplay01")

	Debug.Notification("Finished Registering Animations")
EndFunction


Function CreateGoOnFingerplay01(int id)
	; int idd = Slots.Register("GoOnLesbianFingerplay01")
	; If id != -1
		;sslBaseAnimation Anim = Slots.GetBySlot(idd)
		sslBaseAnimation Anim = Create(id)
		;Anim.Initialize()
		;Anim.Registry = "GoOnLesbianFingerplay01"
		;Anim.Enabled = True

		Debug.Notification("Setting Anim: GoOnFingerplay01")
		Anim.Name = "GoOnFingerplay01"
		Anim.SetContent(Sexual)
		Anim.SoundFX = None

		Int B = Anim.AddPosition(Female)
		Anim.AddPositionStage(B, "FF_Fingerplay01_A1_S1")
		Anim.AddPositionStage(B, "FF_Fingerplay01_A1_S2")
		Anim.AddPositionStage(B, "FF_Fingerplay01_A1_S3")

		Int A = Anim.AddPosition(Female)
		Anim.AddPositionStage(A, "FF_Fingerplay01_A2_S1")
		Anim.AddPositionStage(A, "FF_Fingerplay01_A2_S2")
		Anim.AddPositionStage(A, "FF_Fingerplay01_A2_S3")

	
		Anim.AddTag("DomSub")
		Anim.AddTag("NoSwap")

		Anim.Save(id)
	;EndIf
EndFunction

 

 

As you can see, what I currently have enabled is how animations are registered in the sslAnimationDefaults script, and commented out is what you suggested. I was unsure about the ID and the registrar variable we supply to the animation, which could very well be where I made a mistake.

 

As for why not just use SLAL, I actually have a few reasons, but the main one is I made the animation specifically for a scene I am working on, so having to manually enable the animation via an MCM before I can use it in-game is just not something I want to do. :)

Posted (edited)

You're missing the call to PrepareFactory() in function LoadAnimations().

 

Edit: You can probably see this in the Papyrus log too.

Edited by traison
Posted

Thank you very much :) 

 

I had assumed the PrepareFactory() function is something only Sexlab is supposed to run. It works!

Now begins the fun process of making the animation align properly 😄

 

Thank you again. 

 

 

For everyone else that maybe needs it this is the currently working code. 

 

Spoiler
Scriptname GoOn_SexLab_Anims extends sslAnimationFactory  

GoOn_Libs Property GLibs Auto
SexLabFramework Property SexLab Auto

function LoadAnimations()
	Debug.Trace("GoOn is registering it's animations now", aiSeverity = 0)
	SexLab = SexLabUtil.GetAPI()

	If SexLab == None
		Debug.Trace("Animation registration failed: Sexlab is none.", aiSeverity = 2)
		Return
	EndIf
	
	PrepareFactory()

	RegisterAnimation("CreateGoOnFingerplay01")
EndFunction


Function CreateGoOnFingerplay01(int id)
	sslBaseAnimation Anim = Create(id)
	
	Anim.Name = "GoOnLesbianFingerplay01"
	Anim.SetContent(Sexual)
	Anim.SoundFX = None

	Int B = Anim.AddPosition(Female)
	Anim.AddPositionStage(B, "GoOnFingerplay01_A1_S1")
	Anim.AddPositionStage(B, "GoOnFingerplay01_A1_S2")
	Anim.AddPositionStage(B, "GoOnFingerplay01_A1_S3")

	Int A = Anim.AddPosition(Female)
	Anim.AddPositionStage(A, "GoOnFingerplay01_A2_S1")
	Anim.AddPositionStage(A, "GoOnFingerplay01_A2_S2")
	Anim.AddPositionStage(A, "GoOnFingerplay01_A2_S3")

	
	Anim.AddTag("DomSub")
	Anim.AddTag("NoSwap")

	Anim.Save(id)
EndFunction

 

 

  • Prime66 changed the title to [Solved] Registering custom Sexlab Animation [Scripting]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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