Jump to content

Detecting when an SL animation has started


Recommended Posts

I want to modify an outfit using Dynamic Armor Variants so that it gets changed when an actor triggers an SL scene.

 

What would be the best way to detect that an actor is starting an SL scene?

 

Another question I have is if theres a way to prevent the piece of armor from getting stripped regardless of the strip settings.

Link to comment
40 minutes ago, wareware said:

What would be the best way to detect that an actor is starting an SL scene?

Register for an AnimationStart event. and put the function in the callback field that you want to run when said event fires.

 

42 minutes ago, wareware said:

Another question I have is if theres a way to prevent the piece of armor from getting stripped regardless of the strip settings.

Assign it the SexLabNoStrip keyword.

Link to comment
14 minutes ago, Taki17 said:

Register for an AnimationStart event. and put the function in the callback field that you want to run when said event fires.

 

I should have been more specific.

 

I want to check it in a way that works for the CK condition checker. I cannot pass functions through it. I did see the Sexlab Animating Faction in the ESM along with a Animation related keyword but I am not sure how those work.

 

Also does the SexLabNoStrip work like SOS_Revealing, as in I don't have to make Sexlab a master?

Edited by wareware
Link to comment

I made a script like that for FTD, to detect if an animation is playing.

 

 

Event Riek(string eventName, string argString, float argNum, form sender)

    bool i
    i = True

    while i == True

        if ( playerref.Isinfaction(SexLabAnimatingFaction) || TheWhore.getactorref().Isinfaction(SexLabAnimatingFaction) )
            debug.notification("actors are animating, can't start the new round. Wait 15 secs before new test")

            utility.wait(15)

        Elseif  (playerref.Isinfaction(SexLabAnimatingFaction) == False && TheWhore.getactorref().Isinfaction(SexLabAnimatingFaction) == False)

            debug.notification("actors are not animating, new round will start after 15 sec delay")

            utility.wait(15)

            i = False

            SexRiekling()
            
        endif

    endwhile
EndEvent

 

 

 

 

Function BlowJobChief(actor theactor)
    actor[] sexActors = new actor[2]   ;its an 2 actor anim
    sexActors[0] = theactor
    sexActors[1] = aFTD_RieklingChiefREF
    sslBaseAnimation[] anims = SL.GetAnimationsByTags(2, "blowjob")  
    RegisterForModEvent("AnimationEnd_Riek", "Riek")   ;this is for hooks.
    SL.StartSex(sexActors, anims, allowbed=false, hook="Riek")   
EndFunction

 

Link to comment
24 minutes ago, wareware said:

I want to check it in a way that works for the CK condition checker. I cannot pass functions through it. I did see the Sexlab Animating Faction

That should work. Afaik any actor that is currently participating in an SL scene is a member of the animating faction while the animation lasts, so it'd be a quick and straightforward way of, say, excluding those actors from certain dialogues.

 

24 minutes ago, wareware said:

Also does the SexLabNoStrip work like SOS_Revealing, as in I don't have to make Sexlab a master?

I'm not aware of how the latter works. But I can confirm that the keyword is part of SexLab as a form. However if you need to check for it in script, you don't need to import Sexlab as a property, you can use the HasKeywordString SKSE function to determine if some form has the keyword you need to check for.

 

13 minutes ago, Delzaron said:

Event Riek(string eventName, string argString, float argNum, form sender)

    bool i
    i = True

    while i == True

        if ( playerref.Isinfaction(SexLabAnimatingFaction) || TheWhore.getactorref().Isinfaction(SexLabAnimatingFaction) )
            debug.notification("actors are animating, can't start the new round. Wait 15 secs before new test")

            utility.wait(15)

This code seems suboptimal, to say the least. You may be better served by removing the while == true loop (the worst offender here) and the wait, and instead when needed, registering for an update every 15 seconds that calls this function, does the check, and does not re-register itself once the condition is met.

Edited by Taki17
Link to comment
10 minutes ago, Taki17 said:

That should work. Afaik any actor that is currently participating in an SL scene is a member of the animating faction while the animation lasts, so it'd be a quick and straightforward way of, say, excluding those actors from certain dialogues.

 

I'm not aware of how the latter works. But I can confirm that the keyword is part of SexLab as a form. However if you need to check for it in script, you don't need to import Sexlab as a property, you can use the HasKeywordString SKSE function to determine if some form has the keyword you need to check for.

 

This code seems suboptimal, to say the least. You may be better served by removing the while == true loop (the worst offender here) and the wait, and instead when needed, registering for an update every 15 seconds that calls this function, does the check, and does not re-register itself once the condition is met.

 

Problem is I don't master at all events stuff.

I was really proud to make tjois one which solve that problem.

 

What do you suggest to improve it ?

Link to comment
24 minutes ago, Delzaron said:

What do you suggest to improve it ?

It may be a bit crude, but I think something along these lines:

Scriptname Example extends Quest

Actor Property playerref Auto
Faction Property SexLabAnimatingFaction Auto
ReferenceAlias Property TheWhore Auto

;used to determine if the actors are available for sex and the new round should start, or if they are unavailable and another check should be made
Bool AreActorsAvailable

;everything that you register an update for will run when an update happens
Event OnUpdate()
    ;actors were determined to be available, start the sex scene
    If AreActorsAvailable
        ;the sex scene will happen
        SexRiekling()     
    ;actors were determined to be unavailable, make another check
    Else
        Riek()
    Endif
EndEvent

Function Riek()
    ;unregister the hook
    UnregisterForModEvent( "AnimationEnd_Riek" )
    ;this event is hooked into the animationend event, so it will fire when the sex scene ended
    ;I assume these are supposed to be safeguards against starting and failing the scene if any of the actor should still be animating
    if ( playerref.Isinfaction(SexLabAnimatingFaction) || TheWhore.getactorref().Isinfaction(SexLabAnimatingFaction) )
        debug.notification("actors are animating, can't start the new round. Wait 15 secs before new test")
        ;actors are not available, set the variable accordingly
        AreActorsAvailable = False
        ;register for an update in 15 seconds - the script will not remain active and will only fire when the 15 seconds have elapsed and a peridic update event happened
        RegisterForSingleUpdate( 15.0 )
    Elseif  (playerref.Isinfaction(SexLabAnimatingFaction) == False && TheWhore.getactorref().Isinfaction(SexLabAnimatingFaction) == False)
        debug.notification("actors are not animating, new round will start after 15 sec delay")
        ;actors are available, set the variable accordingly
        AreActorsAvailable = True
        RegisterForSingleUpdate( 15.0 )
    endif
EndFunction

Function BlowJobChief(actor theactor)
    actor[] sexActors = new actor[2]   ;its an 2 actor anim
    sexActors[0] = theactor
    sexActors[1] = aFTD_RieklingChiefREF
    sslBaseAnimation[] anims = SL.GetAnimationsByTags(2, "blowjob")  
    RegisterForModEvent("AnimationEnd_Riek", "Riek")   ;this is for hooks.
    SL.StartSex(sexActors, anims, allowbed=false, hook="Riek")   
EndFunction 

 

Link to comment

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...

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