Jump to content

SexLab ModEvent stops triggering?


Recommended Posts

Some users of my Succubus Heart mod are having a strange issue where effects from sex are no longer applying. I was able to replicate the issue with an Alpha version of More Nasty Creatures where creature framework wasn't being detected which leads me to believe the problem has something to do with Animation Events. I've tried combing through my code but it's super strange that it's randomly stopped working around this time when it never had this issue before. Is there any way to capture events other than what my code describes below so I can test it? When I tied the mod events to a debug spell it also didn't trigger when they were suppose to.

 

From my OnInit() in my main quest block

 

 

RegisterForModEvent("AnimationStart","DanisManage")
	RegisterForModEvent("AnimationEnd","DanieManage")
	RegisterForModEvent("OrgasmStart","DorgsManage")
	RegisterForModEvent("OrgasmEnd","DorgeManage")
	
	MODupdate()

 

 

I've been using this system to capture animations for over 7 official release versions and these issues were never reported before, so I'm at a bit of a loss.

 

My "Animation Start" code

 

 

Event DanisManage(string eventName, string argString, float argNum, form sender)
	sslThreadController Thread = SexLab.HookController(argString)
	actor[] aniActor = SexLab.HookActors(argString)
	
	;ent/ Animation Variables
	int i = 0
	int femalePres = 0
	int malePres = 0
	int mcrePres = 0
	int fcrePres = 0
	int sucpres = 0
	;end/
	
	i = 0
	while i < aniActor.Length
		;ent/ Gender Check
		int Agender = SexLab.GetGender(aniActor[i])
		if Agender == 1
			femalePres += 1
		elseIf Agender == 0
			malePres += 1
		elseIf Agender == 2
			mcrePres += 1
		elseIf Agender == 3
			fcrePres += 1
		endIf
		if aniActor[i].HasMagicEffect(SuH_NPCsuccubuseffect)
			sucpres += 1
		endIf
		;end/
		;ent/ Apply OnAct
		aniActor[i].AddSpell(SuH_CHAinact, false)
		if SuH_SETinvact.GetValue()
			aniActor[i].AddSpell(SuH_essential, false)
		endIf
		;end/
	i += 1
	endWhile
	
	if Thread.HasPlayer
		;ent/ Animation Variables
		int NPCgenders = 0
		int pGender = SexLab.GetGender(playerRef)
		;end/
		;ent/ Set NPCgenders
		If mcrePres > 0 || fcrePres > 0
			SuH_NPCgenders.SetValue(3) ;creature
		elseIf pGender == 1 ;Female
			if malePres > 0
				SuH_NPCgenders.SetValue(2) ;male
			else
				SuH_NPCgenders.SetValue(1) ;female
			endIf	
		elseIf pGender == 0 ;Male
			if malePres > 1
				SuH_NPCgenders.SetValue(2) ;male
			else
				SuH_NPCgenders.SetValue(1) ;female
			endIf
		endIf
		;end/
		;ent/ Type Effects
		actor victim = SexLab.HookVictim(argString)
		if victim != none
			i = 0
			while i < aniActor.Length
				if aniActor[i] == victim
					if aniActor[i] == playerRef
						aniActor[i].AddSpell(SuH_PCSsubmit, false)
					elseIf aniActor[i].HasMagicEffect(SuH_NPCsuccubuseffect)
						aniActor[i].AddSpell(SuH_NPCssubmit, false)
					else
						aniActor[i].AddSpell(SuH_NPCsvictim, false)
					endIf
				else
					if aniActor[i] == playerRef
						aniActor[i].AddSpell(SuH_PCSmastery, false)
					elseif aniActor[i].HasMagicEffect(SuH_NPCsuccubuseffect)
						aniActor[i].AddSpell(SuH_NPCsmastery, false)
					else
						aniActor[i].AddSpell(SuH_NPCsattacker, false)
					endIf
				endIf
			i += 1
			endWhile
		else
			i = 0
			while i < aniActor.Length
				if aniActor[i] == playerRef
					aniActor[i].AddSpell(SuH_PCStraining, false)
				elseif aniActor[i].HasMagicEffect(SuH_NPCsuccubuseffect)
					aniActor[i].AddSpell(SuH_NPCstraining, false)
				else
					aniActor[i].AddSpell(SuH_NPCsconsent, false)
				endIf
			i += 1
			endWhile
		endIf
		;end/
	elseIf sucpres > 0
		;ent/ Type Effects
		actor victim = SexLab.HookVictim(argString)
		if victim != none
			i = 0
			while i < aniActor.Length
				if aniActor[i] == victim
					if aniActor[i].HasMagicEffect(SuH_NPCsuccubuseffect)
						aniActor[i].AddSpell(SuH_NPCssubmit, false)
					else
						aniActor[i].AddSpell(SuH_NPCsnvictim, false)
					endIf
				else
					if aniActor[i].HasMagicEffect(SuH_NPCsuccubuseffect)
						aniActor[i].AddSpell(SuH_NPCsmastery, false)
					else
						aniActor[i].AddSpell(SuH_NPCsnattacker, false)
					endIf
				endIf
			i += 1
			endWhile
		else
			i = 0
			while i < aniActor.Length
				if aniActor[i].HasMagicEffect(SuH_NPCsuccubuseffect)
					aniActor[i].AddSpell(SuH_NPCstraining, false)
				else
					aniActor[i].AddSpell(SuH_NPCsnconsent, false)
				endIf
			i += 1
			endWhile
		endIf
		;end/
	endIf
