Scriptname SuH_Fun extends Quest  

SexLabFramework property SexLab auto

ObjectReference Property SuH_sdr_spawnpoint Auto ;Note, will be used in a future update
ObjectReference Property SuH_sevaspawn Auto ;Overwrites portal point
ObjectReference Property SuH_sdr_portalpoint Auto 
ObjectReference Property SuH_sd_returnpoint Auto 
ObjectReference Property SuH_sdr_lostchest Auto 
ObjectReference Property SuH_sd_goldchest Auto 
MiscObject property Gold001 auto

;ent/ Variables
GlobalVariable property SuH_CHKsdinact auto
GlobalVariable property SuH_CHKdied auto
GlobalVariable property SuH_PCSabsorbhealth auto
GlobalVariable property SuH_PCSabsorbmagicka auto
GlobalVariable property SuH_PCSabsorbstamina auto
GlobalVariable property SuH_PCScaphealth auto
GlobalVariable property SuH_PCScapmagicka auto
GlobalVariable property SuH_PCScapstamina auto
GlobalVariable property SuH_PCSspermhealth auto
GlobalVariable property SuH_PCSspermmagicka auto
GlobalVariable property SuH_PCSspermstamina auto
GlobalVariable property SuH_PCSmilkhealth auto
GlobalVariable property SuH_PCSmilkmagicka auto
GlobalVariable property SuH_PCSmilkstamina auto
GlobalVariable property SuH_PCSxp auto
GlobalVariable property SuH_PCSxpearn auto
GlobalVariable property SuH_PCSxpgain auto
GlobalVariable property SuH_PCSforce auto
GlobalVariable property SuH_PCSdesire auto
GlobalVariable property SuH_PCSeffectmulti auto
GlobalVariable property SuH_PCSbpoint auto
GlobalVariable property SuH_PCSdpoint auto
GlobalVariable property SuH_PCSspoint auto
GlobalVariable property SuH_PCSmpoint auto
GlobalVariable property SuH_PCSbdsm auto
GlobalVariable property SuH_PCSbdsmspecial auto
GlobalVariable property SuH_SETallowmalehomo auto
GlobalVariable property SuH_SETallowfemalehomo auto
GlobalVariable property SuH_SETrestrictact auto
GlobalVariable property SuH_SETsdloseitems auto
GlobalVariable property SuH_SETsdlosegold auto
GlobalVariable property SuH_SETsdloseequip auto
GlobalVariable property SuH_ORcaphealth auto
GlobalVariable property SuH_ORcapmagicka auto
GlobalVariable property SuH_ORcapstamina auto
GlobalVariable property SuH_ORabsorbhealth auto
GlobalVariable property SuH_ORabsorbmagicka auto
GlobalVariable property SuH_ORabsorbstamina auto
GlobalVariable property SuH_PETsummonlevel auto
GlobalVariable property SuH_PETsummonxp auto
GlobalVariable property SuH_PETdogxp auto
GlobalVariable property SuH_PETdoglevel auto
GlobalVariable property SuH_PETdogdesire auto
GlobalVariable property SuH_PETdogeffect auto
GlobalVariable property SuH_PETwolfxp auto
GlobalVariable property SuH_PETwolflevel auto
GlobalVariable property SuH_PETwolfdesire auto
GlobalVariable property SuH_PETwolfeffect auto
GlobalVariable property SuH_PEThorsexp auto
GlobalVariable property SuH_PEThorselevel auto
GlobalVariable property SuH_PEThorsedesire auto
GlobalVariable property SuH_PEThorseeffect auto
GlobalVariable property SuH_PETskeeverxp auto
GlobalVariable property SuH_PETskeeverlevel auto
GlobalVariable property SuH_PETskeeverdesire auto
GlobalVariable property SuH_PETskeevereffect auto
GlobalVariable property SuH_PETfamiliarxp auto
GlobalVariable property SuH_PETfamiliarlevel auto
GlobalVariable property SuH_PETfamiliardesire auto
GlobalVariable property SuH_PETfamiliareffect auto
GlobalVariable property SuH_PETbearxp auto
GlobalVariable property SuH_PETbearlevel auto
GlobalVariable property SuH_PETbeardesire auto
GlobalVariable property SuH_PETbeareffect auto
GlobalVariable property SuH_PETsabrecatxp auto
GlobalVariable property SuH_PETsabrecatlevel auto
GlobalVariable property SuH_PETsabrecatdesire auto
GlobalVariable property SuH_PETsabrecateffect auto
GlobalVariable property SuH_PETdraugrxp auto
GlobalVariable property SuH_PETdraugrlevel auto
GlobalVariable property SuH_PETdraugrdesire auto
GlobalVariable property SuH_PETdraugreffect auto
GlobalVariable property SuH_PETtrollxp auto
GlobalVariable property SuH_PETtrolllevel auto
GlobalVariable property SuH_PETtrolldesire auto
GlobalVariable property SuH_PETtrolleffect auto
GlobalVariable property SuH_PETsprigganxp auto
GlobalVariable property SuH_PETsprigganlevel auto
GlobalVariable property SuH_PETspriggandesire auto
GlobalVariable property SuH_PETsprigganeffect auto
GlobalVariable property SuH_PEThorkerxp auto
GlobalVariable property SuH_PEThorkerlevel auto
GlobalVariable property SuH_PEThorkerdesire auto
GlobalVariable property SuH_PEThorkereffect auto
GlobalVariable property SuH_PETfalmerxp auto
GlobalVariable property SuH_PETfalmerlevel auto
GlobalVariable property SuH_PETfalmerdesire auto
GlobalVariable property SuH_PETfalmereffect auto
GlobalVariable property SuH_PETdogunlock auto
GlobalVariable property SuH_PETwolfunlock auto
GlobalVariable property SuH_PEThorseunlock auto
GlobalVariable property SuH_PETskeeverunlock auto
GlobalVariable property SuH_PETfamiliarunlock auto
GlobalVariable property SuH_PETbearunlock auto
GlobalVariable property SuH_PETsabrecatunlock auto
GlobalVariable property SuH_PETdraugrunlock auto
GlobalVariable property SuH_PETtrollunlock auto
GlobalVariable property SuH_PETsprigganunlock auto
GlobalVariable property SuH_PEThorkerunlock auto
GlobalVariable property SuH_PETfalmerunlock auto
GlobalVariable property SuH_rank_seducer auto
GlobalVariable property SuH_SETinvactmale auto
GlobalVariable property SuH_SETinvactfemale auto
GlobalVariable property SuH_SETinvactmalecreature auto
GlobalVariable property SuH_SETinvactfemalecreature auto
GlobalVariable property SuH_PETeffect auto
GlobalVariable property SuH_PETeffectstrength auto
;end/
;ent/ Spell
Spell property SuH_sex_inact auto
Spell property SuH_sex_petspell auto
Spell property SuH_spell_commandpetrape auto
Spell property SuH_CHAinvact auto
;end/
;ent/ Actors
Actor property PlayerRef auto
Actor property SuH_actor_dog auto
Faction property SuH_petfaction auto
;end/
;ent/ Script Variables
int trackConfirm
int trackValue
string trackString
actor seducedNPC
string seducedType
;end/

;ent/ Tracking
Function trackSet(int trackCost, string trackName)
	trackValue = trackCost
	trackString = trackName
	trackConfirm = 1
endFunction
;end/
;ent/ Pet Sex Effects
		; Spell Effects
			; 0 = no effect
			; 1 = damage target stamina ( petLVL+sumLVL * 2 )
			; 2 = heal target health ( petLVL+sumLVL * 1 )
			; 3 = damage target magicka ( petLVL+sumLVL * 2 )
			; 4 = Gain HeartXP ( petLVL+sumLVL * 1 )
