Jump to content

Having trouble detecting when an actor orgasms


Recommended Posts

Posted

Hi.  I'm trying to make an item that unequips itself after its wearer has orgasmed a certain number of types.  Sadly, my OnOrgasm even isn't firing.  What am I doing wrong?



Here's trimmed-down version of my script.

 

Scriptname JBT_OrgasmToUnequipScript extends ObjectReference  

	SexLabFramework Property SexLab auto
	Armor Property inventoryItem auto
	Actor Property owner auto Hidden
	
	
	;Events
	
	Event OnEquipped(Actor akActor)
		
		Debug.Trace("CursedSchlong: OnEquipped event fired")
		
		;Register for the event
		SexLab.TrackActor(akActor, "JBT_CursedSchlong")
		;RegisterForMyEvent("JBT_CursedSchlong_Orgasm", "OnOrgasm")	;This is the function SexLabFramework.psc says to call.  This function doesn't exist.
		RegisterForModEvent("JBT_CursedSchlong_Orgasm", "OnOrgasm")	;Assuming the above function was a typo.
		
	EndEvent
	
	Event OnOrgasm(Form FormRef, int tid)
		
		Debug.MessageBox("Detected OnOrgasm event")
		
	EndEvent

I've also tried registering for the "SexLabOrgasm" event, which is created in the file sslActorAlias.psc, with no results.  I figure I'm not supposed to use that event anyway, since it's hidden so deep in the code.

Posted

Not sure a volatile script attached to an ObjectReference may receive an event like this.

 

Try to register for:

 

 

Actor whoHasTheSchlong
 
...
 
whoHasTheSchlong = akActor
RegisterForModEvent("OrgasmStart", "OnOrgasm")
 
...
 
Event OnOrgasm(Form FormRef, int tid)

  sslThreadController tc = SexLab.GetController(tid)
  Actor[] Positions = tc.Positions
  if Positions.find(whoHasTheSchlong)!=-1
    Debug.MessageBox("Orgasm with the custom schlong for " + whoHasTheSchlong.getDisplayName())
  endIf

EndEvent
 
 

 

 

 

Posted

Nope, no dice.  The message box didn't display.

 

You said an ObjectReference script might not receive the event?  What if I tried a magic effect instead, then?

Posted

Probably you need to add a script to a quest, define inside a "tracking function", and register for events on the main quest script.

 

Posted

Is this what you meant?

 

In the quest script:

Scriptname JBT_CursedSchlongQuestScript extends Quest  

	SexLabFramework Property SexLab auto

	String Property OrgasmCallback = "CursedSchlongOrgasmCallback" auto hidden
	Form Property JBT_CursedSchlong auto
	
	
	;Events
	Event OnOrgasm(Form formRef, int tid)
		
		;Just show that we've received the event.
		Debug.MessageBox("Orgasm event detected")
		
                ;TODO: Look up the actor's schlong script and call its OnOrgasm function
	EndEvent
	
	;Interface
	
	Function RegisterActor(Actor akActor, JBT_OrgasmToUnequipScript schlong)
		;Track the actor
		SexLab.TrackActor(akActor, OrgasmCallback)
		RegisterForModEvent(OrgasmCallback + "_Orgasm", "OnOrgasm")
		
		Debug.Notification("Tracked actor " + akActor.GetDisplayName())
		
		;TODO: Use PapyrusUtil to keep track of which actor goes with which schlong
	EndFunction
	
	Function UnregisterActor(Actor akActor)
		;Untrack the actor
		SexLab.UntrackActor(akActor, OrgasmCallback)
		
		;TODO: Discard the schlong
	EndFunction

In the schlong's script:

Scriptname JBT_OrgasmToUnequipScript extends ObjectReference  

	JBT_CursedSchlongQuestScript Property questScript auto
	JBT_CursedSchlongMCM Property mcm auto
	
	Armor Property inventoryItem auto
	
	Int Property OrgasmsToRemove auto Hidden
	Int Property OrgasmCount = 0 auto Hidden
	
	;Events
	
	Event OnEquipped(Actor akActor)
		
		Debug.Trace("CursedSchlong: OnEquipped event fired")

                ;INSERT UNIMPORTANT STUFF HERE
		
		;Register for the event
		questScript.RegisterActor(akActor, self)
	EndEvent
	
	Event OnUnequipped(Actor akActor)

	        ;INSERT UNIMPORTANT STUFF HERE
		
		;Unsubscribe from the event
		questScript.UnregisterActor(akActor)
		
	EndEvent
	
	
	;Misc functions
	
	Function OnOrgasm()
		
                ;The contents of this function don't matter right now, because it's not getting called yet 

		Debug.Notification(GetPossessiveName() + " penis gets a little weaker")
		
		;Increment the orgasm count
		OrgasmCount += 1
		
		;If there are no orgasms left, unequip and remove
		if (OrgasmCount == OrgasmsToRemove)
			canUnequip = true
			owner.UnequipItem(inventoryItem)
		endif
		
	EndFunction
	
	String Function GetPossessiveName()
		if (owner == Game.GetPlayer())
			return "your"
		else
			return owner.GetDisplayName() + "'s"
		endif
	EndFunction

