trepleen Posted August 22, 2014 Posted August 22, 2014 I finally figured it out using the latest sexlab methodology. This code allows you to trigger a function from a quest script which sets the starting stage of an animation to play and what stage you want the animation to end on. You can fire this function from a dialogue line in a quest under papyrus fragments using this line: (GetOwningQuest() as KD_KatreenaDarkmoore_QuestDialogue). Stage30_SexScene() Here is the function that gets fired from the script attached to the quest under scripts tab. Scriptname KD_KatreenaDarkmoore_QuestDialogue extends Quest SexLabFramework property SexLab autoActor property KD_KatreenaDarkmoore autofunction Stage30_SexScene() ;Main sex control object sslThreadModel AnimationObject = SexLab.NewThread() ;add actors you want to be a part of this sex scene AnimationObject.AddActor(KD_KatreenaDarkmoore, isVictim = false) AnimationObject.AddActor(Game.GetPlayer(), isVictim = false) ;array that holds animations sslBaseAnimation[] anims anims = new sslBaseAnimation[1] ;specify animation we want to use anims[0] = SexLab.GetAnimationByName("Arrok Anal") ;I have no idea what this does AnimationObject.DisableLeadIn(true) ;attach the animation you specified from the array to the main sex control object AnimationObject.SetAnimations(anims) ;Don't try to auto center on a nearby bed AnimationObject.SetBedding(0) ;this makes it so event Start30_SexSceneEnd gets called when each stage reaches its end RegisterForModEvent("StageEnd_Stage30SexScene", "Start30_SexScene_StageEnd") ;We call this scene Stage30SexScene which will hook it to the registerformodevent above this line, this is important, make sure names match AnimationObject.SetHook("Stage30SexScene") ;What stage do you want arrok anal to begin from? I set it to 1, but you can set it to 2,3 etc AnimationObject.Stage = 1 ;Sets the animation in motion AnimationObject.StartThread()endFunctionevent Start30_SexScene_StageEnd(string eventName, string argString, float argNum, form sender) ;the controller object gives us the control needed to end an animation sslThreadController controller = SexLab.HookController(argString) ;has stage two just ended? if controller.stage >= 2 ;end animation and return everything back to normal controller.endanimation() endif ;cleanup I think UnregisterForModEvent("StageEnd_Stage30SexScene")endevent
trepleen Posted August 22, 2014 Author Posted August 22, 2014 I've made some progress. I need to use Hooks as specified here in the wiki: http://git.loverslab.com/sexlab/framework/wikis/function-hookstage If anyone can help me learn how to do this faster, that would be great.
trepleen Posted August 22, 2014 Author Posted August 22, 2014 I've made some progress. I need to use Hooks as specified here in the wiki: http://git.loverslab.com/sexlab/framework/wikis/function-hookstage If anyone can help me learn how to do this faster, that would be great. I'm so close, I just need to figure out how to make GoToStage work so I can start an animation from a specified stage. I've already figured out how to end an animation at a certain stage. I'll post the code as soon as I figure out how to start an animation at a specific stage.
Ashal Posted August 22, 2014 Posted August 22, 2014 Not sure what your asking. You can use GoToStage for for setting the current animation to goto that stage (if it exists), but if you want to force varying animations at varying stages you'll need to use use SetForcedAnimations() to give the scene a list of animations as well and then Setanimation() to select a specific animation within that list, and then followed by GoToStage(). That's all very inelegant though, you could also create a temporary custom animation that uses all the stages from various animations you want, which you can see a basic example of here: http://www.loverslab.com/topic/18708-sexlab-framework-development/?p=893127
trepleen Posted August 22, 2014 Author Posted August 22, 2014 Not sure what your asking. You can use GoToStage for for setting the current animation to goto that stage (if it exists), but if you want to force varying animations at varying stages you'll need to use use SetForcedAnimations() to give the scene a list of animations as well and then Setanimation() to select a specific animation within that list, and then followed by GoToStage(). That's all very inelegant though, you could also create a temporary custom animation that uses all the stages from various animations you want, which you can see a basic example of here: http://www.loverslab.com/topic/18708-sexlab-framework-development/?p=893127 I appreciate the response. I actually figured it out finally. Your framework was designed very well. What do you think of the code I posted in the original topic? It's at its most basic form. Cheers on the framework!
Ashal Posted August 22, 2014 Posted August 22, 2014 ;the controller object gives us the control needed to end an animation sslThreadController controller = SexLab.HookController(argString) ;this lets us find out what stage we are on int stage = SexLab.HookStage(argString) Getting the stage like this is unnecessary since you already have the controller. With the controller you can simply call controller.Stage to access the stage property. HookStage() is basically just a shortcut for calling "HookController(argstring).Stage" ;has stage two just ended? if stage == 2 should then be replaced with ;has stage two ended? if controller.stage >= 2 To remove the unnecessary HookStage() and changing it to >= instead of == ensures it ends properly, the player might be spamming the advance stage hotkey and actually end up on stage 3+
Recommended Posts
Archived
This topic is now archived and is closed to further replies.