Jump to content

vinfamy

Recommended Posts

This guide briefs modders on how to convert Oldrim SexLab mods to SSE using SexLab Light SE instead, depending on what feature(s) of SexLab the original mod uses. The API of SexLab was kept as intact as possible so conversion shouldn't be too much work.

 

The phrase "the mod" from now on refers to the mod being converted.

 

Note that this guide focuses entirely on how to make the mod work with SexLab Light SE. It's possible that the mod uses SKSE directly, in which case other workarounds may need to be implemented, an alternative MCM for example.

 

1. If the mod uses none of the below:

  • Then it's possible that the mod will work right away with SSE and SexLab Light SE without conversion
  • Mods like Amorous Adventures, SexLab Solutions and Spouses Enhanced are like this
  • However, it's good practice to open up the esp in the SE CK and resave in the new esp format.

2. If the mod uses BSA archive:

3. If the mod uses SexLab animation tags:

  • Namely if the mod uses the following function: 

sslBaseAnimation[] function GetByTags(int ActorCount, string Tags, string TagsSuppressed = "", bool RequireAll = true)

  • If the mod only asks for one tag each for Tags and TagsSuppressed like:

sslBaseAnimation[]  Anims = AnimSlots.GetByTags(2, "Blowjob", "Aggressive", true)

  • then there's nothing to change. It will work fine. However, if the mod asks for multiple tags like:

sslBaseAnimation[]  Anims = AnimSlots.GetByTags(2, "Blowjob, Leito", "Aggressive, Necro, Sleeping", true)

  • It won't work properly as vanilla Papyrus isn't capable for spiting a single string into an array with the commas. You'll have to pass arrays of string into the following function instead:

sslBaseAnimation[] function GetByMultipleTags(int ActorCount, string[] Search, string[] Suppress, bool RequireAll = true)

  • For example:

String[] Search = new String[2]

Search[0] = "Blowjob"

Search[1] = "Leito"

 

String[] Suppress = new String[3]

Suppress[0] = "Aggressive"

Suppress[1] = "Necro"

Suppress[2] = "Sleeping"

 

sslBaseAnimation[]  Anims = AnimSlots.GetByMultipleTags(2, Search, Suppress, true)

  • If you want no tags to be suppressed, do this instead:

sslBaseAnimation[]  Anims = AnimSlots.GetByMultipleTags(2, Search, new String[1], true)

  • Same deal with creatures:

sslBaseAnimation[] function GetByRaceTagsMultiple(int ActorCount, Race RaceRef, string[] Search, string[] Suppress, bool RequireAll = true)

 

sslBaseAnimation[] function GetByRaceKeyTagsMultiple(int ActorCount, string RaceKey, string[] Search, string[] Suppress, bool RequireAll = true)
 

4. If the mod uses SexLab Hooks

  • This will require the most effort to convert, as ModEvents are simply not available without SKSE
  • First, make a new keyword. Name it whatever.
  • While calling for sex, use the below instead to set up your hook

sslThreadModel Thread = SexLab.NewThread()