endEvent
;end/

 

 

My "Animation End" Code

 

 

Event DanieManage(string eventName, string argString, float argNum, form sender)
	sslThreadController Thread = SexLab.HookController(argString)
	actor[] endActor = SexLab.HookActors(argString)
	int i = 0
	while i < endActor.Length
		endActor[i].RemoveSpell(SuH_essential)
		if endActor[i] == playerRef
			endActor[i].RemoveSpell(SuH_PCSmastery)
			endActor[i].RemoveSpell(SuH_PCSsubmit)
			endActor[i].RemoveSpell(SuH_PCStraining)
		else
			endActor[i].RemoveSpell(SuH_NPCsattacker)
			endActor[i].RemoveSpell(SuH_NPCsconsent)
			endActor[i].RemoveSpell(SuH_NPCsvictim)
			endActor[i].RemoveSpell(SuH_NPCsnvictim)
			endActor[i].RemoveSpell(SuH_NPCsnattacker)
			endActor[i].RemoveSpell(SuH_NPCsnconsent)
			endActor[i].RemoveSpell(SuH_NPCsmastery)
			endActor[i].RemoveSpell(SuH_NPCstraining)
			endActor[i].RemoveSpell(SuH_NPCssubmit)
		endIf
		endActor[i].RemoveSpell(SuH_CHAinact)
	i += 1
	endWhile
endEvent

 

 

One of my spell's code - just in-case it matters

 

 

ScriptName SuH_PCSmasteryScript extends ActiveMagicEffect

SexLabFramework property SexLab auto

;ent/ Global Variables
GlobalVariable Property SuH_PCSheartXP auto
GlobalVariable Property SuH_PCShpabsorb auto
GlobalVariable Property SuH_PCSmpabsorb auto
GlobalVariable Property SuH_PCSspabsorb auto
GlobalVariable Property SuH_PCSheartXPgain auto
GlobalVariable Property SuH_NPChdry auto
GlobalVariable Property SuH_NPCmdry auto
GlobalVariable Property SuH_NPCsdry auto
GlobalVariable Property SuH_NPCgenders auto
GlobalVariable Property SuH_PCScapup auto
GlobalVariable Property SuH_skill_essence auto
GlobalVariable Property SuH_skill_earned auto
GlobalVariable Property SuH_skill_points auto
GlobalVariable Property SuH_SETmultiattacker auto
GlobalVariable Property SuH_SEThcap auto
GlobalVariable Property SuH_SETmcap auto
GlobalVariable Property SuH_SETscap auto
GlobalVariable Property SuH_PCSactstacks auto
GlobalVariable Property SuH_PCSmaxactstacks auto
GlobalVariable Property SuH_PCSspermstacks auto
GlobalVariable Property SuH_PCSmaxspermstacks auto
GlobalVariable Property SuH_PCSmilkstacks auto
GlobalVariable Property SuH_PCSmaxmilkstacks auto
GlobalVariable Property SuH_PCSgenders auto
GlobalVariable Property SuH_PCSinactive auto
GlobalVariable Property SuH_PCSdesireOrg auto
;end/
;ent/ Magic Effects
MagicEffect Property SuH_sp_humandesireseffect auto
MagicEffect Property SuH_sp_animaldesireseffect auto
MagicEffect Property SuH_sp_selfstackereffect auto
;end/

Spell Property SuH_PCSmastery auto

;ent/ Actors
Actor Property playerRef Auto
;end/
int xpUP
int hUP
int mUP
int sUP
int eUP
int pHa
int pMa
int pSa
int plvl
int NPCgenders
int XPearn
int switch
int invalid
int XPbase
int SETh
int SETm
int SETs
int itimer
int aminutes
float XPgain
float aMOD

