CyberQueen Posted July 17, 2024 Posted July 17, 2024 I was hoping you guys could help me out with some scripting. I'm trying to do two things... First: I'm trying to advance to a new stage at the end of a sexlab animation with my player. The code I use is... sslThreadModel AnimationObject = SexLab.NewThread() AnimationObject.AddActor(Game.GetPlayer(), isVictim = false) AnimationObject.AddActor(akSpeaker, isVictim = false) sslBaseAnimation[] anims anims = new sslBaseAnimation[1] anims[0] = SexLab.GetAnimationByName("Animation Name") AnimationObject.DisableLeadIn(true) AnimationObject.SetAnimations(anims) AnimationObject.SetBedding(0) AnimationObject.SetHook("TestingFoo") RegisterForModEvent("AnimationStart_" + "TestingFoo", "TestingFoo") AnimationObject.StartThread() I place it inside the dialogue fragment which in this case is what I'm trying to do and it works fine. What code do I need to change to set a new stage after the animation ends? Second: I'm trying to figure out the code for multiple sex scenes happening at once. For example me and three other girls are having sex with guys / wolves but each with our own animations going that all start at once, so four different sex animations with specific tags. And let's say I'd want to place this inside the dialogue fragment as well. Any help would be appreciated:)
Gristle Posted July 17, 2024 Posted July 17, 2024 5 hours ago, CyberQueen said: I was hoping you guys could help me out with some scripting. I'm trying to do two things... First: I'm trying to advance to a new stage at the end of a sexlab animation with my player. The code I use is... sslThreadModel AnimationObject = SexLab.NewThread() AnimationObject.AddActor(Game.GetPlayer(), isVictim = false) AnimationObject.AddActor(akSpeaker, isVictim = false) sslBaseAnimation[] anims anims = new sslBaseAnimation[1] anims[0] = SexLab.GetAnimationByName("Animation Name") AnimationObject.DisableLeadIn(true) AnimationObject.SetAnimations(anims) AnimationObject.SetBedding(0) AnimationObject.SetHook("TestingFoo") RegisterForModEvent("AnimationStart_" + "TestingFoo", "TestingFoo") AnimationObject.StartThread() I place it inside the dialogue fragment which in this case is what I'm trying to do and it works fine. What code do I need to change to set a new stage after the animation ends? Second: I'm trying to figure out the code for multiple sex scenes happening at once. For example me and three other girls are having sex with guys / wolves but each with our own animations going that all start at once, so four different sex animations with specific tags. And let's say I'd want to place this inside the dialogue fragment as well. Any help would be appreciated:) I'm not using threads but my code looks a bit different than yours. See yellow part below: SexLab.StartSex(acts, anims, CenterOn = SexSpot, hook = "SexEndHook") RegisterForModEvent("HookAnimationEnd_SexEndHook", "SexEndHandler") Also, the event can't be in a dialogue script fragment. You have to put it in a regular script attached to the quest. The dialogue fragment is "fire and forget". It won't sit and listen for any events. Here's an event example: Event SexEndHandler(int tid, bool HasPlayer) QuestName.SetStage(100) EndEvent As for multiple sex scenes at the same time, you just start them one immediately after the other. SexLab will run them all in parallel.
CyberQueen Posted July 17, 2024 Author Posted July 17, 2024 5 hours ago, Gristle said: I'm not using threads but my code looks a bit different than yours. See yellow part below: SexLab.StartSex(acts, anims, CenterOn = SexSpot, hook = "SexEndHook") RegisterForModEvent("HookAnimationEnd_SexEndHook", "SexEndHandler") Also, the event can't be in a dialogue script fragment. You have to put it in a regular script attached to the quest. The dialogue fragment is "fire and forget". It won't sit and listen for any events. Here's an event example: Event SexEndHandler(int tid, bool HasPlayer) QuestName.SetStage(100) EndEvent As for multiple sex scenes at the same time, you just start them one immediately after the other. SexLab will run them all in parallel. Umm, yea I'm not getting it. Sorry I'm not great at modding and I only know some basic stuff. The code I use is just something else I saw someone else use, I'm not entirely sure how it works. Would you be willing to give more examples? Let's say my quest name is Quest01; I'm speaking to Lydia in stage 10 and in the dialogue fragment at the end of the conversation we have sex using a specific animation (Lets say it's Billyy Doggy 1 ). Then after the sex it sets to stage 20. And let's also say I want to do that multiple times through the same quest. What code do I put into the dialogue fragment and what code do I put into the scripts tab? A similar example for multiple sex scenes would be vary helpful too, thank you:)
ghastley Posted July 17, 2024 Posted July 17, 2024 (edited) I would keep the dialogue code down to just setting a stage, and have the stage code run the sex scene. You will have more stages that way, but that is unlikely to be a problem. I.e talking to Lydia sets stage 15. Stage 15 runs all the sex, and the event handler(s) set stage 20 when everyone is done. Edited July 17, 2024 by ghastley
Gristle Posted July 18, 2024 Posted July 18, 2024 8 hours ago, CyberQueen said: Umm, yea I'm not getting it. Sorry I'm not great at modding and I only know some basic stuff. The code I use is just something else I saw someone else use, I'm not entirely sure how it works. Would you be willing to give more examples? Let's say my quest name is Quest01; I'm speaking to Lydia in stage 10 and in the dialogue fragment at the end of the conversation we have sex using a specific animation (Lets say it's Billyy Doggy 1 ). Then after the sex it sets to stage 20. And let's also say I want to do that multiple times through the same quest. What code do I put into the dialogue fragment and what code do I put into the scripts tab? A similar example for multiple sex scenes would be vary helpful too, thank you:) If you're talking to Lydia on stage 10, your dialogue end fragment could be something like: Actor[] acts = new Actor[2] acts[0] = akSpeaker acts[1] = Game.GetPlayer() sslBaseAnimation[] anims = SexLab.getAnimationsByTags(2, "MF") SexLab.StartSex(acts, anims, hook = "Quest01SexEndHook") RegisterForModEvent("HookAnimationEnd_Quest01SexEndHook", "Quest01SexEndHandler") (Note the above is not for a specific animation - I don't use those so don't know it off the top of my head. The above also assumes the PC is male. Of course, you could have alternate dialogue for a female PC using a "FF" animation tag.) Also, note that you need to set up and fill a property for Sexlab to make this work. Let me know if you don't know how do to that. Also, before you do this, you should make sure you set up a script prefix under the CK, Preferences, Scripts, so that your scripts are automatically named with a unique prefix and so that you can find them later. Otherwise, it will be next to impossible to package up your mod. But then to listen for the mod event you set up, you need to go to the Scripts tab and add a new quest, give it some name (ideally with your chosen mod 3- or 4-letter prefix, so you can easily find it later), and then add the following to it: Quest Property Quest01 Auto Event Quest01SexEndHandler(int tid, bool HasPlayer) if Quest01.GetStage() == 10 Quest01.SetStage(20) endif EndEvent Note that for the above you need to fill the quest property. Let me know if you don't know how to do that. You could also expand this script for other stages: Quest Property Quest01 Auto Event Quest01SexEndHandler(int tid, bool HasPlayer) if Quest01.GetStage() == 10 Quest01.SetStage(20) elseif Quest01.GetStage() == 40 Quest01.SetStage(50) endif EndEvent For running two sex scenes at the same time, you just start them both, one after another: Actor[] acts = new Actor[2] acts[0] = akSpeaker acts[1] = Game.GetPlayer() sslBaseAnimation[] anims = SexLab.getAnimationsByTags(2, "MF") SexLab.StartSex(acts, anims) Actor[] acts = new Actor[2] acts[0] = Actor3 acts[1] = Actor4 sslBaseAnimation[] anims = SexLab.getAnimationsByTags(2, "MF") SexLab.StartSex(acts, anims, hook = "Quest01SexEndHook") RegisterForModEvent("HookAnimationEnd_Quest01SexEndHook", "Quest01SexEndHandler") Note that I only set up one ending hook. I assume multiple would not be needed. The above is untested, but I think it's right. Also, as ghastley noted, it's probably a better practice to just use the dialogue script fragment to advance the stage, and then put the actual sex stuff in the quest stage script. That said, I tend to put sex stuff in dialogue fragments because 1) I can just use akSpeaker to pick up the other actor, and 2) I can easily use the dialogue conditions to tell the genders of the actors, and then use that to adjust the tags on the scripts on the relevant dialogue.
CyberQueen Posted July 18, 2024 Author Posted July 18, 2024 18 hours ago, Gristle said: If you're talking to Lydia on stage 10, your dialogue end fragment could be something like: Actor[] acts = new Actor[2] acts[0] = akSpeaker acts[1] = Game.GetPlayer() sslBaseAnimation[] anims = SexLab.getAnimationsByTags(2, "MF") SexLab.StartSex(acts, anims, hook = "Quest01SexEndHook") RegisterForModEvent("HookAnimationEnd_Quest01SexEndHook", "Quest01SexEndHandler") (Note the above is not for a specific animation - I don't use those so don't know it off the top of my head. The above also assumes the PC is male. Of course, you could have alternate dialogue for a female PC using a "FF" animation tag.) Also, note that you need to set up and fill a property for Sexlab to make this work. Let me know if you don't know how do to that. Also, before you do this, you should make sure you set up a script prefix under the CK, Preferences, Scripts, so that your scripts are automatically named with a unique prefix and so that you can find them later. Otherwise, it will be next to impossible to package up your mod. But then to listen for the mod event you set up, you need to go to the Scripts tab and add a new quest, give it some name (ideally with your chosen mod 3- or 4-letter prefix, so you can easily find it later), and then add the following to it: Quest Property Quest01 Auto Event Quest01SexEndHandler(int tid, bool HasPlayer) if Quest01.GetStage() == 10 Quest01.SetStage(20) endif EndEvent Note that for the above you need to fill the quest property. Let me know if you don't know how to do that. You could also expand this script for other stages: Quest Property Quest01 Auto Event Quest01SexEndHandler(int tid, bool HasPlayer) if Quest01.GetStage() == 10 Quest01.SetStage(20) elseif Quest01.GetStage() == 40 Quest01.SetStage(50) endif EndEvent For running two sex scenes at the same time, you just start them both, one after another: Actor[] acts = new Actor[2] acts[0] = akSpeaker acts[1] = Game.GetPlayer() sslBaseAnimation[] anims = SexLab.getAnimationsByTags(2, "MF") SexLab.StartSex(acts, anims) Actor[] acts = new Actor[2] acts[0] = Actor3 acts[1] = Actor4 sslBaseAnimation[] anims = SexLab.getAnimationsByTags(2, "MF") SexLab.StartSex(acts, anims, hook = "Quest01SexEndHook") RegisterForModEvent("HookAnimationEnd_Quest01SexEndHook", "Quest01SexEndHandler") Note that I only set up one ending hook. I assume multiple would not be needed. The above is untested, but I think it's right. Also, as ghastley noted, it's probably a better practice to just use the dialogue script fragment to advance the stage, and then put the actual sex stuff in the quest stage script. That said, I tend to put sex stuff in dialogue fragments because 1) I can just use akSpeaker to pick up the other actor, and 2) I can easily use the dialogue conditions to tell the genders of the actors, and then use that to adjust the tags on the scripts on the relevant dialogue. Thank you so much this is vary helpful. I'm going to test it all out and let you know how it goes!
DarkBlade13 Posted July 18, 2024 Posted July 18, 2024 48 minutes ago, CyberQueen said: Thank you so much this is vary helpful. I'm going to test it all out and let you know how it goes! First you need some code as given below actor[] sexActors = new actor[2] sexActors[0] = akSpeaker sexActors[1] = Game.GetPlayer() sslBaseAnimation[] anims anims = SexLab.GetAnimationsByTag(2, "Cowgirl", tagSuppress="Lesbian") RegisterForModEvent("AnimationEnd_AfterSexEvent", "OnAfterSexEvent") SexLab.StartSex(sexActors, anims, hook="AfterSexEvent") actor[] sexActors = new actor[2] sexActors[0] = Girl1 sexActors[1] = Guy1 sslBaseAnimation[] anims anims = SexLab.GetAnimationsByTag(2, "Cowgirl", tagSuppress="Blowjob") SexLab.StartSex(sexActors, anims) actor[] sexActors = new actor[2] sexActors[0] = Girl2 sexActors[1] = Guy2 sslBaseAnimation[] anims anims = SexLab.GetAnimationsByTag(2, "Aggressive", tagSuppress="Loving") SexLab.StartSex(sexActors, anims) actor[] sexActors = new actor[2] sexActors[0] = Girl3 sexActors[1] = Guy3 sslBaseAnimation[] anims anims = SexLab.GetAnimationsByTag(2, "Doggystyle", tagSuppress="Laying") SexLab.StartSex(sexActors, anims) You can add more tags like: tagSuppress="Straight", "Laying", "Loving" but this didn't work in dialogue script for me. After this you need to go into your script and add the properties. Event OnAfterSexEvent(string eventName, string argString, float argNum, form sender) UnRegisterForModEvent("OnAfterSexEvent") If (MyQuestName.GetStage()==10) MyQuestName.SetStage(20) Else MyQuestName.Reset() MyQuestName.SetStage(0) EndIf EndEvent ObjectReference Property Girl1 Auto ObjectReference Property Girl2 Auto ObjectReference Property Girl3 Auto ObjectReference Property Guy1 Auto ObjectReference Property Guy2 Auto ObjectReference Property Guy3 Auto Quest Property MyQuestName Auto SexLabFramework Property SexLab auto The tags can be found in the sslAnimationDefaults.psc file and you can open it with notepad++ witch is free. You also need to link these defined properties in creation kit to work. If you need more help on how to link them you can read my blog, send me a message or I can add you in discord. I hope this helps.
CyberQueen Posted July 19, 2024 Author Posted July 19, 2024 3 hours ago, DarkBlade13 said: First you need some code as given below actor[] sexActors = new actor[2] sexActors[0] = akSpeaker sexActors[1] = Game.GetPlayer() sslBaseAnimation[] anims anims = SexLab.GetAnimationsByTag(2, "Cowgirl", tagSuppress="Lesbian") RegisterForModEvent("AnimationEnd_AfterSexEvent", "OnAfterSexEvent") SexLab.StartSex(sexActors, anims, hook="AfterSexEvent") actor[] sexActors = new actor[2] sexActors[0] = Girl1 sexActors[1] = Guy1 sslBaseAnimation[] anims anims = SexLab.GetAnimationsByTag(2, "Cowgirl", tagSuppress="Blowjob") SexLab.StartSex(sexActors, anims) actor[] sexActors = new actor[2] sexActors[0] = Girl2 sexActors[1] = Guy2 sslBaseAnimation[] anims anims = SexLab.GetAnimationsByTag(2, "Aggressive", tagSuppress="Loving") SexLab.StartSex(sexActors, anims) actor[] sexActors = new actor[2] sexActors[0] = Girl3 sexActors[1] = Guy3 sslBaseAnimation[] anims anims = SexLab.GetAnimationsByTag(2, "Doggystyle", tagSuppress="Laying") SexLab.StartSex(sexActors, anims) You can add more tags like: tagSuppress="Straight", "Laying", "Loving" but this didn't work in dialogue script for me. After this you need to go into your script and add the properties. Event OnAfterSexEvent(string eventName, string argString, float argNum, form sender) UnRegisterForModEvent("OnAfterSexEvent") If (MyQuestName.GetStage()==10) MyQuestName.SetStage(20) Else MyQuestName.Reset() MyQuestName.SetStage(0) EndIf EndEvent ObjectReference Property Girl1 Auto ObjectReference Property Girl2 Auto ObjectReference Property Girl3 Auto ObjectReference Property Guy1 Auto ObjectReference Property Guy2 Auto ObjectReference Property Guy3 Auto Quest Property MyQuestName Auto SexLabFramework Property SexLab auto The tags can be found in the sslAnimationDefaults.psc file and you can open it with notepad++ witch is free. You also need to link these defined properties in creation kit to work. If you need more help on how to link them you can read my blog, send me a message or I can add you in discord. I hope this helps. I can't seem to get it to work. In the dialogue fragment I place: actor[] sexActors = new actor[2] sexActors[0] = akSpeaker sexActors[1] = Game.GetPlayer() sslBaseAnimation[] anims anims = SexLab.GetAnimationsByTag(2, "Cowgirl", tagSuppress="Lesbian") RegisterForModEvent("AnimationEnd_AfterSexEvent", "OnAfterSexEvent") SexLab.StartSex(sexActors, anims, hook="AfterSexEvent") I set the sexlab property and fill it. Then I make a new script under the scripts tab and in that script I put: Quest Property Quest01 Auto ObjectReference Property Girl1 Auto ObjectReference Property Girl2 Auto ObjectReference Property Girl3 Auto ObjectReference Property Guy1 Auto ObjectReference Property Guy2 Auto ObjectReference Property Guy3 Auto SexLabFramework Property SexLab auto Event OnAfterSexEvent(string eventName, string argString, float argNum, form sender) UnRegisterForModEvent("OnAfterSexEvent") If (Quest01.GetStage()==0) Quest01.SetStage(10) EndIf EndEvent I fill the quest and sexlab property's. (I'm only testing one animation and trying to get it to work before I do mulstiple so I'm not filling the Girl1 or Guy1 properties yet) Also, I'm starting the quest on stage 0. So in game, dialogue shows up and sex scene starts like normal but the stage doesn't progress after sex. I've placed SetObjectiveDisplayed(10) in the quest stage 10 so that I can tell it's changed too. I must be missing something... Is there more code that needs to go in the quest I place under the scripts tab?
CyberQueen Posted July 19, 2024 Author Posted July 19, 2024 4 hours ago, CyberQueen said: Thank you so much this is vary helpful. I'm going to test it all out and let you know how it goes! I tried those codes and I can't seem to get it to work, I also tried the code of Darkblade13 listed below. Dialogue shows up, sexscene starts, but the quest does not progress to a new stage after the sex. I know I must be missing something.
CyberQueen Posted July 19, 2024 Author Posted July 19, 2024 21 hours ago, Gristle said: If you're talking to Lydia on stage 10, your dialogue end fragment could be something like: Actor[] acts = new Actor[2] acts[0] = akSpeaker acts[1] = Game.GetPlayer() sslBaseAnimation[] anims = SexLab.getAnimationsByTags(2, "MF") SexLab.StartSex(acts, anims, hook = "Quest01SexEndHook") RegisterForModEvent("HookAnimationEnd_Quest01SexEndHook", "Quest01SexEndHandler") (Note the above is not for a specific animation - I don't use those so don't know it off the top of my head. The above also assumes the PC is male. Of course, you could have alternate dialogue for a female PC using a "FF" animation tag.) Also, note that you need to set up and fill a property for Sexlab to make this work. Let me know if you don't know how do to that. Also, before you do this, you should make sure you set up a script prefix under the CK, Preferences, Scripts, so that your scripts are automatically named with a unique prefix and so that you can find them later. Otherwise, it will be next to impossible to package up your mod. But then to listen for the mod event you set up, you need to go to the Scripts tab and add a new quest, give it some name (ideally with your chosen mod 3- or 4-letter prefix, so you can easily find it later), and then add the following to it: Quest Property Quest01 Auto Event Quest01SexEndHandler(int tid, bool HasPlayer) if Quest01.GetStage() == 10 Quest01.SetStage(20) endif EndEvent Note that for the above you need to fill the quest property. Let me know if you don't know how to do that. You could also expand this script for other stages: Quest Property Quest01 Auto Event Quest01SexEndHandler(int tid, bool HasPlayer) if Quest01.GetStage() == 10 Quest01.SetStage(20) elseif Quest01.GetStage() == 40 Quest01.SetStage(50) endif EndEvent For running two sex scenes at the same time, you just start them both, one after another: Actor[] acts = new Actor[2] acts[0] = akSpeaker acts[1] = Game.GetPlayer() sslBaseAnimation[] anims = SexLab.getAnimationsByTags(2, "MF") SexLab.StartSex(acts, anims) Actor[] acts = new Actor[2] acts[0] = Actor3 acts[1] = Actor4 sslBaseAnimation[] anims = SexLab.getAnimationsByTags(2, "MF") SexLab.StartSex(acts, anims, hook = "Quest01SexEndHook") RegisterForModEvent("HookAnimationEnd_Quest01SexEndHook", "Quest01SexEndHandler") Note that I only set up one ending hook. I assume multiple would not be needed. The above is untested, but I think it's right. Also, as ghastley noted, it's probably a better practice to just use the dialogue script fragment to advance the stage, and then put the actual sex stuff in the quest stage script. That said, I tend to put sex stuff in dialogue fragments because 1) I can just use akSpeaker to pick up the other actor, and 2) I can easily use the dialogue conditions to tell the genders of the actors, and then use that to adjust the tags on the scripts on the relevant dialogue. I placed in dialogue fragment: Actor[] acts = new Actor[2] acts[0] = akSpeaker acts[1] = Game.GetPlayer() sslBaseAnimation[] anims = SexLab.getAnimationsByTags(2, "MF") SexLab.StartSex(acts, anims, hook = "Quest01SexEndHook") RegisterForModEvent("HookAnimationEnd_Quest01SexEndHook", "Quest01SexEndHandler") The only property is the sexlab one which I filled. I made the new quest script under the scripts tab and placed: SexLabFramework Property SexLab auto Quest Property Quest01 Auto Event Quest01SexEndHandler(int tid, bool HasPlayer) if Quest01.GetStage() == 0 Quest01.SetStage(10) endif EndEvent I filled the property's on this. In game: the dialogue shows up fine, the sex scene starts, but after the scene the stage doesn't advance to stage 10. I've placed SetObjectiveDisplayed(10) in he quest stage box of stage 10 so that I can make sure. What do you think I'm missing?
Gristle Posted July 19, 2024 Posted July 19, 2024 5 hours ago, CyberQueen said: I placed in dialogue fragment: Actor[] acts = new Actor[2] acts[0] = akSpeaker acts[1] = Game.GetPlayer() sslBaseAnimation[] anims = SexLab.getAnimationsByTags(2, "MF") SexLab.StartSex(acts, anims, hook = "Quest01SexEndHook") RegisterForModEvent("HookAnimationEnd_Quest01SexEndHook", "Quest01SexEndHandler") The only property is the sexlab one which I filled. I made the new quest script under the scripts tab and placed: SexLabFramework Property SexLab auto Quest Property Quest01 Auto Event Quest01SexEndHandler(int tid, bool HasPlayer) if Quest01.GetStage() == 0 Quest01.SetStage(10) endif EndEvent I filled the property's on this. In game: the dialogue shows up fine, the sex scene starts, but after the scene the stage doesn't advance to stage 10. I've placed SetObjectiveDisplayed(10) in he quest stage box of stage 10 so that I can make sure. What do you think I'm missing? I don't see any obvious issues. Let me take another look at my code. In the meantime, I would add a message box so you can see clearly whether the event is working or not. Event Quest01SexEndHandler(int tid, bool HasPlayer) debug.MessageBox("The sex has ended") if Quest01.GetStage() == 0 Quest01.SetStage(10) endif EndEvent Also, dumb question, but is the quest on stage 0 when the sex starts?
CyberQueen Posted July 19, 2024 Author Posted July 19, 2024 4 hours ago, Gristle said: I don't see any obvious issues. Let me take another look at my code. In the meantime, I would add a message box so you can see clearly whether the event is working or not. Event Quest01SexEndHandler(int tid, bool HasPlayer) debug.MessageBox("The sex has ended") if Quest01.GetStage() == 0 Quest01.SetStage(10) endif EndEvent Also, dumb question, but is the quest on stage 0 when the sex starts? Yes it is.
CyberQueen Posted July 19, 2024 Author Posted July 19, 2024 2 hours ago, CyberQueen said: Yes it is. I added the debug message and it never showed up so the event isn't getting triggered.
CyberQueen Posted July 21, 2024 Author Posted July 21, 2024 Finally figured everything out. Anyone who want to know and I'll post all the code I used on here.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now