Function spellPET(string petID, Actor petTarget)
	int petL = 0 ; Pet Level
	int petE = 0 ; Spell Effect
	int sumL = SuH_PETsummonlevel.GetValue() as int
	if petID == "dog"
		petL = SuH_PETdoglevel.GetValue() as int
		petE = SuH_PETdogeffect.GetValue() as int
	elseif petID == "wolf"
		petL = SuH_PETwolflevel.GetValue() as int
		petE = SuH_PETwolfeffect.GetValue() as int
	elseif petID == "horse"
		petL = SuH_PEThorselevel.GetValue() as int
		petE = SuH_PEThorseeffect.GetValue() as int
	elseif petID == "skeever"
		petL = SuH_PETskeeverlevel.GetValue() as int
		petE = SuH_PETskeevereffect.GetValue() as int
	elseif petID == "familiar"
		petL = SuH_PETfamiliarlevel.GetValue() as int
		petE = SuH_PETfamiliareffect.GetValue() as int
	elseif petID == "bear"
		petL = SuH_PETbearlevel.GetValue() as int
		petE = SuH_PETbeareffect.GetValue() as int
	elseif petID == "sabrecat"
		petL = SuH_PETsabrecatlevel.GetValue() as int
		petE = SuH_PETsabrecateffect.GetValue() as int
	elseif petID == "draugr"
		petL = SuH_PETdraugrlevel.GetValue() as int
		petE = SuH_PETdraugreffect.GetValue() as int
	elseif petID == "troll"
		petL = SuH_PETtrolllevel.GetValue() as int
		petE = SuH_PETtrolleffect.GetValue() as int
	elseif petID == "spriggan"
		petL = SuH_PETsprigganlevel.GetValue() as int
		petE = SuH_PETsprigganeffect.GetValue() as int
	elseif petID == "horker"
		petL = SuH_PEThorkerlevel.GetValue() as int
		petE = SuH_PEThorkereffect.GetValue() as int
	elseif petID == "falmer"
		petL = SuH_PETfalmerlevel.GetValue() as int
		petE = SuH_PETfalmereffect.GetValue() as int
	endIf
	if petE == 1 ; damage target stamina
		if petTarget.IsInFaction(SuH_petfaction)
		else
			SuH_PETeffect.SetValue(1)
			float x = (petL+sumL) * 2
			SuH_PETeffectstrength.SetValue(x)
			petTarget.AddSpell(SuH_sex_petspell)
		endIf
	elseif petE == 2 ; heal target health
		if petTarget.IsInFaction(SuH_petfaction)
		else
			SuH_PETeffect.SetValue(2)
			float x = (petL+sumL) * 1
			SuH_PETeffectstrength.SetValue(x)
			petTarget.AddSpell(SuH_sex_petspell)
		endIf
	elseif petE == 3 ; damage target magicka
		if petTarget.IsInFaction(SuH_petfaction)
		else
			SuH_PETeffect.SetValue(3)
			float x = (petL+sumL) * 2
			SuH_PETeffectstrength.SetValue(x)
			petTarget.AddSpell(SuH_sex_petspell)
		endIf
	elseif petE == 4 ; gain heartxp
		if petTarget.IsInFaction(SuH_petfaction)
		SuH_PETeffect.SetValue(4)
		float x = (petL+sumL) * 1
		SuH_PETeffectstrength.SetValue(x)
		petTarget.AddSpell(SuH_sex_petspell)
		endIf
	endIf
endFunction
;end/
;ent/ Make Essential
Function INVact(actor char)
	int charG = SexLab.GetGender(char)
	if char.GetActorBase().IsEssential()
		;do nothing
	elseif charG == 0
		if SuH_SETinvactmale.GetValue()
			char.AddSpell(SuH_CHAinvact)
			char.GetActorBase().SetEssential(true)
		endIf
	elseif charG == 1
		if SuH_SETinvactfemale.GetValue()
			char.AddSpell(SuH_CHAinvact)
			char.GetActorBase().SetEssential(true)
		endIf
	elseif charG == 2
		if SuH_SETinvactmalecreature.GetValue()
			char.AddSpell(SuH_CHAinvact)
			char.GetActorBase().SetEssential(true)
		endIf
	elseif charG == 3
		if SuH_SETinvactfemalecreature.GetValue()
			char.AddSpell(SuH_CHAinvact)
			char.GetActorBase().SetEssential(true)
		endIf
	endIf
endFunction
;end/
;ent/ Set Seduced / apply seduction cost
		;charNPC : Set the reference/target actor
		;actType : Set aggressive or consent
		; setNPC : 0=proc effect 1=setting npc for future use
Function seducedNPCSet(actor charNPC, string actType, int setNPC)
	if setNPC == 1
		seducedNPC = charNPC
		seducedType = actType
	elseif setNPC == 0
		if seducedNPC == charNPC && seducedNPC != PlayerRef
			if seducedType == actType
				int seducerrank = SuH_rank_seducer.GetValue() as int
				int seducecost = Math.Floor(90 - (seducerrank*5))
				int phealth = playerRef.GetBaseActorValue("Health") as int
				int pmagicka = playerRef.GetBaseActorValue("Magicka") as int
				int pstamina = playerRef.GetBaseActorValue("Stamina") as int
				int nphealth = Math.Floor(phealth - (phealth * (seducecost * 0.01)))
				int npmagicka = Math.Floor(pmagicka - (pmagicka * (seducecost * 0.01)))
				int npstamina = Math.Floor(pstamina - (pstamina * (seducecost * 0.01)))
				playerRef.SetActorValue("health", nphealth)
				playerRef.SetActorValue("magicka", npmagicka)
				playerRef.SetActorValue("stamina", npstamina)
			else
				seducedNPC = playerRef
			endIf
		else
			seducedNPC = playerRef
		endIf
	endIf
endFunction
;end/
;ent/ XPcalc : Calculate XP gained
		; *aPreset : Defines defaults for common actions
		; *aMOD : Active Modifier that adds to XPgain percentage
		; *XPearn : Set XP earned (aPreset overwrites this value) 0=use default
		; *lvlS : Level Scaling, Bonus XP earned per-level [lvlS * playerLevel]
Function XPcalc(string aPreset="none", float aMOD=0.0, int XPearn=0, float lvlS=0.0) 
	If aPreset != "none"
		if aPreset == "PCmastery" ; Mastery Sex Act (Player as aggressor)
			int desireCost = Math.Floor(SuH_PCSdesire.GetValue() * 0.05)
			int desireV = Math.Floor(SuH_PCSdesire.GetValue() - desireCost)
			SuH_PCSdesire.SetValue(desireV)
			XPearn = Math.Floor(XPearn + desireCost + SuH_PCSxpearn.GetValue())
			aMOD = 0.2
			lvlS = 5.0
		elseIf aPreset == "PCtraining" ; Consent Sex Act (Player with consent)
			int desireCost = Math.Floor(SuH_PCSdesire.GetValue() * 0.05)
			int desireV = Math.Floor(SuH_PCSdesire.GetValue() - desireCost)
			SuH_PCSdesire.SetValue(desireV)
			XPearn = Math.Floor(XPearn + desireCost + SuH_PCSxpearn.GetValue())
			aMOD = 0.0
			lvlS = 5.0
		elseIf aPreset == "PCsubmit" ; Submit Sex Act (Player as victim)
			int desireCost = Math.Floor(SuH_PCSdesire.GetValue() * 0.05)
			int desireV = Math.Floor(SuH_PCSdesire.GetValue() - desireCost)
			SuH_PCSdesire.SetValue(desireV)
			XPearn = Math.Floor(XPearn + desireCost + SuH_PCSxpearn.GetValue())
			aMOD = -0.2
			lvlS = 5.0
		elseIf aPreset == "PCsperm" ; Consume Sperm
			aMOD = 0.0
			XPearn = Math.Floor(XPearn + SuH_PCSxpearn.GetValue())
			lvlS = 5.0
		elseIf aPreset == "PCmilk" ; Consume Milk
			aMOD = 0.0
			XPearn = Math.Floor(XPearn + SuH_PCSxpearn.GetValue())
			lvlS = 5.0
		elseIf aPreset == "PCorgasm"
			aMOD = 0.0
			lvlS = 0.0
			int desireCost = Math.Floor(SuH_PCSdesire.GetValue() * 0.8)
			int desireV = Math.Floor(SuH_PCSdesire.GetValue() - desireCost)
			SuH_PCSdesire.SetValue(desireV)
			XPearn = Math.Floor(XPearn + desireCost + SuH_PCSxpearn.GetValue())
		else
			debug.trace("SuH ERROR : XPcalc aPreset was invalid", 2)
		endIf
	endIf
		if XPearn == 0
			XPearn = SuH_PCSxpearn.GetValue() as int
		endIf
		float eMOD = aMOD + (SuH_PCSxpgain.GetValue()*0.01)
		float effectMulti = SuH_PCSeffectmulti.GetValue()
		int PClevel = PlayerRef.GetLevel() as int
		int x = Math.Floor(((XPearn+(PClevel*lvlS))*(eMOD*effectMulti)))
		int y = SuH_PCSxp.GetValue() as int
		int z = x+y
		SuH_PCSxp.SetValue(z)
		if trackConfirm == 1
			if z > trackValue
				debug.Notification(trackString+" can now be increased!")
				trackConfirm = 0
			endIf
		endIf
endFunction
;end/