Event OnEffectStart(Actor akTarget, Actor akCaster)
	;ent/ Set Variables
	aMOD = SuH_SETmultiattacker.GetValue()
	pHa = SuH_PCShpabsorb.GetValue() as int
	pMa = SuH_PCSmpabsorb.GetValue() as int
	pSa = SuH_PCSspabsorb.GetValue() as int
	XPgain = SuH_PCSheartXPgain.GetValue()
	plvl = playerRef.GetLevel()
	XPearn = Math.Floor(20 + (plvl*0.5))
	NPCgenders = SuH_NPCgenders.GetValue() as int
	switch = 0
	invalid = 0
	;end/
	;ent/ Check Passives
	If playerRef.HasMagicEffect(SuH_sp_humandesireseffect)
		if NPCgenders >= 1 && NPCgenders <= 2 || NPCgenders == 12
			aMOD += 0.25
		endIf
	endIf
	If playerRef.HasMagicEffect(SuH_sp_animaldesireseffect) && NPCgenders == 3
		aMOD += 0.25
	endIf
	;end/
	
	RegisterForSingleUpdate(5.0)
EndEvent

Event OnUpdate()
	hUP += pHa
	mUP += pMa
	sUP += pSa
	xpUP += XPearn
	switch += 1
	if switch >= 6
		if SexLab.IsValidActor(playerRef)
			invalid = 1
			playerRef.RemoveSpell(SuH_PCSmastery)
		else
			switch = 0
		endIf
	endIf
	RegisterForSingleUpdate(5.0)
endEvent

