Jump to content

How to detect sex scene end so I can call setstage?


Recommended Posts

Posted

Here's what I have so far:

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 1
Scriptname TIF__1001EFB1 Extends TopicInfo Hidden

;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
;(Player Pitcher)
actor[] sexActors = new actor[2]
sexActors[0] = akSpeaker
sexActors[1] = Game.GetPlayer()
sslBaseAnimation[] anims
anims = SexLab.GetAnimationsByTag(2, "Leito, Kissing",tagSuppress="Fisting")
SexLab.StartSex(sexActors, anims, none, none, false, "MySLHook")
;END CODE
EndFunction
;END FRAGMENT

Event MySLEvent()
    ContinueCycle()
EndEvent

Function ContinueCycle()  
    GetOwningQuest().SetStage(36)
EndFunction

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

SexLabFramework Property SexLab auto

 

Can anyone tell me what I am doing wrong?

Posted

As a habit don't stick your function definitions in the Topic Info scripts

 

Read up on Hooks in Sexlabframework.psc(Your "MySLHook" part of the sexlab function call) and how to use events through them

 

 

Posted
16 minutes ago, wareware said:

As a habit don't stick your function definitions in the Topic Info scripts

 

Read up on Hooks in Sexlabframework.psc(Your "MySLHook" part of the sexlab function call) and how to use events through them

 

 

I did look it up and came up with this. Can't you or anyone just give me a version of this script that will work. I can take it from there once I understand.

Posted

Well it is better to write the code yourself so you can understand better. For an example, here is an example code from SexLabFramework that I modify a bit so it can be understood better

 

Spoiler

SETTING AND USING HOOKS, A QUICK EXAMPLE.                                                                                                 
Imagine that you want to do something when a SexLab animation that you are starting, will end.                                            
To do that you can define your hook, set it to the Thread, register for the AnimationEnd event, and execute the code you want.            
 
========   

                                                                                                                                     
SexLab.StartSex(sexActors, anims, none, none, false, "MySLHook")  Replaced below

 

sslThreadModel Thread = SexLab.NewThread()                               <-- get a SexLab Thread

Thread.SetAnimations(anims)                                        <-- add the animations
Thread.AddActor(akSpeaker)                                              <-- add the first actor to the Thread                          
Thread.AddActor(Game.GetPlayer())                                             <-- add the second actor to the Thread                         
Thread.SetHook("MySLHook")                                                <-- Define your Hook name                                      
RegisterForModEvent("HookAnimationEnd_MySLHook", "myAnimEndEventHandler") <-- Register for the event you want REALLY IMPORTANT!                 
Thread.StartThread()                                                     <-- Start the SexLab animation and forget.
                                                                                                                                        
       <elsewhere in your script>                                                                                                       
                                                                                                                                        
Event myAnimEndEventHandler(int tid, bool HasPlayer)                     <-- This function we registered for will trigger automatically 
   sslThreadController Thread = SexLab.GetController(tid)                <-- Use the tid parameter to get the thread instance. It can   
   Actor[] Positions = Thread.Positions ;[firstActor, secondActor]           manipulate or access different information from the scene. 
EndEvent

 

================                                                                                                                               

 

Posted (edited)

in one of my own mods i just have the dialogue cast a spell and then do everything with the spell's script:
 

Spoiler

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 1
Scriptname aaaSLD_Dialogue_Sex_7FatalVore Extends TopicInfo Hidden

;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
akSpeaker.DoCombatSpellApply(aaaSLDFatalVoreSexSpell, PlayerRef)
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

Actor Property PlayerRef Auto
Spell Property aaaSLDFatalVoreSexSpell Auto

 

 

 

-------the spell script (likely way more complicated than what you need)--------

 

 

Scriptname aaaSLD_Spell_Sex_FatalVore extends activemagiceffect  
;used to start HCOS vore animations and apply fatal digestion effects when they end

