Jump to content

Code for defloration mod?


randomtguy

Recommended Posts

Posted

I posted about this in a comment on a thread in the adult mods section, but I figure it's better suited here. How feasible would it be to make a mod that detects the first time a female player character is having vaginal sex and adds a blood texture (probably just the vaginal cum texture painted red) to simulate defloration?

 

Looking at the SexLab documentation I'd say it'd be possible. But the documentation, while thorough, is understandably written with the assumption that people reading are familiar with the basics of scripting, which I'm not. Below is my best guess at what the scripting would need to be based purely on the descriptions of the commands.

SexLabFramework property SexLab auto

event OnInit()
    RegisterForModEvent(string AnimationStart, string defloration)
    
event defloration(string AnimationStart, string argString, float argNum, form sender)
    
    sslThreadController function GetActorController(PlayerRef)
    sslBaseAnimation.HasTag(Vaginal)
    int function GetGender(Actor PlayerRef)
    int vaginalLevel = SexLab.GetPlayerStatLevel("Vaginal")
    if controller.HasPlayer
    if GetGender = 1
    if vaginalLevel = 0
           function ApplyCum(Actor PlayerRef, int CumID) 8

endIf

I'm sure it's all sorts of wrong, I don't know what argString is supposed to be just for a start. But what it's supposed to do is on AnimationStart, check if the player is involved, check if the animation uses the vaginal tag, check if the player is female, check if the player's vaginal 'skill' level is 0, and if all that is true apply a special eighth 'cum' texture. 

 

Of course, even if the scripting would work the mod would also need to add to add the eighth 'cum' effect to SexLab, is that something that would be possible?

 

It would also be good to add the ability on NPCs to give those who play males (or futas etc) the chance to deflower NPCs, but I don't think even Aroused tracks the sexual history of every woman in Skyrim? I did notice something in the documentation about being able to track custom stats, so I suppose the solution would be to make females virgins by default and then use the mod to record who's been deflowered. But that's so far beyond me I wouldn't know where to start.

 

Any experienced modders who actually know what the hell they're doing want to chime in? Am I even in the right sport with my code, let alone the right ballpark? Your input would be greatly appreciated.

Posted

Someone asked about this long ago and someone replied that it'd be easy to do but there was never anything else about it.

I don't know anything about coding myself but you might be able to find something with Apropos as that has a section for that.

Posted

the code itself doesnt look bad for a start, the thing is indeed you got to make blood(as a cum) and add it on sexlab, i do think the only one who can help you then is almost only Ashal so maybe a pm or something like that to ashal will help.

Posted

the code itself doesnt look bad for a start, the thing is indeed you got to make blood(as a cum) and add it on sexlab, i do think the only one who can help you then is almost only Ashal so maybe a pm or something like that to ashal will help.

 

Thanks for the tip, Ashal said it currently isn't possible, but CPU has given me hope by saying he uses a method to apply a custom cum effect in Cum Shot Brothel, so I may be able to figure out how to do it from that.

 

I've been working on the code, though I still have no idea what I'm doing. I thought I'd try to add the function for NPCs as well, but as I said I'm pretty sure SexLab only tracks the player's vaginal skill level, so I think I have to use HadSex for NPCs, which would mean it wouldn't work if they've previously had oral or anal. Here's what I have for anyone following this thread or who might be able to look it over. It's supposed to add the effect after sex as well and add a delay so it replaces the default cum texture, but I don't know if I have to replicate the code for the AnimationEnd event. I still have the redundant AddCum effect as a placeholder for if and until I can figure out adding a custom cum effect.

SexLabFramework property SexLab auto

event OnInit()
	RegisterForModEvent(string AnimationStart, string defloration)
	RegisterForModEvent(string AnimationEnd, string postdefloration)
	RegisterForModEvent(string AnimationStart, string NPCdefloration)
	RegisterForModEvent(string AnimationEnd, string NPCpostdefloration)


event defloration(string AnimationStart, string argString, float argNum, form sender)

	sslThreadController function GetActorController(ActorRef)
	sslBaseAnimation.HasTag(Vaginal)
	bool IsFemale = GetSex(ActorRef) == 1
	int vaginalLevel = SexLab.GetPlayerStatLevel("Vaginal")
	if controller.HasPlayer
	if IsFemale = 0
	if vaginalLevel = 0
        	function ApplyCum(Actor PlayerRef, int CumID) 8
		Utility.Wait(2)	
		Debug.MessagesBox("You wince as your hymen rips and tears")
	endif

UnregisterForModEvent("AnimationStart")

