NismoMan Posted February 9, 2015 Posted February 9, 2015 Okay, I hope I'm posting in the right place here, I'm working on something in the creationkit and wanted an item to be added to my inventory everytime my pc ends a sexlab animation. I fooled around for a while but it's taking me longer than expected trying to figure the script I need and where to add it. I assume that I should add the scrip to the item that I want to collect after each intercourse? say I want a health potion everytime my pc ends a scene with an NPC (just an example), should I add the script to the health potion? If yes, anyone willing to give me an sample script for this? I still can't get my head around integrating sexlab scripts with my mods yet, however with your help I could actually move on and release the mod I'm working on afterwards for whoever is interested in it. Thanks in advance
Guest Posted February 9, 2015 Posted February 9, 2015 Hello @NismoMan, if you want to do something when a SexLab animation ends, then you have to put an hook on the animation, and then in the hook you define you can do whatever you want. Here a small example: Function abcd() ... SexLab.QuickStart(actor1, actor2, Hook="MyHook") ; This will set an hook to the animation thread RegisterForModEvent("AnimationEnding_MyHook", "SexAnimEnded") ; this will register your current script for the event "AnimationEnding" for your Hook "MyHook", and this will call the function "SexAnimEnding" ... EndFunction Event SexAnimEnded(string eventName, string argString, float argNum, form sender) Actor[] Positions = SexLab.HookActors(argString) ; This will get all the actors involved in the sex scene Positions[0].AddItem(vortexDisruptionGreatBlade, 1) ; Gives the Vortex Disruption Great Blade to the first participant of the animation ; If you always want the Player then: PlayerRef..AddItem(vortexDisruptionGreatBlade, 1) ; Gives the Vortex Disruption Great Blade to the Player UnregisterForModEvent(eventName) ; We are done with this event, don't keep it busy EndEvent SexLabFramework Property SexLab Auto Weapon Property vortexDisruptionGreatBlade Auto Actor Property playerRef Auto
NismoMan Posted February 9, 2015 Author Posted February 9, 2015 Hello @NismoMan, if you want to do something when a SexLab animation ends, then you have to put an hook on the animation, and then in the hook you define you can do whatever you want. Here a small example: Function abcd() ... SexLab.QuickStart(actor1, actor2, Hook="MyHook") ; This will set an hook to the animation thread RegisterForModEvent("AnimationEnding_MyHook", "SexAnimEnded") ; this will register your current script for the event "AnimationEnding" for your Hook "MyHook", and this will call the function "SexAnimEnding" ... EndFunction Event SexAnimEnded(string eventName, string argString, float argNum, form sender) Actor[] Positions = SexLab.HookActors(argString) ; This will get all the actors involved in the sex scene Positions[0].AddItem(vortexDisruptionGreatBlade, 1) ; Gives the Vortex Disruption Great Blade to the first participant of the animation ; If you always want the Player then: PlayerRef..AddItem(vortexDisruptionGreatBlade, 1) ; Gives the Vortex Disruption Great Blade to the Player UnregisterForModEvent(eventName) ; We are done with this event, don't keep it busy EndEvent SexLabFramework Property SexLab Auto Weapon Property vortexDisruptionGreatBlade Auto Actor Property playerRef Auto Hey CPU74! Thanks for pitching in, that actually was quite helpful, but I believe it's not what I had in mind; correct me if I'm wrong but in order to use the function and hook you provided, I'd have to initiate an animation through my mod, right? I'm thinking more of a way that the mod "recognizes" that an act is initiated (by any mod, such as defeat, solutions... etc) and gives an item when the animation ends. is it possible? or am I out of luck on this one? Thanks for the great help above, I've learnt a thing or two there
Guest Posted February 9, 2015 Posted February 9, 2015 Hi. Technically it is possible but way more complex. In this case you don't have to hook a single animation but all the events. Something similar is done (pretty easy way) in SexLab Cumshot, you may want to have a look there to understand how they hook globally the "OrgasmEnd" event. You can try this: RegisterForModEvent("AnimationEnding", "SexAnimEnded") In this case you should receive the event for every animation. Of course you have to init it in some safe place like a function like OnInit for the first time, OnPlayerLoadGame. I am not sure if the registering for mod event will survive the game reloads.
NismoMan Posted February 9, 2015 Author Posted February 9, 2015 Hi. Technically it is possible but way more complex. In this case you don't have to hook a single animation but all the events. Something similar is done (pretty easy way) in SexLab Cumshot, you may want to have a look there to understand how they hook globally the "OrgasmEnd" event. You can try this: RegisterForModEvent("AnimationEnding", "SexAnimEnded") In this case you should receive the event for every animation. Of course you have to init it in some safe place like a function like OnInit for the first time, OnPlayerLoadGame. I am not sure if the registering for mod event will survive the game reloads. Ah, makes sense, I guess I'll have a look at SLAB Cumshot for reference, I haven't really caught the relationship until you've mentioned it! I'll fool around some more with the mod, I'll update here if I ran into any issues, Thanks CPU74!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.