Actor Property PlayerRef Auto
Actor Property aaaBoziilahRef Auto
Actor Property DLC1DurnehviirRef Auto
Actor Property aaaAlduinFollowerRef Auto
Actor Property aaaFemAlduinFollowerRef Auto
Faction Property SexLabAnimatingFaction Auto
aaaSLD_System property aaaDragonFollowerQuest Auto
SexLabFramework property SexLab Auto 
Actor Dragon
Actor Food
Spell Property aaaSLDFatalVoreEndingSpell Auto
VisualEffect Property aaaFXVoreDeathCam Auto
VisualEffect Property aaaFXVoreAcidPartA Auto
VisualEffect Property aaaFXVoreAcidPartB Auto
VisualEffect Property aaaFXUnbirthDeathCam Auto
VisualEffect Property aaaFXAnalDeathCam Auto
GlobalVariable Property aaaSLD_EnableDeathMessages auto
int Property DragonSex = 0 auto hidden
int Property VoreAnimationSet auto ; 0=OralVore 1=FeetFirstFemalePlayerOralVore 2=AnalVore&Unbirth

Event OnEffectStart(Actor aktarget, Actor akCaster)
	Dragon = akCaster
	Food = aktarget
	DragonSex = Dragon.GetLeveledActorBase().GetSex()
	Debug.Trace("SLDragons starting aaaSLD_Spell_Sex_FatalVore")
	if VoreAnimationSet == 0
		if DragonSex == 0
			actor[] activeActors = new actor[2]
			activeActors[0] = Food
			activeActors[1] = Dragon
			sslBaseAnimation[] anims = Sexlab.GetCreatureAnimationsByRaceKeyTags(2, "Dragons", "Vore,OralVore","Unbirth,AnalVore,FemaleDragon", true)
		;	RegisterForModEvent("HookAnimationStart_Vore", "OnAnimationStart")
			RegisterForModEvent("HookAnimationEnd_Vore", "OnAnimationEnd")
			SexLab.StartSex(activeActors, anims, allowbed=false, hook="Vore")
		else
			actor[] activeActors = new actor[2]
			activeActors[0] = Food
			activeActors[1] = Dragon
			sslBaseAnimation[] anims = Sexlab.GetCreatureAnimationsByRaceKeyTags(2, "Dragons", "Vore,OralVore","Unbirth,AnalVore,MaleDragon", true)
		;	RegisterForModEvent("HookAnimationStart_Vore", "OnAnimationStart")
			RegisterForModEvent("HookAnimationEnd_Vore", "OnAnimationEnd")
			SexLab.StartSex(activeActors, anims, allowbed=false, hook="Vore")
		endif
	elseif VoreAnimationSet == 1
		if DragonSex == 0
			actor[] activeActors = new actor[2]
			activeActors[0] = Food
			activeActors[1] = Dragon
			sslBaseAnimation[] anims = Sexlab.GetCreatureAnimationsByRaceKeyTags(2, "Dragons", "Vore,OralVore,Cunnilingus","Unbirth,AnalVore,FemaleDragon", true)
		;	RegisterForModEvent("HookAnimationStart_Vore", "OnAnimationStart")
			RegisterForModEvent("HookAnimationEnd_Vore", "OnAnimationEnd")
			SexLab.StartSex(activeActors, anims, allowbed=false, hook="Vore")
		else ; don't have female dragon version for this yet so just copy animaton set 0
			actor[] activeActors = new actor[2]
			activeActors[0] = Food
			activeActors[1] = Dragon
			sslBaseAnimation[] anims = Sexlab.GetCreatureAnimationsByRaceKeyTags(2, "Dragons", "Vore,OralVore","Unbirth,AnalVore,MaleDragon", true)
		;	RegisterForModEvent("HookAnimationStart_Vore", "OnAnimationStart")
			RegisterForModEvent("HookAnimationEnd_Vore", "OnAnimationEnd")
			SexLab.StartSex(activeActors, anims, allowbed=false, hook="Vore")		
		endif
	else
		if DragonSex == 0
			actor[] activeActors = new actor[2]
			activeActors[0] = Food
			activeActors[1] = Dragon
			sslBaseAnimation[] anims = Sexlab.GetCreatureAnimationsByRaceKeyTags(2, "Dragons", "Vore,AnalVore","OralVore,Unbirth", true)
		;	RegisterForModEvent("HookAnimationStart_Vore", "OnAnimationStart")
			RegisterForModEvent("HookAnimationEnd_Vore", "OnAnimationEnd")
			SexLab.StartSex(activeActors, anims, allowbed=false, hook="Vore")
		else
			actor[] activeActors = new actor[2]
			activeActors[0] = Food
			activeActors[1] = Dragon
			sslBaseAnimation[] anims = Sexlab.GetCreatureAnimationsByRaceKeyTags(2, "Dragons", "Vore,Unbirth","OralVore,AnalVore", true)
		;	RegisterForModEvent("HookAnimationStart_Vore", "OnAnimationStart")
			RegisterForModEvent("HookAnimationEnd_Vore", "OnAnimationEnd")
			SexLab.StartSex(activeActors, anims, allowbed=false, hook="Vore")
		endif
	endif
	RegisterForSingleUpdate( 10.0 )