;ent/ STATcalc : Calculate Absorption
	; eChar : effected Character
	; *aPreset : defaults for common values [PCmastery PCtraining PCsubmit PCsperm PCmilk]
	; *Stat : Stat to effect "All"=health/magicka/stamina "Health" "Magicka" "Stamina"
	; *aMOD : Active Modifier, Percentage added to the effect
	; *aEffect : Override default absorption values [set to anything that isn't 0.0 to ignore Absorption Stats]
Function STATcalc(Actor eChar, string aPreset="none",string stat="All", float aMOD=0.0,float aEffect=0.0)
		If aPreset != "none"
			if aPreset == "PCmastery" ; Mastery Sex Act
				aMOD = 0.2
				aEffect = 0.0
			elseif aPreset == "PCtraining" ; Consent Sex Act
				aMOD = 0.0
				aEffect = 0.0
			elseif aPreset == "PCsubmit" ; Submit Sex Act
				aMOD = -0.2
				aEffect = 0
			elseif aPreset == "PCsperm" ; Consume Sperm
				aMOD = 0.0
				aEffect = 0.0
			elseif aPreset == "PCmilk" ; Consume Milk
				aMOD = 0.0
				aEffect = 0.0
			else
				debug.trace("SuH ERROR : STATcalc aPreset was invalid", 2)
			endIf
		endIf
		if eChar == PlayerRef ; if character is the player
				if Stat == "All" || Stat == "Health" ; Earn Health 
						float effectMulti = SuH_PCSeffectmulti.GetValue()
						float eMOD = (1.0+aMOD)*effectMulti ; Set Multiplier
						float cS = eChar.GetBaseActorValue("health") ; Get Base Stat
						float cScap = 0
						if SuH_ORcaphealth.GetValue() > 0
							cScap = SuH_ORcaphealth.GetValue()
						else
							int plvl = PlayerRef.GetLevel() as int
							cScap = Math.Floor(SuH_PCScaphealth.GetValue()+(plvl*2)) ; Get Stat Cap
						endIf
						float k = 0.0 ; Set-up Absorption Variable
						if aEffect == 0 ; if aEffect is set to default
							if aPreset == "PCsperm" ; Check if preset is PCsperm
								k = SuH_PCSspermhealth.GetValue() as int ; set to default
							elseIf aPreset == "PCmilk" ; Check if preset is PCmilk
								k = SuH_PCSmilkhealth.GetValue() as int ; set to default
							else ; Set to general absorption stat
								if SuH_ORabsorbhealth.GetValue() > 0
									k = SuH_ORabsorbhealth.GetValue() as int
								else
									k = SuH_PCSabsorbhealth.GetValue() as int
								endIf
							endIf
						else ; If aEffect isn't default
							k = aEffect ; Set absorption calculation to k
						endIf
					if cS >= cScap ; Check if Stat is capped
						int x = Math.Floor(k*eMOD) ; Find total absorption
						int y = SuH_PCSforce.GetValue() as int ; Get Force value
						SuH_PCSforce.SetValue(x+y) ; Set Force
					else ; If stat wasn't capped
						int x = Math.Floor(k*eMOD) ; Find total absorption
						int y = Math.Floor(x+cS) ; Find result stat
						if y <= cScap ; If result is below cap
							eChar.SetActorValue("health", y) ; Set Stat
						else ; If result was above cap
							eChar.SetActorValue("health", cScap) ; Set Stat to cap
							int j = Math.Floor(x-cScap) ; Find absorbed value
							int z = Math.Floor(y+SuH_PCSforce.GetValue()) ; Get Force and add
							SuH_PCSforce.SetValue(z) ; Set Force
						endIf
					endIf
				endIf
				if Stat == "All" || Stat == "Magicka" ; Earn Magicka
						float effectMulti = SuH_PCSeffectmulti.GetValue()
						float eMOD = (1.0+aMOD)*effectMulti
						float cS = eChar.GetBaseActorValue("magicka")
						float cScap = 0
						if SuH_ORcapmagicka.GetValue() > 0
							cScap = SuH_ORcapmagicka.GetValue()
						else
							int plvl = PlayerRef.GetLevel() as int
							cScap = Math.Floor(SuH_PCScapmagicka.GetValue()+(plvl*2)) ; Get Stat Cap
						endIf
						float k = 0.0
						if aEffect == 0
							if aPreset == "PCsperm"
								k = SuH_PCSspermmagicka.GetValue() as int
							elseIf aPreset == "PCmilk"
								k = SuH_PCSmilkmagicka.GetValue() as int
							else
								if SuH_ORabsorbmagicka.GetValue() > 0
									k = SuH_ORabsorbmagicka.GetValue() as int
								else
									k = SuH_PCSabsorbmagicka.GetValue() as int
								endIf
							endIf
						else
							k = aEffect
						endIf
					if cS >= cScap
						int x = Math.Floor(k*eMOD)
						int y = SuH_PCSforce.GetValue() as int
						SuH_PCSforce.SetValue(x+y)
					else
						int x = Math.Floor(k*eMOD)
						int y = Math.Floor(x+cS)
						if y <= cScap
							eChar.SetActorValue("magicka", y)
						else
							eChar.SetActorValue("magicka", cScap)
							int j = Math.Floor(x-cScap)
							int z = Math.Floor(y+SuH_PCSforce.GetValue())
							SuH_PCSforce.SetValue(z)
						endIf
					endIf
				endIf
				if Stat == "All" || Stat == "Stamina" ; Earn Stamina
						float effectMulti = SuH_PCSeffectmulti.GetValue()
						float eMOD = (1.0+aMOD)*effectMulti
						float cS = eChar.GetBaseActorValue("Stamina")
						float cScap = 0
						if SuH_ORcapstamina.GetValue() > 0
							cScap = SuH_ORcapstamina.GetValue()
						else
							int plvl = PlayerRef.GetLevel() as int
							cScap = Math.Floor(SuH_PCScapstamina.GetValue()+(plvl*2)) ; Get Stat Cap
						endIf
						float k = 0
						if aEffect == 0
							if aPreset == "PCsperm"
								k = SuH_PCSspermstamina.GetValue() as int
							elseIf aPreset == "PCmilk"
								k = SuH_PCSmilkstamina.GetValue() as int
							else
								if SuH_ORabsorbstamina.GetValue() > 0
									k = SuH_ORabsorbstamina.GetValue() as int
								else
									k = SuH_PCSabsorbstamina.GetValue() as int
								endIf
							endIf
						else
							k = aEffect
						endIf
					if cS >= cScap
						int x = Math.Floor(k*eMOD)
						int y = SuH_PCSforce.GetValue() as int
						SuH_PCSforce.SetValue(x+y)
					else
						int x = Math.Floor(k*eMOD)
						int y = Math.Floor(x+cS)
						if y <= cScap
							eChar.SetActorValue("stamina", y)
						else
							eChar.SetActorValue("stamina", cScap)
							int j = Math.Floor(x-cScap)
							int z = Math.Floor(y+SuH_PCSforce.GetValue())
							SuH_PCSforce.SetValue(z)
						endIf
					endIf
				endIf
		else ; if character isn't the player
				if Stat == "All" || Stat == "Health"
					if aEffect == 0
						if SuH_ORabsorbhealth.GetValue() > 0
							aEffect = SuH_ORabsorbhealth.GetValue() as int
						else
							aEffect = SuH_PCSabsorbhealth.GetValue() as int
						endIf
					endIf
					float effectMulti = SuH_PCSeffectmulti.GetValue()
					float eMOD = (1.0+aMOD)*effectMulti
					float cS = eChar.GetBaseActorValue("health")
					int x = Math.Floor(aEffect*eMOD)
					if x >= cS
						eChar.SetActorValue("health",0)
					else
						int y = Math.Floor(cS-x)
						eChar.SetActorValue("health",y)
					endIf
				endIf
				if Stat == "All" || Stat == "Magicka"
					if aEffect == 0
						if SuH_ORabsorbmagicka.GetValue() > 0
							aEffect = SuH_ORabsorbmagicka.GetValue() as int
						else
							aEffect = SuH_PCSabsorbmagicka.GetValue() as int
						endIf
					endIf
					float effectMulti = SuH_PCSeffectmulti.GetValue()
					float eMOD = (1.0+aMOD)*effectMulti
					float cS = eChar.GetBaseActorValue("magicka")
					int x = Math.Floor(aEffect*eMOD)
					if x >= cS
						eChar.SetActorValue("magicka",0)
					else
						int y = Math.Floor(cS-x)
						eChar.SetActorValue("magicka",y)
					endIf
				endIf
				if Stat == "All" || Stat == "Stamina"
					if aEffect == 0
						if SuH_ORabsorbstamina.GetValue() > 0
							aEffect = SuH_ORabsorbstamina.GetValue() as int
						else
							aEffect = SuH_PCSabsorbstamina.GetValue() as int
						endIf
					endIf
					float effectMulti = SuH_PCSeffectmulti.GetValue()
					float eMOD = (1.0+aMOD)*effectMulti
					float cS = eChar.GetBaseActorValue("stamina")
					int x = Math.Floor(aEffect*eMOD)
					if x >= cS
						eChar.SetActorValue("stamina",0)
					else
						int y = Math.Floor(cS-x)
						eChar.SetActorValue("stamina",y)
					endIf
				endIf
		endIf
endFunction
;end/

;ent/ BDSMcalc : Add BDSM Rating... easily
	; BDSMtype : Which value to increase [b d s m]
	; value : Value to add
Function BDSMcalc(string BDSMtype, int value)
	int b = SuH_PCSbpoint.GetValue() as int
	int d = SuH_PCSdpoint.GetValue() as int
	int s = SuH_PCSspoint.GetValue() as int
	int m = SuH_PCSmpoint.GetValue() as int
	int bdsm = SuH_PCSbdsm.GetValue() as int
	int bdsmspecial = SuH_PCSbdsmspecial.GetValue() as int
	
	if BDSMtype == "b"
		b += value
		bdsm += value
		SuH_PCSbpoint.SetValue(b)
		SuH_PCSbdsm.SetValue(bdsm)
		if d >= b && d >= s && d >= m
			SuH_PCSbdsmspecial.SetValue(2)
		elseif b >= s && b >= m
			SuH_PCSbdsmspecial.SetValue(1)
		elseif s >= m
			SuH_PCSbdsmspecial.SetValue(3)
		else
			SuH_PCSbdsmspecial.SetValue(4)
		endIf
	elseif BDSMtype == "d"
		d += value
		bdsm += value
		SuH_PCSdpoint.SetValue(d)
		SuH_PCSbdsm.SetValue(bdsm)
		if d >= b && d >= s && d >= m
			SuH_PCSbdsmspecial.SetValue(2)
		elseif b >= s && b >= m
			SuH_PCSbdsmspecial.SetValue(1)
		elseif s >= m
			SuH_PCSbdsmspecial.SetValue(3)
		else
			SuH_PCSbdsmspecial.SetValue(4)
		endIf
	elseif BDSMtype == "s"
		s += value
		bdsm += value
		SuH_PCSspoint.SetValue(s)
		SuH_PCSbdsm.SetValue(bdsm)
		if d >= b && d >= s && d >= m
			SuH_PCSbdsmspecial.SetValue(2)
		elseif b >= s && b >= m
			SuH_PCSbdsmspecial.SetValue(1)
		elseif s >= m
			SuH_PCSbdsmspecial.SetValue(3)
		else
			SuH_PCSbdsmspecial.SetValue(4)
		endIf
	elseif BDSMtype == "m"
		m += value
		bdsm += value
		SuH_PCSmpoint.SetValue(m)
		SuH_PCSbdsm.SetValue(bdsm)
		if d >= b && d >= s && d >= m
			SuH_PCSbdsmspecial.SetValue(2)
		elseif b >= s && b >= m
			SuH_PCSbdsmspecial.SetValue(1)
		elseif s >= m
			SuH_PCSbdsmspecial.SetValue(3)
		else
			SuH_PCSbdsmspecial.SetValue(4)
		endIf
	endIf			
endFunction
;end/

;ent/ ANIMcalc : Calculate animations to start using Succubus Heart's variables
	; sentActor : Actors to animate [only supports an array of 1-2 actors]
	; *victimActor : Set victim Actor, and flags act as aggressive [defaults to no victim]
Function ANIMcalc(actor[] sentActor, actor victimActor=none)
	if sentActor.Length == 2
		actor a0 = sentActor[0]
		actor a1 = sentActor[1]
		int a0g = SexLab.GetGender(a0)
		int a1g = SexLab.GetGender(a1)
		if a0g == 1 ; 0 female
			if a1g == 0 ; 1 male
				bool a0v = True
				bool a1v = True
				if a0.HasSpell(SuH_sex_inact)
					a0v = false
				else
					a0v = SexLab.IsValidActor(a0)
				endIf
				if a1.HasSpell(SuH_sex_inact)
					a1v = false
				else
					a1v = SexLab.IsValidActor(a1)
				endIf
				if a0v == TRUE && a1v == TRUE ; if valid
					actor[] animActor = new actor[2]
					animActor[0] = a0
					animActor[1] = a1
					if victimActor != none ; if aggressive
						if victimActor == a0 ; if female victim
							sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
							SexLab.StartSex(animActor, animSET, victim=victimActor)
						else ; if male victim
							if SuH_SETrestrictact.GetValue()
								sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"Cowgirl", "Lesbian", requireAll=true)
								SexLab.StartSex(animActor, animSET, victim=victimActor)
							else
								sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
								SexLab.StartSex(animActor, animSET, victim=victimActor)
							endIf
						endIf
					else ; if non-aggressive
						sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
						SexLab.StartSex(animActor, animSET)
					endIf
				endIf
			elseIf a1g == 2 ; 1 male creature
				bool a0v = True
				bool a1v = True
				if a0.HasSpell(SuH_sex_inact)
					a0v = false
				else
					a0v = SexLab.IsValidActor(a0)
				endIf
				if a1.HasSpell(SuH_sex_inact)
					a1v = false
				else
					a1v = SexLab.IsValidActor(a1)
				endIf
				if a0v == TRUE && a1v == TRUE ; if valid
					actor[] animActor = new actor[2]
					animActor[0] = a0
					animActor[1] = a1
					if victimActor != none ; if aggressive
						sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "", requireAll=true)
						SexLab.StartSex(animActor, animSET, victim=victimActor)
					else ; if non-aggressive
						sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "", requireAll=true)
						SexLab.StartSex(animActor, animSET)
					endIf
				endIf
			elseif SuH_SETallowfemalehomo.GetValue()
				if a1g == 1 ; 1 female
					bool a0v = True
					bool a1v = True
					if a0.HasSpell(SuH_sex_inact)
						a0v = false
					else
						a0v = SexLab.IsValidActor(a0)
					endIf
					if a1.HasSpell(SuH_sex_inact)
						a1v = false
					else
						a1v = SexLab.IsValidActor(a1)
					endIf
					if a0v == TRUE && a1v == TRUE ; if valid
						actor[] animActor = new actor[2]
						animActor[0] = a0
						animActor[1] = a1
						if victimActor != none ; if aggressive
							sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"Lesbian", "", requireAll=true)
							SexLab.StartSex(animActor, animSET, victim=victimActor)
						else ; if non-aggressive
							sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
							SexLab.StartSex(animActor, animSET)
						endIf
					endIf
				elseIf a1g == 3 ; 1 female creature
					bool a0v = True
					bool a1v = True
					if a0.HasSpell(SuH_sex_inact)
						a0v = false
					else
						a0v = SexLab.IsValidActor(a0)
					endIf
					if a1.HasSpell(SuH_sex_inact)
						a1v = false
					else
						a1v = SexLab.IsValidActor(a1)
					endIf
					if a0v == TRUE && a1v == TRUE ; if valid
						actor[] animActor = new actor[2]
						animActor[0] = a0
						animActor[1] = a1
						if victimActor != none ; if aggressive
							if SuH_SETrestrictact.GetValue()
								sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"Cowgirl", "Lesbian", requireAll=true)
								SexLab.StartSex(animActor, animSET, victim=victimActor)
							else
								sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
								SexLab.StartSex(animActor, animSET, victim=victimActor)
							endIf
						else ; if non-aggressive
							sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
							SexLab.StartSex(animActor, animSET)
						endIf
					endIf
				endIf
			endIf
		elseIf a0g == 0 ; 0 male
			if a1g == 1 ; 1 female
					bool a0v = True
					bool a1v = True
					if a0.HasSpell(SuH_sex_inact)
						a0v = false
					else
						a0v = SexLab.IsValidActor(a0)
					endIf
					if a1.HasSpell(SuH_sex_inact)
						a1v = false
					else
						a1v = SexLab.IsValidActor(a1)
					endIf
				if a0v == TRUE && a1v == TRUE ; if valid
					actor[] animActor = new actor[2]
					animActor[0] = a1
					animActor[1] = a0
					if victimActor != none ; if aggressive
							if victimActor == a1 ; if female victim
							sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
							SexLab.StartSex(animActor, animSET, victim=victimActor)
						else ; if male attacker
							if SuH_SETrestrictact.GetValue()
								sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"Cowgirl", "Lesbian", requireAll=true)
								SexLab.StartSex(animActor, animSET, victim=victimActor)
							else
								sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
								SexLab.StartSex(animActor, animSET, victim=victimActor)
							endIf
						endIf
					else ; if non-aggressive
						sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
						SexLab.StartSex(animActor, animSET)
					endIf
				endIf
			elseif a1g == 3 ; 1 female creature
					bool a0v = True
					bool a1v = True
					if a0.HasSpell(SuH_sex_inact)
						a0v = false
					else
						a0v = SexLab.IsValidActor(a0)
					endIf
					if a1.HasSpell(SuH_sex_inact)
						a1v = false
					else
						a1v = SexLab.IsValidActor(a1)
					endIf
				if a0v == TRUE && a1v == TRUE ; if valid
					actor[] animActor = new actor[2]
					animActor[0] = a1
					animActor[1] = a0
					if victimActor != none ; if aggressive
						sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "", requireAll=true)
						SexLab.StartSex(animActor, animSET, victim=victimActor)
					else ; if non-aggressive
						sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
						SexLab.StartSex(animActor, animSET)
					endIf
				endIf
			elseIf SuH_SETallowmalehomo.GetValue()
				if a1g == 0 ; 1 male
					bool a0v = True
					bool a1v = True
					if a0.HasSpell(SuH_sex_inact)
						a0v = false
					else
						a0v = SexLab.IsValidActor(a0)
					endIf
					if a1.HasSpell(SuH_sex_inact)
						a1v = false
					else
						a1v = SexLab.IsValidActor(a1)
					endIf
					if a0v == TRUE && a1v == TRUE ; if valid
						actor[] animActor = new actor[2]
						animActor[0] = a1
						animActor[1] = a0
						if victimActor != none ; if aggressive
							sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
							SexLab.StartSex(animActor, animSET, victim=victimActor)
						else ; if non-aggressive
							sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
							SexLab.StartSex(animActor, animSET)
						endIf
					endIf
				elseif a1g == 2 ; male creature
					bool a0v = True
					bool a1v = True
					if a0.HasSpell(SuH_sex_inact)
						a0v = false
					else
						a0v = SexLab.IsValidActor(a0)
					endIf
					if a1.HasSpell(SuH_sex_inact)
						a1v = false
					else
						a1v = SexLab.IsValidActor(a1)
					endIf
					if a0v == TRUE && a1v == TRUE ; if valid
						actor[] animActor = new actor[2]
						animActor[0] = a1
						animActor[1] = a0
						if victimActor != none ; if aggressive
							if SuH_SETrestrictact.GetValue()
								sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"Cowgirl", "Lesbian", requireAll=true)
								SexLab.StartSex(animActor, animSET, victim=victimActor)
							else
								sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
								SexLab.StartSex(animActor, animSET, victim=victimActor)
							endIf
						else ; if non-aggressive
							sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
							SexLab.StartSex(animActor, animSET)
						endIf
					endIf
				endIf
			endIf
		elseIf a0g == 2 ; 0 male creature
			if a1g == 1 ; 1 female
					bool a0v = True
					bool a1v = True
					if a0.HasSpell(SuH_sex_inact)
						a0v = false
					else
						a0v = SexLab.IsValidActor(a0)
					endIf
					if a1.HasSpell(SuH_sex_inact)
						a1v = false
					else
						a1v = SexLab.IsValidActor(a1)
					endIf
				if a0v == TRUE && a1v == TRUE ; if valid
					actor[] animActor = new actor[2]
					animActor[0] = a1
					animActor[1] = a0
					if victimActor != none ; if aggressive
						sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "", requireAll=true)
						SexLab.StartSex(animActor, animSET, victim=victimActor)
					else ; if non-aggressive
						sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
						SexLab.StartSex(animActor, animSET)
					endIf
				endIf
			elseIf SuH_SETallowmalehomo.GetValue()
				if a1g == 0 ; 1 male
					bool a0v = True
					bool a1v = True
					if a0.HasSpell(SuH_sex_inact)
						a0v = false
					else
						a0v = SexLab.IsValidActor(a0)
					endIf
					if a1.HasSpell(SuH_sex_inact)
						a1v = false
					else
						a1v = SexLab.IsValidActor(a1)
					endIf
					if a0v == TRUE && a1v == TRUE ; if valid
						actor[] animActor = new actor[2]
						animActor[0] = a1
						animActor[1] = a0
						if victimActor != none ; if aggressive
							sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "", requireAll=true)
							SexLab.StartSex(animActor, animSET, victim=victimActor)
						else ; if non-aggressive
							sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
							SexLab.StartSex(animActor, animSET)
						endIf
					endIf
				endIf
			endIf
		elseIf a0g == 3 ; 0 female creature
			if a1g == 0 ; 1 male
					bool a0v = True
					bool a1v = True
					if a0.HasSpell(SuH_sex_inact)
						a0v = false
					else
						a0v = SexLab.IsValidActor(a0)
					endIf
					if a1.HasSpell(SuH_sex_inact)
						a1v = false
					else
						a1v = SexLab.IsValidActor(a1)
					endIf
				if a0v == TRUE && a1v == TRUE ; if valid
					actor[] animActor = new actor[2]
					animActor[0] = a0
					animActor[1] = a1
					if victimActor != none ; if aggressive
						sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "", requireAll=true)
						SexLab.StartSex(animActor, animSET, victim=victimActor)
					else ; if non-aggressive
						sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
						SexLab.StartSex(animActor, animSET)
					endIf
				endIf
			elseIf SuH_SETallowfemalehomo.GetValue()
				if a1g == 1 ; 1 female
					bool a0v = True
					bool a1v = True
					if a0.HasSpell(SuH_sex_inact)
						a0v = false
					else
						a0v = SexLab.IsValidActor(a0)
					endIf
					if a1.HasSpell(SuH_sex_inact)
						a1v = false
					else
						a1v = SexLab.IsValidActor(a1)
					endIf
					if a0v == TRUE && a1v == TRUE ; if valid
						actor[] animActor = new actor[2]
						animActor[0] = a0
						animActor[1] = a1
						if victimActor != none ; if aggressive
							sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "", requireAll=true)
							SexLab.StartSex(animActor, animSET, victim=victimActor)
						else ; if non-aggressive
							sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(2,"", "Lesbian", requireAll=true)
							SexLab.StartSex(animActor, animSET)
						endIf
					endIf
				endIf
			endIf
		endIf
	elseif sentActor.Length == 1
		bool c0valid = SexLab.IsValidActor(sentActor[0])
		if c0valid == TRUE ; If actor is valid
			int c0g = SexLab.GetGender(sentActor[0])
			if c0g == 1 ;female
				sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(1,"pussy", "", requireAll=true)
				SexLab.StartSex(sentActor, animSET)
			elseif c0g == 0 ;male
				sslBaseAnimation[] animSET = SexLab.GetAnimationsByTags(1,"penis", "", requireAll=true)
				SexLab.StartSex(sentActor, animSET)
			endIf
		endIf
	endIf