event postdefloration(string AnimationEnd, string argString, float argNum, form sender)
 
	sslThreadController function GetActorController(ActorRef)
	sslBaseAnimation.HasTag(Vaginal)
	bool IsFemale = GetSex(ActorRef) == 1
	int vaginalLevel = SexLab.GetPlayerStatLevel("Vaginal")
	if controller.HasPlayer
	if IsFemale = 0
	if vaginalLevel = 0
		Utility.Wait(0.01)
       		function ApplyCum(Actor PlayerRef, int CumID) 8
		Debug.MessagesBox("You have been deflowered")
	endif

UnregisterForModEvent("AnimationEnd")

event NPCdefloration(string AnimationStart, string argString, float argNum, form sender)
    	sslThreadController function GetActorController(ActorRef)	
	sslBaseAnimation.HasTag(Vaginal)
	bool function HadSex(Actor ActorRef)
	bool IsFemale = GetSex(ActorRef) == 1
	if ActorRef != PlayerRef
	if HadSex = 0
	if IsFemale = 1
        	function ApplyCum(Actor PlayerRef, int CumID) 8
	endIf
	
UnregisterForModEvent("AnimationStart")

endEvent

event NPCpostdefloration (string AnimationEnd, string argString, float argNum, form sender)

	sslThreadController function GetActorController(ActorRef)
	sslBaseAnimation.HasTag(Vaginal)
	bool function HadSex(Actor ActorRef)
	bool IsFemale = GetSex(ActorRef) == 1
	if ActorRef != PlayerRef
	if HadSex = 0
	if IsFemale = 1
		Utility.Wait(0.01)
        	function ApplyCum(Actor PlayerRef, int CumID) 8
	endIf
		
UnregisterForModEvent("AnimationEnd")

endEvent

Posted

I thought I'd try a third approach, making use of the custom stat tracking. Again, I have no idea if this'll work, though I'm slightly more confident in this version.

SexLabFramework property SexLab auto

event OnInit()
	int function RegisterStat(string Deflowered, string 0, string Prepend = "Deflowered")
	RegisterForModEvent(string AnimationStart, string defloration)
	RegisterForModEvent(string AnimationEnd, string postdefloration)

event defloration(string AnimationStart, string argString, float argNum, form sender)

	sslThreadController function GetActorController(ActorRef)
	sslBaseAnimation.HasTag(Vaginal)
	bool IsFemale = GetSex(ActorRef) == 1
	string function GetActorStat(Actor ActorRef, string Deflowered)
	if IsFemale = 1
	if Deflowered = 0
        	function ApplyCum(Actor ActorRef, int CumID) 8
			if controller.HasPlayer
				Utility.Wait(2)	
				Debug.MessagesBox("You wince as your hymen rips and tears")
			endif
	endif

UnregisterForModEvent("AnimationStart")

event postdefloration(string AnimationEnd, string argString, float argNum, form sender)
 
	sslThreadController function GetActorController(ActorRef)
	sslBaseAnimation.HasTag(Vaginal)
	bool IsFemale = GetSex(ActorRef) == 1
	string function GetActorStat(Actor ActorRef, string Deflowered)
	if IsFemale = 1
	if Deflowered = 0
		Utility.Wait(0.1)	
        	function ApplyCum(Actor ActorRef, int CumID) 8
		String function SetActorStat(Actor ActorRef, string Deflowered, string "1")
			if controller.HasPlayer
				Debug.MessagesBox("You have been deflowered")
			else Debug.MessagesBox("A girl has become a woman")
		endif
	endif

UnregisterForModEvent("AnimationEnd")


Posted

I honestly haven't looked too far into the SL API but from a quick look at your code, a big issue is gonna be that not all of your conditionals (If) have the matching closing statement (endif) all of them need one. Also, EndEvent statements for each event.

 

Second, my recommendation is not to use a messagebox, but a notification, at least for the "a girl has become a woman" and "you wince..." messages. 

 

You're gonna want to put "GetSex(ActorRef) == 1" in parenthesis probably. I'm nit sure if papyrus would handle that as written but I wouldn't expect it to. Furthermore, it might be better (and definitely safer) to break that into two lines, declare "isFemale" and then cast a value in the next line instead of one complex declaration/cast.

 