Event onEffectFinish(Actor akTarget, Actor akCaster)
if invalid == 0
	;ent/ Variables
	int XP = SuH_PCSheartXP.GetValue() as int
	int pH = playerRef.GetBaseActorValue("health") as int
	int pM = playerRef.GetBaseActorValue("magicka") as int
	int pS = playerRef.GetBaseActorValue("stamina") as int
	int pE = SuH_skill_essence.GetValue() as int
	int statCapUp = SuH_PCScapup.GetValue() as int
	int statCap = Math.Floor(100+(5*plvl)+(statCapUp))
	SETh = SuH_SEThcap.GetValue() as int
	SETm = SuH_SETmcap.GetValue() as int
	SETs = SuH_SETscap.GetValue() as int
	;end/
	;ent/ Apply Desire Bonus
	int pDesireOrg = SuH_PCSdesireOrg.GetValue() as int
	aMOD += (pDesireOrg*0.0001)
	SuH_PCSdesireOrg.SetValue(0)
	;end/
	;ent/ Apply and Overflow Check
	int h = pH + Math.Floor(hUP*aMOD)
	int m = pM + Math.Floor(mUP*aMOD)
	int s = pS + Math.Floor(sUP*aMOD)
	int x = 0
	int rh = 0
	int rm = 0
	int rs = 0
	
	if SETh == 0
		if h <= statCap
			rh = hUP
			playerRef.SetActorValue("health", h)
		elseIf pH >= statCap
			eUP += Math.Floor(hUP*aMOD)
		else
			x = h - statCap
			rh = hUP - x
			eUP += x
			playerRef.SetActorValue("health", statCap)
		endIf
	else
		if h <= SETh
			rh = hUP
			playerRef.SetActorValue("health", h)
		elseIf pH >= SETh
			eUP += Math.Floor(hUP*aMOD)
		else
			x = h - SETh
			rh = hUP - x
			eUP += x
			playerRef.SetActorValue("health", SETh)
		endIf
	endIf
	
	if SETm == 0
		if m <= statCap
			rm = mUP
			playerRef.SetActorValue("magicka", m)
		elseIf pM >= statCap
			eUP += Math.Floor(mUP*aMOD)
		else
			x = m - statCap
			rm = mUP - x
			eUP += x
			playerRef.SetActorValue("magicka", statCap)
		endIf
	else
		if m <= SETm
			rm = mUP
			playerRef.SetActorValue("magicka", m)
		elseIf pM >= SETm
			eUP += Math.Floor(mUP*aMOD)
		else
			x = m - SETm
			rm = mUP - x
			eUP += x
			playerRef.SetActorValue("magicka", SETm)
		endIf
	endIf
	
	if SETs == 0
		if s <= statCap
			rs = sUP
			playerRef.SetActorValue("stamina", s)
		elseIf pS >= statCap
			eUP += Math.Floor(sUP*aMOD)
		else
			x = s - statCap
			rs = sUP - x
			eUP += x
			playerRef.SetActorValue("stamina", statCap)
		endIf
	else
		if s <= SETs
			rs = sUP
			playerRef.SetActorValue("stamina", s)
		elseIf pS >= SETs
			eUP += Math.Floor(sUP*aMOD)
		else
			x = s - SETs
			rs = sUP - x
			eUP += x
			playerRef.SetActorValue("stamina", SETs)
		endIf
	endIf
	;end/
	int rxp = Math.Floor(xpUP*aMOD*XPgain*0.01)
	XP += rxp
	pE += eUP
	SuH_PCSheartXP.SetValue(XP)
	SuH_skill_essence.SetValue(pE)
	SuH_PCSinactive.SetValue(0)
	;ent/ Act Report
	if	rh == 0
		if rm == 0
			if rs == 0
				if eUP == 0
					debug.Notification("Act Report : "+rxp+"XP  ")
				else
					debug.Notification("Act Report : "+rxp+"XP "+eUP+"Essence ")
				endIf
			elseIf eUP == 0
				debug.Notification("Act Report : "+rxp+"XP "+rs+"Stamina ")
			else
				debug.Notification("Act Report : "+rxp+"XP "+rs+"Stamina "+eUP+"Essence ")
			endIf
		elseIf rs == 0
			if eUP == 0
				debug.Notification("Act Report : "+rxp+"XP "+rm+"Magicka ")
			else
				debug.Notification("Act Report : "+rxp+"XP "+rm+"Magicka "+eUP+"Essence ")
			endIf
		elseIf eUP == 0
			debug.Notification("Act Report : "+rxp+"XP "+rm+"Magicka "+rs+"Stamina ")
		else
			debug.Notification("Act Report : "+rxp+"XP "+rm+"Magicka "+rs+"Stamina "+eUP+"Essence ")
		endIf
	elseIf rm == 0
		if rs == 0
			if eUP == 0
				debug.Notification("Act Report : "+rxp+"XP "+rh+"Health ")
			else
				debug.Notification("Act Report : "+rxp+"XP "+rh+"Health "+eUP+"Essence ")
			endIf
		elseif eUP == 0
			debug.Notification("Act Report : "+rxp+"XP "+rh+"Health "+rs+"Stamina ")
		else
			debug.Notification("Act Report : "+rxp+"XP "+rh+"Health "+rs+"Stamina "+eUP+"Essence ")
		endIf
	elseIf rs == 0
		if eUP == 0
			debug.Notification("Act Report : "+rxp+"XP "+rh+"Health "+rm+"Magicka ")
		else
			debug.Notification("Act Report : "+rxp+"XP "+rh+"Health "+rm+"Magicka "+eUP+"Essence ")
		endIf
	elseIf eUP == 0
		debug.Notification("Act Report : "+rxp+"XP "+rh+"Health "+rm+"Magicka "+rs+"Stamina ")
	else
		debug.Notification("Act Report : "+rxp+"XP "+rh+"Health "+rm+"Magicka "+rs+"Stamina "+eUP+"Essence ")
	endIf
	;end/
	;ent/ Act Stack
	int aStack = SuH_PCSactstacks.GetValue() as int
	int maStack = SuH_PCSmaxactstacks.GetValue() as int
	if aStack < maStack
		aStack += 1
		SuH_PCSactstacks.SetValue(aStack)
	endIf
	if playerRef.HasMagicEffect(SuH_sp_selfstackereffect)
		int pGender = SuH_PCSgenders.GetValue() as int
		if pGender == 1
			int mStack = SuH_PCSmilkstacks.GetValue() as int
			int mmStack = SuH_PCSmaxmilkstacks.GetValue() as int
			if mStack < mmStack
				mStack += 1
				SuH_PCSmilkstacks.SetValue(mStack)
			endIf
		elseIf pGender == 2
			int sStack = SuH_PCSspermstacks.GetValue() as int
			int msStack = SuH_PCSmaxspermstacks.GetValue() as int
			if sStack < msStack
				sStack += 1
				SuH_PCSspermstacks.SetValue(sStack)
			endIf
		endIf
	endIf
	;end/ 
endIf
endEvent

 

 

 

How it works : On start it gathers actor information which then determines which spell to apply. The Spell captures values over-time by adding values to single updates. On end it then removes the spell, triggering the "OnEffectFinish" code. Then the finish code calculates additions and displays a notification.

Link to comment

Yes.

You are using a really old way to subscribe to events.

 

Grab the latest version of SexLab and have a look to the main SexLabFramework.psc file, where the hooking system is described.

@Ashal did a great job by documenting pretty much all the functions directly in the main API file.

 

Link to comment

Yes.

You are using a really old way to subscribe to events.

 

Grab the latest version of SexLab and have a look to the main SexLabFramework.psc file, where the hooking system is described.

@Ashal did a great job by documenting pretty much all the functions directly in the main API file.

Well then, guess that's just my mod showing its age. =X.x=

 

Thank you, haven't gotten to trying it yet but seems like it would work.

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