endFunction
;end/

;ent/ Death Alternative
Function SDrespawn()
	bool notinact = SexLab.IsValidActor(playerRef)
	if notinact == True	
		if playerRef.HasSpell(SuH_sex_inact)
		else
			SuH_CHKsdinact.SetValue(0)
			PlayerRef.SetNoBleedoutRecovery(false)
			PlayerRef.RestoreAV("Health", 100)
			SuH_CHKdied.SetValue(1)
			SuH_sd_returnpoint.MoveTo(PlayerRef)
			Utility.Wait(0.5)
			notinact = SexLab.IsValidActor(playerRef)
			if notinact == True
				PlayerRef.MoveTo(SuH_sevaspawn)
				SuH_sdr_lostchest.RemoveItem(Gold001, 999999)
				if SuH_SETsdloseequip.GetValue()
					;Destroy Equipped
					Form leftHand = PlayerRef.GetEquippedObject(0)
					Form rightHand = PlayerRef.GetEquippedObject(1)
					
					if (leftHand)
						PlayerRef.RemoveItem(leftHand, 1, true, SuH_sd_goldchest)
					endIf
					if (rightHand)
						PlayerRef.RemoveItem(rightHand, 1, true, SuH_sd_goldchest)
					endIf
					
					int slotsChecked
					slotsChecked += 0x00100000
					slotsChecked += 0x00200000 ;ignore reserved slots
					slotsChecked += 0x80000000
					
					int thisSlot = 0x01
					while (thisSlot < 0x80000000)
						if(Math.LogicalAnd(slotsChecked, thisSlot) != thisSlot) ;Only check un-checked slots
							Armor thisArmor = PlayerRef.GetWornForm(thisSlot) as Armor
							if (thisArmor)
								slotsChecked += thisArmor.GetSlotMask() ;add slots to slotsChecked
								PlayerRef.RemoveItem(thisArmor, 1, true, SuH_sd_goldchest)
							else ; No armor found
								slotsChecked += thisSlot
							endIf
						endIf
						thisSlot *= 2;double number and move to the next slot
					endWhile
				endIf
				if SuH_SETsdloseitems
					if SuH_SETsdlosegold.GetValue()
						PlayerRef.RemoveItem(Gold001, 999999, true)
						PlayerRef.RemoveAllItems(SuH_sdr_lostchest, true)
					else
						PlayerRef.RemoveItem(Gold001, 999999, true, SuH_sd_goldchest)
						PlayerRef.RemoveAllItems(SuH_sdr_lostchest, true)
						SuH_sd_goldchest.RemoveItem(Gold001, 999999, true, PlayerRef)
					endIf
				elseif SuH_SETsdlosegold.GetValue()
					PlayerRef.RemoveItem(Gold001, 999999, true)
				endIf
			else
				SuH_CHKsdinact.SetValue(1)
			endIf
		endIf
	endIf
