Jump to content

Recommended Posts

NO LONGER NEED HELP BUT SEE MY POST BELOW IF YOU ARE HAVING TROUBLE WITH NPC ORGASM DETECTION.

 

I have been writing a script today to detect partner orgasm during consensual sex scenes using SexLab.

 

I just can't work out why my callback event is not working, or how to debug it. I found the comments in SexLabFramework.psc and followed instructions.

 

Here is an abstract of my code:

RegisterForModEvent("PartnersTrack_Orgasm", "OnPartnerOrgasm")
; THIS RUNS AND I HAVE CHECKED IN MCM THAT IT EXECUTES
============================
SexLab.TrackActor(Actors[actors_i], "PartnersTrack")
; THIS RUNS FINE AND I HAVE A SEPERATE LOOP TO UNTRACK ACTOR WHEN NOT NEEDED ALSO WORKING FINE
============================
Event OnPartnerOrgasm(Form FormRef, int tid)
	PrintConsole("DSL: Detected "+(FormRef as Actor).GetDisplayname()+" orgasm.")
    LoseSkills(dslConfig.PartnerOrgasmSkillsGained, "partnerOrgasm")
EndEvent
; THIS DOESN'T RUN ON ORGASM FOR SOME REASON
============================


As you can see above, my problem is that OnPartnerOrgasm never executes. It did on one test but I have no idea why. I have no errors in Papyrus logs. 

 

I'm going to have another crack at it tomorrow but if anyone can help that would be awesome.

Link to comment

Probably a parameter mismatch?

 

assuming you are using the generic modevent, rather than a self-defined, the engine would expect the this:

 

For the modevent Call:

 

Form.SendModEvent(string eventName, string strArg, float numArg)      / yellow being optionals

 

and the callback Event would have to look like this:

Event OnPartnerOrgasm(string eventName, string strArg, float numArg, Form sender)

      ;Do Stuff

EndEvent

Link to comment
5 hours ago, Pamatronic said:

Probably a parameter mismatch?

 

assuming you are using the generic modevent, rather than a self-defined, the engine would expect the this:

 

For the modevent Call:

 

Form.SendModEvent(string eventName, string strArg, float numArg)      / yellow being optionals

 


and the callback Event would have to look like this:

Event OnPartnerOrgasm(string eventName, string strArg, float numArg, Form sender)

      ;Do Stuff

EndEvent

Nah, thanks though. The mod event is supposed to be sent by SexLab but it wouldn't work for whatever reason.

 

Fortunately SexLab also provides a non-hook event which works fine for me.

 

If anyone else has same issue see below SexLabFramework.psc:

;#   SexLabOrgasm - Sent when an actor has an orgasm. The parameters of the event are: the actor, the enjoyment, and the num of orgasms    # 

 

You can use this as such: 

 

RegisterForModEvent("SexLabOrgasm", "OnSexLabOrgasm") ; Where "OnSexLabOrgasm" is your event.

 

event OnSexLabOrgasm(Form FormRef, int enjoyment, int number_of_orgasms)
    ;Debug.MessageBox((FormRef as Actor).GetDisplayname() + " had orgasm. Total orgasms: " + number_of_orgasms + ". Enjoyment: " + enjoyment)
    sslThreadController Thread = SexLab.GetActorController(FormRef as Actor)
    if Thread == SexLab.GetPlayerController()
        ;Detected orgasm in player scene.
    else
        ;Detected orgasm but player isn't in scene, returning.
        return
    endif
    if playerRef == FormRef as Actor
        ;Detected player orgasm
    else
        ;Detected another actor in player scene orgasm
    endif
endevent

 

Link to comment
On 9/12/2020 at 10:06 PM, RMCW said:

 


SexLab.TrackActor(Actors[actors_i], "PartnersTrack")
; THIS RUNS FINE AND I HAVE A SEPERATE LOOP TO UNTRACK ACTOR WHEN NOT NEEDED ALSO WORKING FINE

 

As a suggested possibility as to why TrackActor() is failing. You have to start tracking the actor BEFORE a scene is setup. Once an animation scene is setup, as part of the startup process it caches whether or not the actor is tracked. So if TrackActor() is called on an active scene, it's to late as sexlab has already done it's checks for whether or not the actor should be sending tracked events or not.

 

That's my best guess as to why it's failing in any case. Without seeing the full code it's hard to say more.

 

Also as a side note. If you only care about the player in this case, the player is ALWAYS set to be tracked with a special "PlayerTrack_<Hook>" event.

RegisterForModEvent("PlayerTrack_Orgasm", "OnPlayerOrgasm")

event OnPlayerOrgasm(Form FormRef, int tid)
	; // Player orgasm detected
endEvent

 

 

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