EndEvent

;check to make sure the animation started
Event OnUpdate()
	if Dragon.IsInFaction(SexLabAnimatingFaction) == false
	;	Debug.Notification("aborting vore script: Dragon not in SexLabAnimatingFaction")
		Debug.Trace("aborting vore script: Dragon not in SexLabAnimatingFaction")
		Dispel()
	endif
EndEvent

;disabled unused in this script, but could be useful elsewhere
;Event OnAnimationStart(int tid, bool HasPlayer)
;	Debug.Notification("OnAnimationStart Vore")
;	Debug.Trace("OnAnimationStart Vore")
;EndEvent

Event OnAnimationEnd(int tid, bool HasPlayer)
;	Debug.Notification("OnAnimationEnd Vore")
;	Debug.Trace("OnAnimationEnd Vore")
	Dragon.DoCombatSpellApply(aaaSLDFatalVoreEndingSpell, Food)
	Food.SetAlpha(0)
	int EnableDeathMessages = aaaSLD_EnableDeathMessages.GetValueInt()
	if Food == PlayerRef
		Game.disablePlayerControls(False, True, False, False, False, True, True, False)
		Game.ForceFirstPerson()
		if VoreAnimationSet == 0
			aaaFXVoreDeathCam.Play(PlayerRef)
			aaaFXVoreAcidPartA.Play(PlayerRef)
			aaaFXVoreAcidPartB.Play(PlayerRef)
			Dragon.SetAlpha(0)
			if EnableDeathMessages == 1
				if Dragon == aaaAlduinFollowerRef
					debug.TraceAndBox("Alduin made a mistake by devouring you, his soul was bound to serve you, as your life fades so does his strength, leaving him vulnerable to any dragon that wishes to take advantage of his weakened state, to dominate their former master as he lays powerless to stop them, he is now doomed to be nothing but a dumping ground for their unwanted seed.")
				elseif Dragon == DLC1DurnehviirRef
					debug.TraceAndBox("Intentional or not, there's no turning back now, Durneviir has made you his meal, You could feel your flesh burning as the dragon churned you away within his rotting guts, but still Your body squirmed helplessly with pleasure, climaxing endlessly as the dragon digested you into the stew that it was brewing, your sacrifice has restored Durneviir's body and will allow him to escape the Soul Cairn once and for all, but with your body digested and his damaged soul you will merge together equally as one, soon nether of you will exist anymore, and the first *joorkiin* dragon shall fly in your places.")
				else
					debug.TraceAndBox("Intentional or not, there's no turning back now, the dragon has made you its meal, you've been kept in for too long so it's best to just let the dragon enjoy what has been started, releasing you now would just be a pointless waste of a perfectly good meal, You could feel your flesh burning as the dragon churned you away within its belly, but still Your body squirmed helplessly with pleasure, climaxing endlessly as the dragon digested you into the stew that it was brewing, soon your body will be gone and your soul shall be entrapped forever within the dragons's hot slimy depths.")
				endif
			endif
		elseif VoreAnimationSet == 1
			aaaFXVoreDeathCam.Play(PlayerRef)
			aaaFXVoreAcidPartA.Play(PlayerRef)
			aaaFXVoreAcidPartB.Play(PlayerRef)
			Dragon.SetAlpha(0)
			if EnableDeathMessages == 1
				if Dragon == aaaAlduinFollowerRef
					debug.TraceAndBox("Alduin made a mistake by devouring you, his soul was bound to serve you, as your life fades so does his strength, leaving him vulnerable to any dragon that wishes to take advantage of his weakened state, to dominate their former master as he lays powerless to stop them.")
				else
					debug.TraceAndBox("The dragon has betrayed you and made you its meal, you've been kept in for too long so it's best to just let the dragon enjoy what has been started, releasing you now would just be a pointless waste of a perfectly good meal, You could feel your flesh burning as the dragon churned you away within its belly, but still Your body squirmed helplessly with pleasure, climaxing endlessly as the dragon digested you into the stew that it was brewing, soon your body will be gone and your soul shall be entrapped forever within the dragons's hot slimy depths.")
				endif
			endif
		else
			if DragonSex == 0
				aaaFXAnalDeathCam.Play(PlayerRef)
				Dragon.SetAlpha(0)
				if EnableDeathMessages == 1
					if Dragon == aaaAlduinFollowerRef
						debug.TraceAndBox("Alduin made a mistake by trapping you within his rear, his soul was bound to serve you, as your life fades so does his strength, leaving him vulnerable to any dragon that wishes to take advantage of his weakened state, to dominate their former master as he lays powerless to stop them, he is now doomed to be nothing but a dumping ground for their unwanted seed, while within your soul is forced to taste every dragon that breeds him.")
					else
						debug.TraceAndBox("willing or not, there's no turning back now, the dragon has taken you deeper within his bowels, you know your end is near, You can feel your flesh burning and the filth that you breath gives you no air, but still Your body squirms helplessly with pleasure, his muscular innards are rubbing and squeezing up the length of your body, making you climax endlessly as his hot slimy depths swallow you in ever deeper. Soon you will pass and your body will be digested, leaving your soul trapped forever within the Dragon's ravenous rear end.")
					endif
				endif
			else
				aaaFXUnbirthDeathCam.Play(PlayerRef)
				Dragon.SetAlpha(0)
				if EnableDeathMessages == 1
					if Dragon == aaaFemAlduinFollowerRef
						debug.TraceAndBox("Alduin made a mistake by trapping you within her womb, her soul was bound to serve you, as your life fades so does her strength, leaving her vulnerable to any dragon that wishes to take advantage of her weakened state, to dominate their former master as she lays powerless to stop them, she is now doomed to be nothing but a dumping ground for their unwanted seed, while within your soul is forced to taste every dragon that breeds her.")
					elseif Dragon == aaaBoziilahRef
						debug.TraceAndBox("Boziilah found your friends on the mountain, and they were indeed the ones destined to claim her. They now breed her endlessly, taking turns to fill her, while within they are drowning you with their relentless releases, but still you suckled upon the tips of their masses, climaxing as your lungs burn from there thick sexual fluids flowing through them. Your end is now near, and you know what comes next, soon your body will be dissolved and her eggs will be formed, then Boziilah shall have the children she has waited so long for. perhaps one day you may be reborn as one of them.")
					else
						debug.TraceAndBox("Intentional or not, another dragon got aroused by watching you, and the Dragoness has allowed his mast to penatrate her, trapping you within her womb as he fills her with his relentless releases, you are being drowed by his seed, but still you suckled upon the tip of his mass, climaxing as your lungs burn from the thick sexual fluids that flows through them. Your end is now near, and you know what comes next, soon your body will be dissolved and her eggs will be formed, but perhaps one day she may let you be reborn as her child.")
					endIf
				endif
			endif
		endif
	else
		Food.EnableAI(false)
	endif
	Dispel()
EndEvent

Event SexLabStoppedActive()
;	Debug.Notification("SexLabStoppedActive")
;	Debug.Trace("SexLabStoppedActive")
	Dispel()
EndEvent

;Event OnEffectFinish(Actor target, Actor caster)
;	Debug.Notification("OnEffectFinish")
;	Debug.Trace("OnEffectFinish")
;EndEvent

 

 

Edited by MadMansGun

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