endFunction
;end/

;ent/ Pet Stat
; [petID - Which actor is being modified]
	; dog = SuH_actor_dog
	; so on....
; Level calculation Guide
	; When summoning actors give them their bonus effects
	; Pets gain bonuses every 3 levels
Function statPet(string petID)
	
endFunction
;end/

;ent/ Pet XP
; [petID - Which actor is being leveled by ID name ]
	; summoner = PlayerRef
	; dog = SuH_actor_dog
	; so on....
; [sceneID - What scenario the XP was gained with]
	; c=consent a=aggressor v=victim / p=player n=npc
	; example c_p=consent with player
; [valueINT - amount of XP earned in a non-scene]
	; Default is 0 (used as an override for bonuses)
; [actionID - Action which gained XP (none expects default situation)]
	; Bonus scenario ID
Function xpPet(string petID, string sceneID="none", int valueINT=0, string actionID="none")
	if petID == "summoner"
		if valueINT != 0
			int x = Math.Floor(valueINT + SuH_PETsummonxp.GetValue())
			SuH_PETsummonxp.SetValue(x)
			levelPet("summoner")
		else
			int x = Math.Floor(5 + SuH_PETsummonxp.GetValue())
			SuH_PETsummonxp.SetValue(x)
			levelPet("summoner")
		endIf
	elseif petID == "dog" ; if actor is dog
		if actionID == "hit"
			int x = Math.Floor(1 + SuH_PETdogxp.GetValue())
			SuH_PETdogxp.SetValue(x)
			levelPet("dog")
			int y = Math.Floor(SuH_PETdogdesire.GetValue() - 10)
			SuH_PETdogdesire.SetValue(y)
		elseif sceneID != "none" ; if in a scene
			if actionID == "orgasm" ; if triggered from orgasm
				int x = Math.Floor(50 + SuH_PETdogxp.GetValue())
				SuH_PETdogxp.SetValue(x)
				levelPet("dog")
				int y = Math.Floor(SuH_PETdogdesire.GetValue() - 20)
				SuH_PETdogdesire.SetValue(y)
			else
				int x = Math.Floor(10 + SuH_PETdogxp.GetValue())
				SuH_PETdogxp.SetValue(x)
				levelPet("dog")
				int y = Math.Floor(SuH_PETdogdesire.GetValue() - 10)
				SuH_PETdogdesire.SetValue(y)
			endIf
		endIf
	elseif petID == "wolf" ; if actor is wolf
		if actionID == "hit"
			int x = Math.Floor(1 + SuH_PETwolfxp.GetValue())
			SuH_PETwolfxp.SetValue(x)
			levelPet("wolf")
			int y = Math.Floor(SuH_PETwolfdesire.GetValue() - 10)
			SuH_PETwolfdesire.SetValue(y)
		elseif sceneID != "none" ; if in a scene
			if actionID == "orgasm" ; if triggered from orgasm
				int x = Math.Floor(50 + SuH_PETwolfxp.GetValue())
				SuH_PETwolfxp.SetValue(x)
				levelPet("wolf")
				int y = Math.Floor(SuH_PETwolfdesire.GetValue() - 20)
				SuH_PETwolfdesire.SetValue(y)
			else
				int x = Math.Floor(10 + SuH_PETwolfxp.GetValue())
				SuH_PETwolfxp.SetValue(x)
				levelPet("wolf")
				int y = Math.Floor(SuH_PETwolfdesire.GetValue() - 10)
				SuH_PETwolfdesire.SetValue(y)
			endIf
		endIf
	elseif petID == "horse" ; if actor is horse
		if actionID == "hit"
			int x = Math.Floor(1 + SuH_PEThorsexp.GetValue())
			SuH_PEThorsexp.SetValue(x)
			levelPet("horse")
			int y = Math.Floor(SuH_PEThorsedesire.GetValue() - 10)
				SuH_PEThorsedesire.SetValue(y)
		elseif sceneID != "none" ; if in a scene
			if actionID == "orgasm" ; if triggered from orgasm
				int x = Math.Floor(50 + SuH_PEThorsexp.GetValue())
				SuH_PEThorsexp.SetValue(x)
				levelPet("horse")
				int y = Math.Floor(SuH_PETskeeverdesire.GetValue() - 20)
				SuH_PEThorsedesire.SetValue(y)
			else
				int x = Math.Floor(10 + SuH_PEThorsexp.GetValue())
				SuH_PEThorsexp.SetValue(x)
				levelPet("horse")
				int y = Math.Floor(SuH_PEThorsedesire.GetValue() - 10)
				SuH_PEThorsedesire.SetValue(y)
			endIf
		endIf
	elseif petID == "skeever" ; if actor is skeever
		if actionID == "hit"
			int x = Math.Floor(1 + SuH_PETskeeverxp.GetValue())
			SuH_PETskeeverxp.SetValue(x)
			levelPet("skeever")
			int y = Math.Floor(SuH_PETskeeverdesire.GetValue() - 10)
				SuH_PETskeeverdesire.SetValue(y)
		elseif sceneID != "none" ; if in a scene
			if actionID == "orgasm" ; if triggered from orgasm
				int x = Math.Floor(50 + SuH_PETskeeverxp.GetValue())
				SuH_PETskeeverxp.SetValue(x)
				levelPet("skeever")
				int y = Math.Floor(SuH_PETskeeverdesire.GetValue() - 20)
				SuH_PETskeeverdesire.SetValue(y)
			else
				int x = Math.Floor(10 + SuH_PETskeeverxp.GetValue())
				SuH_PETskeeverxp.SetValue(x)
				levelPet("skeever")
				int y = Math.Floor(SuH_PETskeeverdesire.GetValue() - 10)
				SuH_PETskeeverdesire.SetValue(y)
			endIf
		endIf
	elseif petID == "familiar" ; if actor is familiar
		if actionID == "hit"
			int x = Math.Floor(1 + SuH_PETfamiliarxp.GetValue())
			SuH_PETfamiliarxp.SetValue(x)
			levelPet("familiar")
			int y = Math.Floor(SuH_PETfamiliardesire.GetValue() - 10)
				SuH_PETfamiliardesire.SetValue(y)
		elseif sceneID != "none" ; if in a scene
			if actionID == "orgasm" ; if triggered from orgasm
				int x = Math.Floor(50 + SuH_PETfamiliarxp.GetValue())
				SuH_PETfamiliarxp.SetValue(x)
				levelPet("familiar")
				int y = Math.Floor(SuH_PETfamiliardesire.GetValue() - 20)
				SuH_PETfamiliardesire.SetValue(y)
			else
				int x = Math.Floor(10 + SuH_PETfamiliarxp.GetValue())
				SuH_PETfamiliarxp.SetValue(x)
				levelPet("familiar")
				int y = Math.Floor(SuH_PETfamiliardesire.GetValue() - 10)
				SuH_PETfamiliardesire.SetValue(y)
			endIf
		endIf
	elseif petID == "bear" ; if actor is bear
		if actionID == "hit"
			int x = Math.Floor(1 + SuH_PETbearxp.GetValue())
			SuH_PETbearxp.SetValue(x)
			levelPet("bear")
			int y = Math.Floor(SuH_PETbeardesire.GetValue() - 10)
				SuH_PETbeardesire.SetValue(y)
		elseif sceneID != "none" ; if in a scene
			if actionID == "orgasm" ; if triggered from orgasm
				int x = Math.Floor(50 + SuH_PETbearxp.GetValue())
				SuH_PETbearxp.SetValue(x)
				levelPet("bear")
				int y = Math.Floor(SuH_PETbeardesire.GetValue() - 20)
				SuH_PETbeardesire.SetValue(y)
			else
				int x = Math.Floor(10 + SuH_PETbearxp.GetValue())
				SuH_PETbearxp.SetValue(x)
				levelPet("bear")
				int y = Math.Floor(SuH_PETbeardesire.GetValue() - 10)
				SuH_PETbeardesire.SetValue(y)
			endIf
		endIf
	elseif petID == "sabrecat" ; if actor is sabrecat
		if actionID == "hit"
			int x = Math.Floor(1 + SuH_PETsabrecatxp.GetValue())
			SuH_PETsabrecatxp.SetValue(x)
			levelPet("sabrecat")
			int y = Math.Floor(SuH_PETsabrecatdesire.GetValue() - 10)
				SuH_PETsabrecatdesire.SetValue(y)
		elseif sceneID != "none" ; if in a scene
			if actionID == "orgasm" ; if triggered from orgasm
				int x = Math.Floor(50 + SuH_PETsabrecatxp.GetValue())
				SuH_PETsabrecatxp.SetValue(x)
				levelPet("sabrecat")
				int y = Math.Floor(SuH_PETsabrecatdesire.GetValue() - 20)
				SuH_PETsabrecatdesire.SetValue(y)
			else
				int x = Math.Floor(10 + SuH_PETsabrecatxp.GetValue())
				SuH_PETsabrecatxp.SetValue(x)
				levelPet("sabrecat")
				int y = Math.Floor(SuH_PETsabrecatdesire.GetValue() - 10)
				SuH_PETsabrecatdesire.SetValue(y)
			endIf
		endIf
	elseif petID == "draugr" ; if actor is draugr
		if actionID == "hit"
			int x = Math.Floor(1 + SuH_PETdraugrxp.GetValue())
			SuH_PETdraugrxp.SetValue(x)
			levelPet("draugr")
			int y = Math.Floor(SuH_PETdraugrdesire.GetValue() - 10)
				SuH_PETdraugrdesire.SetValue(y)
		elseif sceneID != "none" ; if in a scene
			if actionID == "orgasm" ; if triggered from orgasm
				int x = Math.Floor(50 + SuH_PETdraugrxp.GetValue())
				SuH_PETdraugrxp.SetValue(x)
				levelPet("draugr")
				int y = Math.Floor(SuH_PETdraugrdesire.GetValue() - 20)
				SuH_PETdraugrdesire.SetValue(y)
			else
				int x = Math.Floor(10 + SuH_PETdraugrxp.GetValue())
				SuH_PETdraugrxp.SetValue(x)
				levelPet("draugr")
				int y = Math.Floor(SuH_PETdraugrdesire.GetValue() - 10)
				SuH_PETdraugrdesire.SetValue(y)
			endIf
		endIf
	elseif petID == "troll" ; if actor is troll
		if actionID == "hit"
			int x = Math.Floor(1 + SuH_PETtrollxp.GetValue())
			SuH_PETtrollxp.SetValue(x)
			levelPet("troll")
			int y = Math.Floor(SuH_PETtrolldesire.GetValue() - 10)
				SuH_PETtrolldesire.SetValue(y)
		elseif sceneID != "none" ; if in a scene
			if actionID == "orgasm" ; if triggered from orgasm
				int x = Math.Floor(50 + SuH_PETtrollxp.GetValue())
				SuH_PETtrollxp.SetValue(x)
				levelPet("troll")
				int y = Math.Floor(SuH_PETtrolldesire.GetValue() - 20)
				SuH_PETtrolldesire.SetValue(y)
			else
				int x = Math.Floor(10 + SuH_PETtrollxp.GetValue())
				SuH_PETtrollxp.SetValue(x)
				levelPet("troll")
				int y = Math.Floor(SuH_PETtrolldesire.GetValue() - 10)
				SuH_PETtrolldesire.SetValue(y)
			endIf
		endIf
	elseif petID == "spriggan" ; if actor is spriggan
		if actionID == "hit"
			int x = Math.Floor(1 + SuH_PETsprigganxp.GetValue())
			SuH_PETsprigganxp.SetValue(x)
			levelPet("spriggan")
			int y = Math.Floor(SuH_PETspriggandesire.GetValue() - 10)
				SuH_PETspriggandesire.SetValue(y)
		elseif sceneID != "none" ; if in a scene
			if actionID == "orgasm" ; if triggered from orgasm
				int x = Math.Floor(50 + SuH_PETsprigganxp.GetValue())
				SuH_PETsprigganxp.SetValue(x)
				levelPet("spriggan")
				int y = Math.Floor(SuH_PETspriggandesire.GetValue() - 20)
				SuH_PETspriggandesire.SetValue(y)
			else
				int x = Math.Floor(10 + SuH_PETsprigganxp.GetValue())
				SuH_PETsprigganxp.SetValue(x)
				levelPet("spriggan")
				int y = Math.Floor(SuH_PETspriggandesire.GetValue() - 10)
				SuH_PETspriggandesire.SetValue(y)
			endIf
		endIf
	elseif petID == "horker" ; if actor is horker
		if actionID == "hit"
			int x = Math.Floor(1 + SuH_PEThorkerxp.GetValue())
			SuH_PEThorkerxp.SetValue(x)
			levelPet("horker")
			int y = Math.Floor(SuH_PEThorkerdesire.GetValue() - 10)
				SuH_PEThorkerdesire.SetValue(y)
		elseif sceneID != "none" ; if in a scene
			if actionID == "orgasm" ; if triggered from orgasm
				int x = Math.Floor(50 + SuH_PEThorkerxp.GetValue())
				SuH_PEThorkerxp.SetValue(x)
				levelPet("horker")
				int y = Math.Floor(SuH_PEThorkerdesire.GetValue() - 20)
				SuH_PEThorkerdesire.SetValue(y)
			else
				int x = Math.Floor(10 + SuH_PEThorkerxp.GetValue())
				SuH_PEThorkerxp.SetValue(x)
				levelPet("horker")
				int y = Math.Floor(SuH_PEThorkerdesire.GetValue() - 10)
				SuH_PEThorkerdesire.SetValue(y)
			endIf
		endIf
	elseif petID == "falmer" ; if actor is falmer
		if actionID == "hit"
			int x = Math.Floor(1 + SuH_PETfalmerxp.GetValue())
			SuH_PETfalmerxp.SetValue(x)
			levelPet("falmer")
			int y = Math.Floor(SuH_PETfalmerdesire.GetValue() - 10)
				SuH_PETfalmerdesire.SetValue(y)
		elseif sceneID != "none" ; if in a scene
			if actionID == "orgasm" ; if triggered from orgasm
				int x = Math.Floor(50 + SuH_PETfalmerxp.GetValue())
				SuH_PETfalmerxp.SetValue(x)
				levelPet("falmer")
				int y = Math.Floor(SuH_PETfalmerdesire.GetValue() - 20)
				SuH_PETfalmerdesire.SetValue(y)
			else
				int x = Math.Floor(10 + SuH_PETfalmerxp.GetValue())
				SuH_PETfalmerxp.SetValue(x)
				levelPet("falmer")
				int y = Math.Floor(SuH_PETfalmerdesire.GetValue() - 10)
				SuH_PETfalmerdesire.SetValue(y)
			endIf
		endIf
	endIf
