Jump to content

Creating Sexlabframework plug-in to stun after animation


Recommended Posts

Posted

I'm using MO2.

Eagdoll Ending is not working.So l wrote this script .

 

Scriptname SexLabKnockoutHandler extends Quest  

SexLabFramework Property SexLab Auto

Event OnInit()
    RegisterForModEvent("SexLabOrgasmEnd", "OnSexEnd")
EndEvent

Event OnSexEnd(string eventName, string argString, float argNum, Form sender)
    Actor[] participants = SexLab.GetActors()
    if participants == None
        return
    EndIf

    int rndTime = Utility.RandomInt(10, 20)
    float knockTime = rndTime as float
    int i = 0
    while i < participants.Length
        Actor akActor = participants
        if akActor != None && akActor.IsDead() == False
            if akActor.GetSex() == 1
                akActor.PushActorAway(akActor, 0.1) 
                akActor.SetUnconscious(True)
                Utility.Wait(knockTime)
                akActor.SetUnconscious(False)
            endif
        endif
        i += 1
    endwhile
EndEvent
 

 

I tried to compile this script using the Creation Kit.

I launched the Creation Kit, opened File → Data, checked Skyrim.esm, Update.esm, and SexLab.esm, and set a new empty ESP file as the active file.

but it failed with the following log:

 

Starting 1 compile threads for 1 files...
Compiling "SexLabKnockoutHandler"...
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\SexLabKnockoutHandler.psc(3,25): unknown type sexlabframework
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\SexLabKnockoutHandler.psc(6,4): RegisterForModEvent is not a function or does not exist
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\SexLabKnockoutHandler.psc(10,34): sexlabframework is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\SexLabKnockoutHandler.psc(23,23): GetSex is not a function or does not exist
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\SexLabKnockoutHandler.psc(23,32): cannot compare a none to a int (cast missing or types unrelated)
No output generated for SexLabKnockoutHandler, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on SexLabKnockoutHandler

 

 

 

How can I compile it?

Posted (edited)
14 minutes ago, katchan10025890 said:

C:\Program Files (x86)\...

 

Bad place to put anything mod-related.

 

14 minutes ago, katchan10025890 said:

unknown type sexlabframework

 

Make sure sexlabframework.psc (and all other SL scripts) are inside the folder path it is looking for.  Says "temp", but it likely isn't there unless you specifically copy-pasted it.

 

14 minutes ago, katchan10025890 said:

RegisterForModEvent is not a function

 

Same as above with SKSE's script files.

 

Also minor quibble:  Event "OnSexEnd()" is way too generic.  RegisterForModEvent looks for any and all events with that name, not just within your mod or script.

Edited by Seijin8
Posted (edited)
6 hours ago, katchan10025890 said:

I'm using MO2.

You already answered Your question, You pretty much cant...

I mean... You can... but You need to go all around with everything...

 

The errors You are getting are related to the fact that Compiler is separate app used by CreationKit...

While You run CK via MO2, CK have access to virtual build instance made by MO2, but when You try to compile script via CK, CK tries to refer to

PapyrusAssembler and PapyrusCompiler that are inside "Papyrus Compiler" folder relative to the "Data" folder...

 

However when CK calls PapyrusAssembler the Assembler does not inherit the virtual instance cretead by MO2, so it looks at absolute path and founds no scripts

From perspective of MO2 and CK, scripts do exists because they two do have access to virtual instance

From perspective of Papyrus Compiler they dont...

 

Now what to do to make it work?

 

Well... You simply have to manually pull out all the script files from MO2 Instances and drop them directly to Your Data folder in absolute location so Compler can see them...

 

1) Go to:

...\ModOrganizer\mods\SexLabFrameworkAE_v\scripts\Source

 

Copy all the files to:

...\SteamLibrary\steamapps\common\Skyrim Special Edition\Data\Scripts\Source

 

Once PapyrusCompiler and PapyrusAssembler can see required files... they will be able to compile them...

 

Enjoy modding with CK via MO2, its fun, especially with scripts ( CK with MO2 causes more problems btw. editing Forms inside ESP is relatively safe tho )

 

 

Btw.

I'm just gonna tell You fun fact,

If You go into Gameplay -> Scripts in CK while running via MO2, and You create new script

the script source will be added to where You pointed MO2 to overwrite, not in Your Data Folder so Compiler can see it

so every time You add new folder You will have to copy files from ur MO2 Mod back to original Data Folder

 

One way to fix that is by doing sym links via mklink command on Windows, so Windows PapyrusCompiler can see files in other folder like they would be in the source folder...

 

I hope that You also did set MO2 to overwrite files in Your Mod... after creating Empty Mod in MO2...

Well... MO2 Modders are fun, I too myself use MO2 but I use it mainly for running game... not running CK via MO2...

 

//Edit:

You could maybe try that mod:

https://www.nexusmods.com/skyrimspecialedition/mods/23852

 

I have never tried that so I dont know if it will fix the issue... but well... it will not hurt to try :P

 

//Edit2:

Also.... yee Im returning after 20 minutes or so :P

Your code have logic issue:

    while i < participants.Length
        Actor akActor = participants
        if akActor != None && akActor.IsDead() == False
            if akActor.GetSex() == 1
                akActor.PushActorAway(akActor, 0.1) 
                akActor.SetUnconscious(True)
                Utility.Wait(knockTime)
                akActor.SetUnconscious(False)
            endif
        endif
        i += 1
    endwhile

 

Lets say that there was 3 actors, DP played and it ended, now ur script recive event call and what happens?

1) Player gets pushed away, he gets set unconscious, game wiat lets say 5 seconds and set conscious to player

2) Actor 1 gets pushed away, game wait 5 seconds and after another 5 seconds there is turn of third actor

 

You using Utility.Wait() after knocking out 1 actor and wait before You knock another...

It should be more of:

Int i = 0
While( i < participants.Lenght )
	Actor akActor = Participants[ i ]
	If( ( akActor ) && ( !akActor.IsDead() ) )
		akActor.PushActorAway( akActor, 0.1 )
		akActor.SetUnconscious( True )
	EndIf
	i ++
EndWhile
Utility.Wait( knockTime )
While( i < participants.Lenght )
	Actor akActor = Participants[ i ]
	If( ( !akActor.IsDead() ) )
		akActor.SetUnconscious( False )
	EndIf
	i ++
EndWhile

 

You want to first knock all actors, then wait x time, then unknock them all...

Because Your current code is imply waiting x time after every actor before going to the next actor :x...

 

    int rndTime = Utility.RandomInt(10, 20)
    float knockTime = rndTime as float

 

Also this part, its very bad idea to cast types between in Papyrus, especially if there are alternatives...

Creation Engine is not very well made engine, and the engine can have NULL pointer error or Out of bounds error sometimes while casting types...

It's not happening every time, but every time You cast types You have about 0.1% chance for CTD for just being lucky...

 

You can use Utility.RandomFloat() instead

 

Bethesda cant really write type cast properly :P

Instead of using Utility.RandomInt( 10 , 20 ) and then casting it, just do Utility.RandomFloat( 10.0 , 20.0 )

This could ofc. produce values like for example 13.3 But I dont think it will be big issue compared to random CTD because of Engine failing to cast type

Tho SSE can recover from that issue ( thats one of the reason why SSE crashes less than LE ) but its not a rule, just a bit better code

After all Bethesda have bugs and issues in their Engine that they are aware of for 20 years and not fixing them...

Edited by ̖̪.

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