Thread.SetHookKeyword(TheKeywordYouJustCreated)

  • Then make a new quest, name it whatever, untick "Run Once" and "Start Game Enabled". In the "Event" dropdown list, select Script Event. OK
  • Character > SM Event > Script (Don't worry, you're not editing vanilla records, you're simply adding a new record) > Make a new branch, select the quest you just made with the condition as seen in the image below. 

post-1091843-0-60093800-1504013509_thumb.jpg

  • Go back into the quest you just made > Scripts> Make a new script that looks something like this (taken from MatchMaker SE):
Scriptname sslMatchMakerHook extends Quest  
 
sslMatchMaker property MatchMaker auto
Keyword property MatchMakerKeyword auto
 
Event OnStoryScript(Keyword akKeyword, Location akLocation, ObjectReference akRef1, ObjectReference akRef2, int aiValue1, int aiValue2)
   If akKeyword == MatchMakerKeyword
      if aiValue1 == 2; "AnimationEnd"
         MatchMaker.AnimationEnd(aiValue2, akRef1 == Game.getPlayer()); send it back from this dummy listening quest to your main script
      Endif
      Stop(); otherwise you'll listen to only one story event and that's it
   Endif
endEvent
  • In that OnStoryScript event, akKeyword is the keyword you passed in SetHookKeyword, akLocation is not used, akRef1 returns the player object reference if the player is involved in the sex scene, akRef2 is not used, aiValue2 is the thread ID, and most importantly, akRef1 is the index number of the SexLab hooks as listed below:

                  0: "AnimationStart"

                  1: "AnimationEnding"

                  2: "AnimationEnd"

                  3: "LeadInStart"

                  4: "LeadInEnd"

                  5: "StageStart"

                  6: "StageEnd"

                  7: "OrgasmStart"

                  8: "OrgasmEnd"

                  9: "AnimationChange"

                  10: "PositionChange"

                  11: "ActorsRelocated"

                  12: "ActorChangeStart"

                  13: "ActorChangeEnd"

  • For a working example, load up MatchMaker Light SE in the CK > Quest > SexLabMatchMakerHook. Also look at Character > SM Event > Script > MatchMakerHook. Finally, read sslMatchMaker.psc, line 93 
  • New in 0.1.1: I added a global hook using the keyword SexLabGlobalHook stored in SexLab.esm (just replace the keyword condition in the screenshot above) if you want to listen for events during sex scenes triggered by all mods, not just yours. 

Have fun converting! :)

 

Link to comment

I took a look at the scripts. My personal need is to not only hook OrgasmEnd, but to identify the type of sex (ie. vaginal for purposes of conception). Presently I have two questions:

 

1. For mods that continue to support SexLab in Oldrim and SexLab SE, did the version change and will it be independent? My ideal is being compatible with both, if possible, should SKSE64 release and Ashal's SexLab become fully supported in SSE. My scripts are also largely compile and go regardless of LE or SSE, and if I can avoid separate scripts that would be nice. ;)

 

2. When hooking orgasm events, I don't see any clean way of determining the sex act in question, which is relevant to my mod (that's an issue I had to resolve with Flower Girls). There are keywords suggesting the cum status, but nothing triggered in the events I can see after a quick look. In SexLab LE, I used vaginal and creampie tags, is there a corresponding method in SE?

Link to comment

 

 

If you use hooks and / or multiple tags seperated by commas then your LE and SE versions will need to be slightly different. There's simply no ModEvent and SpringSplit without SKSE. If you want a mod that's compatible with both without editing any scripts, you'll have to avoid hooks and avoid passing multiple strings separated by comma.

 

I don't see how you get less from the hooks system here than SexLab Oldrim. Oldrim SexLab hooks returns a bool HasPlayer and an int ThreadID. OnStoryEventScript returns the Player ObjectReference if player's involved and the thread ID so surely you can use that threadID to manipulate whatever you want?

 

" I used vaginal and creampie tags, is there a corresponding method in SE?"

 

I need to see your code in LE to understand how it would work in SE.

Link to comment

I need to see your code in LE to understand how it would work in SE.

 

Can do.  The entirety of my SexLab hook in LE is as follows:

event OnSexLabOrgasm(String hookName, String argString, float argNum, Form sender)
{Catch relevant orgasm events from SexLab if it's installed}
	SexLabFramework SexLab = Game.GetFormFromFile(0x00000D62, "SexLab.esm") as SexLabFramework
	Actor[] actorList = SexLab.HookActors(argString)
	Actor femaleTarget = none
	Actor maleTarget = none
	int i = 0
	
	while (i < actorList.Length)
		if (femaleTarget == none && actorList[i] != none && actorList[i].GetActorBase().GetSex() == 1)
			femaleTarget = actorList[i]
		elseIf (maleTarget == none && actorList[i] != none && actorList[i].GetActorBase().GetSex() == 0)
			maleTarget = actorList[i]
		endIf
		
		i += 1
	endWhile
	
	if (femaleTarget == none || maleTarget == none)
		; Must have both a male and a female
		return
	endIf
	
	DebugNotif("BPC: Running SexLab orgasm event for target " + femaleTarget.GetFormID())

	sslBaseAnimation animation = SexLab.HookAnimation(argString)

	; Extremely simple check, but functional for the most part
	if (animation.HasTag("Vaginal") || animation.HasTag("Creampie") || animation.HasTag("VaginalCum"))
		; Add sperm to the first female found in the actor list
		AddSperm(femaleTarget)
	endIf
endEvent 

My  concern is the last part where the tags are checked for relevant animations.  As I understand with the new hooks, just about all of that can be replaced easily except for the verification of vaginal sex tags.  While *any* orgasm event is better than nothing, orgasm events tied to a scene that could be related to conception is my ideal.  This is a similar problem I had with Flower Girls; though in that case there were scene variables that I could check to specify when a suitable vaginal scene occurred.

Link to comment

Event OnStoryScript(Keyword akKeyword, Location akLocation, ObjectReference akRef1, ObjectReference akRef2, int aiValue1, int aiValue2)
If akKeyword == HookKeyword && aiValue1 == 8 ;"OrgasmEnd" event
int ThreadID = aiValue2

sslBaseAnimation animation = SexLab.GetController(ThreadID).Animation

if (animation.HasTag("Vaginal") || animation.HasTag("Creampie") || animation.HasTag("VaginalCum"))

AddSperm(femaleTarget)

Endif

Endif

endEvent 

 

 

something like that

Link to comment

Well now I feel like a dumdum. It didn't occur to me that HasTag would still work. ;)

 

On a side note, I'm not triggering sex in my mod, I'm catching events from any sex that would be triggered from other mods. So hooking my own keyword won't accomplish much. Off the top of my head, the only thing I can think of other than patching for every possible sex mod and including their keywords would be to poll SexLab for IsRunning and hook my keyword then, but that strikes me as a very inefficient approach. Is there a better way?

Link to comment

Well now I feel like a dumdum. It didn't occur to me that HasTag would still work. ;)

 

On a side note, I'm not triggering sex in my mod, I'm catching events from any sex that would be triggered from other mods. So hooking my own keyword won't accomplish much. Off the top of my head, the only thing I can think of other than patching for every possible sex mod and including their keywords would be to poll SexLab for IsRunning and hook my keyword then, but that strikes me as a very inefficient approach. Is there a better way?

 

Good point. I'll add a central hook  Keyword to SexLab.esm that's sent for every events in every sex scenes in the next version so that mods like yours can use.

Link to comment
  • 2 weeks later...

 

Well now I feel like a dumdum. It didn't occur to me that HasTag would still work. ;)

 

On a side note, I'm not triggering sex in my mod, I'm catching events from any sex that would be triggered from other mods. So hooking my own keyword won't accomplish much. Off the top of my head, the only thing I can think of other than patching for every possible sex mod and including their keywords would be to poll SexLab for IsRunning and hook my keyword then, but that strikes me as a very inefficient approach. Is there a better way?

 

Good point. I'll add a central hook  Keyword to SexLab.esm that's sent for every events in every sex scenes in the next version so that mods like yours can use.

 

 

Added in SexLab Light SE 0.1.1. Added a sentence to Section 4 above.

Link to comment

I've got the hook firing nicely, but one of my needs is retrieving the actors involved in the animation to check genders and apply sperm. Previously I had used HookActors on the SexLabFramework object, but that doesn't seem to work anymore, and the keyword event only seems to pass the player as akRef1 while akRef2 is always none. Do you have any suggestions since you're vastly more familiar with the available functions? :)

Link to comment

Ugh, I could have sworn I tried that.  The SexLab API takes some time to getting used to for me, and it could be that I dig into the code before trying to write something. Chalk down a couple of hours wasted going down false paths before reaching out for help. ;)

 

I now have something functional for proper testing. Thanks so much! We can add Basic Pregnancy Cycle to the list of supported mods by end of day.

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

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