endFunction
;end/

;ent/ Pet Level
; [PetID - Which actor is being leveled by ID name]
Function levelPet(string petID)
	if petID == "summoner"
		int xp = SuH_PETsummonxp.GetValue() as int
		int level = SuH_PETsummonlevel.GetValue() as int
		int levelcost = Math.Floor((level*1.8) * 50 + 20)
		if xp >= levelcost
			xp -= levelcost
			level += 1
			SuH_PETsummonxp.SetValue(xp)
			SuH_PETsummonlevel.SetValue(level)
			; Display Message
			if level > 3
				debug.Notification("Summoner level has increased to "+level+"!")
			elseif level == 3
				SuH_PETdraugrunlock.SetValue(1)
				debug.Notification("Summoner level has increased to "+level+"! Draugr [Incubus] Has been Unlocked!")
			elseif level == 2
				SuH_PEThorseunlock.SetValue(1)
				debug.Notification("Summoner level has increased to "+level+"! Horse [Incubus] Has been Unlocked!")
			else
				debug.Notification("Summoner level has increased to "+level+"!")
			endIf
		endIf
	elseif petID == "dog"
		int xp = SuH_PETdogxp.GetValue() as int
		int level = SuH_PETdoglevel.GetValue() as int
		int levelcost = Math.Floor((level*1.8) * 50 + 20)
		if xp >= levelcost
			xp -= levelcost
			level += 1
			SuH_PETdogxp.SetValue(xp)
			SuH_PETdoglevel.SetValue(level)
			xpPET("summoner", valueINT=20)
			; Display Message
			if level > 4
				debug.Notification("Dog [Incubus] level has increased to "+level+"!")
			elseIf level == 4
				SuH_PETwolfunlock.SetValue(1)
				debug.Notification("Dog [Incubus] level has increased to "+level+"! Wolf [Incubus] Has Been Unlocked!")
			else
				debug.Notification("Dog [Incubus] level has increased to "+level+"!")
			endIf
		endIf
	elseif petID == "wolf"
		int xp = SuH_PETwolfxp.GetValue() as int
		int level = SuH_PETwolflevel.GetValue() as int
		int levelcost = Math.Floor((level*1.8) * 50 + 20)
		if xp >= levelcost
			xp -= levelcost
			level += 1
			SuH_PETwolfxp.SetValue(xp)
			SuH_PETwolflevel.SetValue(level)
			xpPET("summoner", valueINT=28)
			; Display Message
			if level > 6
				debug.Notification("Wolf [Incubus] level has increased to "+level+"!")
			elseif level == 6
				SuH_PETfamiliarunlock.SetValue(1)
				debug.Notification("Wolf [Incubus] level has increased to "+level+"! Flame Familiar [Incubus] Has Been Unlocked!")
			else
				debug.Notification("Wolf [Incubus] level has increased to "+level+"!")
			endIf
		endIf
	elseif petID == "horse"
		int xp = SuH_PEThorsexp.GetValue() as int
		int level = SuH_PEThorselevel.GetValue() as int
		int levelcost = Math.Floor((level*1.8) * 50 + 20)
		if xp >= levelcost
			xp -= levelcost
			level += 1
			SuH_PEThorsexp.SetValue(xp)
			SuH_PEThorselevel.SetValue(level)
			xpPET("summoner", valueINT=28)
			; Display Message
			if level > 4
				debug.Notification("Horse [Incubus] level has increased to "+level+"!")
			elseif level == 4
				SuH_PEThorkerunlock.SetValue(1)
				debug.Notification("Horse [Incubus] level has increased to "+level+"! Horker [Incubus] Has Been Unlocked!")
			else
				debug.Notification("Horse [Incubus] level has increased to "+level+"!")
			endIf
		endIf
	elseif petID == "skeever"
		int xp = SuH_PETskeeverxp.GetValue() as int
		int level = SuH_PETskeeverlevel.GetValue() as int
		int levelcost = Math.Floor((level*1.8) * 50 + 20)
		if xp >= levelcost
			xp -= levelcost
			level += 1
			SuH_PETskeeverxp.SetValue(xp)
			SuH_PETskeeverlevel.SetValue(level)
			xpPET("summoner", valueINT=20)
			; Display Message
			if level > 4
				debug.Notification("Skeever [Incubus] level has increased to "+level+"!")
			elseif level == 4
				SuH_PETbearunlock.SetValue(1)
				debug.Notification("Skeever [Incubus] level has increased to "+level+"! Bear [Incubus] Has Been Unlocked!")
			else
				debug.Notification("Skeever [Incubus] level has increased to "+level+"!")
			endIf
		endIf
	elseif petID == "familiar"
		int xp = SuH_PETfamiliarxp.GetValue() as int
		int level = SuH_PETfamiliarlevel.GetValue() as int
		int levelcost = Math.Floor((level*1.8) * 50 + 20)
		if xp >= levelcost
			xp -= levelcost
			level += 1
			SuH_PETfamiliarxp.SetValue(xp)
			SuH_PETfamiliarlevel.SetValue(level)
			xpPET("summoner", valueINT=40)
			; Display Message
			debug.Notification("Flame Familiar [Incubus] level has increased to "+level+"!")
		endIf
	elseif petID == "bear"
		int xp = SuH_PETbearxp.GetValue() as int
		int level = SuH_PETbearlevel.GetValue() as int
		int levelcost = Math.Floor((level*1.8) * 50 + 20)
		if xp >= levelcost
			xp -= levelcost
			level += 1
			SuH_PETbearxp.SetValue(xp)
			SuH_PETbearlevel.SetValue(level)
			xpPET("summoner", valueINT=28)
			; Display Message
			if level > 4
				debug.Notification("Bear [Incubus] level has increased to "+level+"!")
			elseif level == 4
				SuH_PETsabrecatunlock.SetValue(1)
				debug.Notification("Bear [Incubus] level has increased to "+level+"! Sabre Cat [Incubus] Has Been Unlocked!")
			else
				debug.Notification("Bear [Incubus] level has increased to "+level+"!")
			endIf
		endIf
	elseif petID == "sabrecat"
		int xp = SuH_PETsabrecatxp.GetValue() as int
		int level = SuH_PETsabrecatlevel.GetValue() as int
		int levelcost = Math.Floor((level*1.8) * 50 + 20)
		if xp >= levelcost
			xp -= levelcost
			level += 1
			SuH_PETsabrecatxp.SetValue(xp)
			SuH_PETsabrecatlevel.SetValue(level)
			xpPET("summoner", valueINT=36)
			; Display Message
			if level > 4
				debug.Notification("Sabre Cat [Incubus] level has increased to "+level+"!")
			elseif level == 4
				SuH_PETtrollunlock.SetValue(1)
				debug.Notification("Sabre Cat [Incubus] level has increased to "+level+"! Troll [Incubus] Has Been Unlocked!")
			else
				debug.Notification("Sabre Cat [Incubus] level has increased to "+level+"!")
			endIf
		endIf
	elseif petID == "draugr"
		int xp = SuH_PETdraugrxp.GetValue() as int
		int level = SuH_PETdraugrlevel.GetValue() as int
		int levelcost = Math.Floor((level*1.8) * 50 + 20)
		if xp >= levelcost
			xp -= levelcost
			level += 1
			SuH_PETdraugrxp.SetValue(xp)
			SuH_PETdraugrlevel.SetValue(level)
			xpPET("summoner", valueINT=26)
			; Display Message
			if level > 4
				debug.Notification("Draugr [Incubus] level has increased to "+level+"!")
			elseif level == 4
				SuH_PETsprigganunlock.SetValue(1)
				debug.Notification("Draugr [Incubus] level has increased to "+level+"! Spriggan [Succubus] Has Been Unlocked!")
			else
				debug.Notification("Draugr [Incubus] level has increased to "+level+"!")
			endIf
		endIf
	elseif petID == "troll"
		int xp = SuH_PETtrollxp.GetValue() as int
		int level = SuH_PETtrolllevel.GetValue() as int
		int levelcost = Math.Floor((level*1.8) * 50 + 20)
		if xp >= levelcost
			xp -= levelcost
			level += 1
			SuH_PETtrollxp.SetValue(xp)
			SuH_PETtrolllevel.SetValue(level)
			xpPET("summoner", valueINT=44)
			; Display Message
			debug.Notification("Troll [Incubus] level has increased to "+level+"!")
		endIf
	elseif petID == "Spriggan"
		int xp = SuH_PETSprigganxp.GetValue() as int
		int level = SuH_PETSprigganlevel.GetValue() as int
		int levelcost = Math.Floor((level*1.8) * 50 + 20)
		if xp >= levelcost
			xp -= levelcost
			level += 1
			SuH_PETSprigganxp.SetValue(xp)
			SuH_PETSprigganlevel.SetValue(level)
			xpPET("summoner", valueINT=34)
			; Display Message
			if level > 4
				debug.Notification("Spriggan [Succubus] level has increased to "+level+"!")
			elseif level == 4
				SuH_PETfalmerunlock.SetValue(1)
				debug.Notification("Spriggan [Succubus] level has increased to "+level+"! Falmer [Incubus] Has Been Unlocked!")
			else
				debug.Notification("Spriggan [Succubus] level has increased to "+level+"!")
			endIf
		endIf
	elseif petID == "horker"
		int xp = SuH_PEThorkerxp.GetValue() as int
		int level = SuH_PEThorkerlevel.GetValue() as int
		int levelcost = Math.Floor((level*1.8) * 50 + 20)
		if xp >= levelcost
			xp -= levelcost
			level += 1
			SuH_PEThorkerxp.SetValue(xp)
			SuH_PEThorkerlevel.SetValue(level)
			xpPET("summoner", valueINT=32)
			; Display Message
			debug.Notification("Horker [Incubus] level has increased to "+level+"!")
		endIf
	elseif petID == "falmer"
		int xp = SuH_PETfalmerxp.GetValue() as int
		int level = SuH_PETfalmerlevel.GetValue() as int
		int levelcost = Math.Floor((level*1.8) * 50 + 20)
		if xp >= levelcost
			xp -= levelcost
			level += 1
			SuH_PETfalmerxp.SetValue(xp)
			SuH_PETfalmerlevel.SetValue(level)
			xpPET("summoner", valueINT=42)
			; Display Message
			debug.Notification("Falmer [Incubus] level has increased to "+level+"!")
		endIf
	endIf
endFunction
;end/