Sadly, that's not working either.  The quest script isn't receiving the event.  Is this even remotely the right way to detect an orgasm event at all?

Posted

I am not sure that "TrackActor" works in this way.

Posted

I figured as much.  How does it work, then?  I've been reading the source code for SexLab, SexLab Aroused, Devious Devices Integration, and Deviously Cursed Loot, and I'm still having difficulties figuring it out.

Posted

Tomorrow I will try to write some sample script for you.

Right now it is too late for me, and I am still working on my mod.

 

Posted

I figured as much.  How does it work, then?  I've been reading the source code for SexLab, SexLab Aroused, Devious Devices Integration, and Deviously Cursed Loot, and I'm still having difficulties figuring it out.

 

What about looking at one of the mods that adds squirting to orgasms? Probably much easier to sift through since the focus is much more narrow.

 

http://www.loverslab.com/files/file/1893-sexlab-squirt-reborn/

[removed double post that popped up for some wierd reason]

Posted

 

I figured as much.  How does it work, then?  I've been reading the source code for SexLab, SexLab Aroused, Devious Devices Integration, and Deviously Cursed Loot, and I'm still having difficulties figuring it out.

 

What about looking at one of the mods that adds squirting to orgasms? Probably much easier to sift through since the focus is much more narrow.

 

http://www.loverslab.com/files/file/1893-sexlab-squirt-reborn/

I figured as much.  How does it work, then?  I've been reading the source code for SexLab, SexLab Aroused, Devious Devices Integration, and Deviously Cursed Loot, and I'm still having difficulties figuring it out.

 

What about looking at one of the mods that adds squirting to orgasms? Probably much easier to sift through since the focus is much more narrow.

 

http://www.loverslab.com/files/file/1893-sexlab-squirt-reborn/

 

 

Hey, thanks for the idea!  I took your advice and looked into SexLab Squirt Reborn.

 

As it turns out, ObjectReferences that are items don't seem to remember some of their properties when they enter a container.  So owner was getting set to "none" once the OnEquip event ended.

 

To solve this, I ended up rewriting essentially everything.  Now everything is handled in the quest script, using StorageUtil.

 

Unfortunately, I'm getting a new error now.  When I try to get the thread controller in the orgasm event, SexLab.GetController() is returning "none".  This happens regardless of the TID.  I'm not actually calling GetController, but I'm calling a function that calls it.  Is there something else I need to do first before GetController() will work?

 

Here's all of my code.  It's gotten much more concise after the rewrite, so I can afford to put the entire thing.

 

 

