Jump to content

Trouble detecting the end of sex scene


Recommended Posts

I am having some trouble in setting up a RegisterForModEvent to detect the end of a SexLab scene so I can have it move on to the next stage of my quest. The scene itself plays out fine from start to finish but my event is never triggered. I have been going through both the API and the scripts trying to figure out what I am missing. I think I may have the incorrect event name from the end of the sexlab scene but at thins point I am not sure what I have wrong.

 

This is the portion of the script running the scene and the event it is supposed to trigger:

 

 

Function StartElenwenOral() ;start sex with Elenwen

sexlab.newthread(20)
actor[] sexActors = new actor[2]
sexactors[0] = Playerref
sexactors[1] = ActorElenwen
 
sslBaseAnimation[] anims
anims = SexLab.GetAnimationsByTag(2, "lesbian", "oral")
 
sexlab.startsex(sexactors, anims, centeron = PosElenwenSol02, allowbed = false)
 
RegisterforModEvent("OnSexLabAnimationEnd", "CheckElenwenDone")
Endfunction
 
Event CheckElenwenDone()
if quest02.getstage() == 165
quest02.setstage(170)
UnregisterForModEvent("StartElenwenOral")
debug.notification("Elenwen wants more")
elseif quest02.getstage() == 175
quest02.setstage(180)
UnregisterForModEvent("StartElenwenOral")
debug.notification("Elenwen is finished")
endif
DisablePlayerControl()
Endevent

 

I have tried a number of different things in the RegisterForModEvent such as AnimationEnd and EndAnimation and a few others but nothing has worked, the stage is still the same as it was when the sexlab scene was triggered. If I advance the stage using the console the scene I am building continues as it should.

 

This is the papyrus log from the last run through ending once the sexlab scene ends and doesn't trigger the next stage: Papyrus.0.zip

 

 

 

 

 

Link to comment

At the moment if you call startSex() without specifying your own hook, you'll be registering for every SL scene that's happening, so you'd need to check in your receiving event that the actors are correct for example. I recommend starting it with a hook specified, which makes SL to send a mod event specific to that scene with the hook string added to the mod event name.

 

 

RegisterForModEvent("HookAnimationEnd_Elenwen", "CheckElenwenDone")

sexlab.startsex(sexactors, anims, centeron = PosElenwenSol02, allowbed = false, hook = "Elenwen")
 
Without specifying the hook paramater, you'd listen to "HookAnimationEnd" event.
 
 
Then you need the correct parameters in your receiving event:
 
Event CheckElenwenDone(int threadID, bool hasPlayer)
    UnregisterForModEvent("HookAnimationEnd_Elenwen")
    ; Your stuff here
EndEvent
 
Now that event is only called for that specific SL scene and you don't need to use the threadID to fetch the animation list from SL for example to check it's the right scene.
 
Also, since you're using startSex(), you don't need newThread() in there. That's used if you manually build the thread for more settings, as it returns a new thread you can use, which is ignored at the moment. StartSex() does all that for you for simpler usage.
 
Edit, apparently the forums lose half of my post if I surround the first code bit in code or quote tags >.>
Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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