Additionally, you don't actually set the "deflowered" variable to 1 anywhere. Since you unregister for the events though I guess that doesn't matter though. (I'd also recommend using a bool for that, since it will only ever have two states.) Didn't realize that was a stat in this case. 

 

You're also going to want to put the "unregister" code inside the block that actually shows the "X has been deflowered" because right now it just stops listening for the events whether or not it happens to anyone.

 

If you want this to work on just the player this will work (with a bit of polishing) but if you want to apply it to NPC's it's gonna be tricky. See, right now this code will run once (Assuming you attach it to a quest) and then it will unregister for the events and never check again. I recommend removing the unregister declaration completely, slapping this on a quest, and putting the check for the stat as the first part of the code, using a "Return" if it's false. This way, even though it will be a little script heavy by firing whenever an animation starts and ends, it will also stop very quickly provided it's not needed.

 

If you want I could write up a quick and dirty script some time tomorrow to show you what all this meant.

 

 

Edit: More on the deflowered stat, I'm a little rusty on modifying and calling stats, but just referencing it by name isn't how to do it. You want something like (Actor.Stat as int)" probably, with a possible function to return the value, I don't quite remember; so you're gonna want to declare deflowered as a variable and cast the stat's value to it, and then set that to 1 or whatever when they are deflowered so the script doesn't deflower them every time they have sex.

 

Edit2: You totally set the stat to one I don't know what I'm saying, somehow I missed that. But uh, why a string? Does it have to work that way? Seems like a function for stats would handle itself in integers or floats.

Posted

I honestly haven't looked too far into the SL API but from a quick look at your code, a big issue is gonna be that not all of your conditionals (If) have the matching closing statement (endif) all of them need one. Also, EndEvent statements for each event.

 

Second, my recommendation is not to use a messagebox, but a notification, at least for the "a girl has become a woman" and "you wince..." messages. 

 

You're gonna want to put "GetSex(ActorRef) == 1" in parenthesis probably. I'm nit sure if papyrus would handle that as written but I wouldn't expect it to. Furthermore, it might be better (and definitely safer) to break that into two lines, declare "isFemale" and then cast a value in the next line instead of one complex declaration/cast.

 

Additionally, you don't actually set the "deflowered" variable to 1 anywhere. Since you unregister for the events though I guess that doesn't matter though. (I'd also recommend using a bool for that, since it will only ever have two states.) Didn't realize that was a stat in this case. 

 

You're also going to want to put the "unregister" code inside the block that actually shows the "X has been deflowered" because right now it just stops listening for the events whether or not it happens to anyone.

 

If you want this to work on just the player this will work (with a bit of polishing) but if you want to apply it to NPC's it's gonna be tricky. See, right now this code will run once (Assuming you attach it to a quest) and then it will unregister for the events and never check again. I recommend removing the unregister declaration completely, slapping this on a quest, and putting the check for the stat as the first part of the code, using a "Return" if it's false. This way, even though it will be a little script heavy by firing whenever an animation starts and ends, it will also stop very quickly provided it's not needed.

 

If you want I could write up a quick and dirty script some time tomorrow to show you what all this meant.

 

 

Edit: More on the deflowered stat, I'm a little rusty on modifying and calling stats, but just referencing it by name isn't how to do it. You want something like (Actor.Stat as int)" probably, with a possible function to return the value, I don't quite remember; so you're gonna want to declare deflowered as a variable and cast the stat's value to it, and then set that to 1 or whatever when they are deflowered so the script doesn't deflower them every time they have sex.

 

Edit2: You totally set the stat to one I don't know what I'm saying, somehow I missed that. But uh, why a string? Does it have to work that way? Seems like a function for stats would handle itself in integers or floats.

 

Yep, the code's a disaster, I have no idea what I'm doing. But CPU has very kindly provided code for me, and it's a work of art. It works on any female player or NPC, uses an array to check whether they've been deflowered and reapplies the blood texture after the act to override the default vaginal cum texture.

 

I'm only really having one problem with it that I can't seem to fix. For some reason I can't figure out the replacement blood spell works fine if I start and end a scene naked, but if SexLab redresses me after sex it does not, when I undress there's just the usual cum texture. For troubleshooting I tried increasing the delay before the spell fires by a whole 5 seconds, well more than enough time for the SexLab cum effect to apply and be replaced, but it didn't help. I don't suppose you'd know why that would be, do you? Anyway, if I can't figure it out soon I'll probably release it.

 

If you are still willing to help out (and thanks so much for the offer by the way), there's something I'm thinking of adding (possibly in a future version) but don't know how to do, and I can't in good conscience ask CPU as he's already basically created this mod for me. That is spells to restore the player or the targeted NPCs virginity. This would basically just involve clearing them from the array of deflowered actors, which shouldn't be hard but you saw how little I know about coding. Is that something you might be able to help with?

 

Something else I'm thinking about adding is also applying a blood texture to the penis of the actor doing the deflowering, I think I can just copy CPU's code for applying the spell, it's creating the texture/shader that I know nothing about. I'm just using a recoloured vaginal cum texture for the female, but I doubt that'd work for the penis, plus ideally it would work on Schlongs of Skyrim and I don't even know how that'd work with the morphs.

 

Archived

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

  • Recently Browsing   0 members

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