Scriptname JBT_CursedSchlongQuestScript extends Quest  

	;REQUIREMENTS:
	;*SKSE
	;*SOS Equippable Schlong
	;*SkyUI
	;*SexLab Framework

	SexLabFramework Property SexLab auto
	JBT_CursedSchlongMCM Property mcm auto
	
	String Property RegisterItemEvent = "JBT_SurpriseEquipRegister" auto
	String Property OrgasmCallback = "CursedSchlongOrgasmCallback" auto hidden
	
	Float Property Weight = 1.0 auto
	Form Property JBT_CursedSchlong auto
	
	int Property listSize = 0 auto
	
	;PapyrusUtil keys
	String Property RegisteredActorsList = "JBT_CURSED_SCHLONG_REGISTERED_ACTORS_LIST" autoreadonly hidden
	String Property equipped = "JBT_CURSED_SCHLONG_EQUIPPED" autoreadonly hidden
	String Property orgasmsLeft = "JBT_CURSED_SCHLONG_ORGASMS_LEFT" autoreadonly hidden
	String Property previousGender = "JBT_CURSED_SCHLONG_PREVIOUS_GENDER" autoreadonly hidden
	
	;Events
	
	Event OnInit()
	
		;Register with SurpriseEquip, if it's installed.
		int handle = ModEvent.Create(RegisterItemEvent)
		if (handle)
			ModEvent.PushForm(handle, JBT_CursedSchlong)
			ModEvent.PushFloat(handle, Weight)
			ModEvent.Send(handle)
		endif
		
		;Hook into orgasm event
		;RegisterForModEvent("HookAnimationStart", "OnOrgasm")
		self.RegisterForModEvent("OrgasmStart", "OnOrgasm")
		
	EndEvent
	
	Event OnOrgasm(string eventName, string argString, float argNum, form sender);Event OnOrgasm(int tid, bool hasPlayer)
		
		;Just show that we've received the event.
		Debug.MessageBox("Orgasm event detected!")
		
		;Get the thread controller
		Actor[] orgasmList = SexLab.HookActors(argString)
		
		;TODO: Support for separate orgasms
		int i = 0;
		while (i < listSize)
			
			;If the thread has this actor, call it.
			Actor akActor = StorageUtil.FormListGet(self, RegisteredActorsList, i) as Actor
			
			if (PapyrusUtil.CountActor(orgasmList, akActor) >= 1)
				Debug.MessageBox(akActor.GetDisplayName() + " is in the orgasm list")
				HandleActorOrgasm(akActor)
			else
				Debug.MessageBox(akActor.GetDisplayName() + " is NOT in the orgasm list")
			endif
		
			;Increment
			i += 1
		endwhile
		
	EndEvent
	
	;Interface
	
	Function EquipActor(Actor akActor)
		;Add the actor to the list
		StorageUtil.FormListAdd(self, RegisteredActorsList, akActor, false)
		listSize += 1
		
		;Mark the actor as equipped
		StorageUtil.SetIntValue(akActor, equipped, 1)
		
		;Set the number of orgasms left
		int orgasmsToRemove = Utility.RandomInt(mcm.MinOrgasmsToRemove, mcm.MaxOrgasmsToRemove)
		StorageUtil.SetIntValue(akActor, orgasmsLeft, orgasmsToRemove)
		
		;Tread the victim as male
		StorageUtil.SetIntValue(akActor, previousGender, SexLab.GetGender(akActor))
		SexLab.TreatAsMale(akActor)
		
		Debug.Notification("A schlong grows over " + GetPossessiveName(akActor) + " pussy, blocking it off.")
		Debug.Trace("Tracked actor " + akActor.GetDisplayName())
		
	EndFunction
	
	Function UnequipActor(Actor akActor)
		
		;If the schlong is still supposed to be equipped, re-equip it and return.
		if (StorageUtil.HasIntValue(akActor, equipped))
		
			akActor.EquipItemEx(JBT_CursedSchlong, 0)
			
			;Show a hillarious message
			if (akActor == Game.GetPlayer())
				
				Debug.MessageBox("You try to rip your cock off, with predictable results.")
			else
				
				Debug.Notification(akActor.GetDisplayName() + " tries to rip her cock off, with predictable results.")
			endif
			
			return
		endif
		
		;Restore the actor's previous gender
		int prev = StorageUtil.GetIntValue(akActor, previousGender)
		SexLab.TreatAsGender(akActor, (prev == 1))
		StorageUtil.UnsetIntValue(akActor, previousGender)
		
		;Untrack the actor
		StorageUtil.FormListRemove(self, RegisteredActorsList, akActor)
		listSize -= 1
		
		;Track the actor
	EndFunction
	
	;Misc methods
	Function HandleActorOrgasm(Actor akActor)
		
		;Reduce orgasms left
		int orgasms = StorageUtil.GetIntValue(akActor, orgasmsLeft)
		orgasms -= 1
		StorageUtil.SetIntValue(akActor, orgasmsLeft, orgasms)
		
		;Display the message
		Debug.Notification(GetPossessiveName(akActor) + " penis feels a bit weaker.")
		
		;If there are no orgasms left, allow unequipping and then unequip.
		if (orgasms == 0)
			
			StorageUtil.UnsetIntValue(akActor, equipped)
			akActor.UnequipItemEx(JBT_CursedSchlong, 0)
			akActor.RemoveItem(JBT_CursedSchlong)
			
			;Show the message
			Debug.Notification(GetPossessiveName(akActor) + " schlong shrivels up and disappears.")
			
		endif
		
	EndFunction
	
	String Function GetPossessiveName(Actor akActor)
	
		if (akActor == Game.GetPlayer())
			return "your"
		else
			return akActor.GetDisplayName() + "'s"
		endif
	
	EndFunction
Scriptname JBT_OrgasmToUnequipScript extends ObjectReference  

	JBT_CursedSchlongQuestScript Property questScript auto

	Event OnEquipped(Actor akActor)
	
		;Pass the event on to the quest script
		questScript.EquipActor(akActor)
	EndEvent
	
	Event OnUnequipped(Actor akActor)
	
		;Pass the event on to the quest script
		questScript.UnequipActor(akActor)
	EndEvent
  • 2 years later...
Posted

I can't get Sexlab to register Orgasms at all... Animations work. But it says I'm 54 days from my last orgasm. Same with all NPC's. I wish I knew about this code you're messing with. 

Archived

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

  • Recently Browsing   0 members

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