Jump to content

Sexlab scripting - how to equip armor on AnimationChange event?


Recommended Posts

Ok, so I tried to write a little script using the Sexlab API in order to get collisions for sex toys.

The basic idea was to wait for sexlab animation events, hook the animation by name and equip a custom havok object for each animation that involves a sex toy.

And to a degree this works, but only to a degree.

And since I think I hit a wall with this here is my problem:

 

When I use the AnimationChange event to make my char equip the custom havok object then this seems to work at first glance, the thing gets equipped according to the inventory.

But the collisions I attached to it (custom xml) aren't there. To get these I have to unequip and reequip the havok object in the inventory.

 

So I tested the script a bit more and instead of the havok object I tried to equip a normal armor on that AnimationChange event.

Same exact thing, my inventory tells me that it got equipped but it doesn't show up on my character. The mesh doesn't change.

What's odd is that the same stuff works flawlessly for both the AnimationStart and AnimationEnd events. Might it be that Sexlab intercepts some call from my script as a safety measure so other mods can't override the Sexlab strip settings in the middle of an animation? I seriously don't know and I would appreciate any help.

 

Here's a little bit of Papyrus source code (using Sexlab API functions):

 

 

Scriptname HDTSextoys extends ReferenceAlias

 

SexLabFramework Property SexLab Auto
Actor Property PlayerREF Auto
Armor Property FemaleToyVaginal Auto

 

Event OnPlayerLoadGame()

  RegisterForModEvent("AnimationChange", "HDTSextoySwitch")

EndEvent

 

Event HDTSextoySwitch(string eventName, string argString, float argNum, form sender)

  sslBaseAnimation animation = SexLab.HookAnimation(argString)
  If animation.name == "Leito Female Toy Vaginal"
  PlayerREF.EquipItem(FemaleToyVaginal, false, true)
  EndIf
EndEvent

 
edit: It doesn't have anything to do with the Sexlab strip settings btw. I unchecked the box for slot 57, the one where my custom havok object gets equipped at. Didn't help.
Link to comment

I just had an idea.

Maybe this isn't Sexlab related but caused by Devious Devices? Slot 57 seems to be the one used for vaginal plugs.

It doesn't make sense that the armor wouldn't show though ...

Will change the Devices Underneath settings and maybe change the slot from 57 to 60 if that doesn't help.#

 

edit:

Devious Devices or any of its dependencies are not guilty. I tried changing the settings in the Devices Underneath submenu - no luck, changed the body slot for my havok object in the CK and the nif - still no change, even uninstalled Devious Devices completely and made a "clean" save.

AnimationChange still doesn't equip armors properly.

 

... Could it be that equipping stuff in the middle of a running animation just doesn't work (unless you open the inventory but that brings the game and the animation to a halt so it's different)?

Link to comment

Ha, I finally figured out how to do this!  :D

Seems like my assumption that equipped stuff doesn't get updated in the middle of an animation was correct.

But there is a way to enforce that update.

 

Yay!

 

So the only thing still missing is knowing how to register animation changes triggered through Sexlab Tools. The animation change function in Sexlab itself is a little too basic and the switches done through SL Tools don't trigger the Sexlab API AnimationChange event. Meaning I have to find a way for my script to listen to whatever function SL Tools uses when it changes the animation set.

 

... It was nice talking to myself. Always a pleasure.  :P

Link to comment

i look forward to your xmls bazinga. im using your naturalistic and beast xmls right now and im really looking forward to collisions on animobjects. i personally attach xmls to all my bodies so i don't deal with havok objects (ie i just dled the new slal packs for hanimations and attached hdtdildo.xml to all my armors, so i don't have to worry about havok objects or use an extra esp slot for them and the dildo collides just fine)

 

btw im not sure which objects you made xmls for but if i may make a request--please make one for nibble's dildo animation. huge fan of nibbles anims, amazing stuff

Link to comment

 

btw im not sure which objects you made xmls for but if i may make a request--please make one for nibble's dildo animation. huge fan of nibbles anims, amazing stuff

Of course I will include Nibbles' animation.

 

There's a limit to what I can do with havok objects though. If the sex toy or object is moving on its own without someone holding it (that mimic chest or Estrus for example) then I'm afraid this method won't work.

Link to comment

 

 

btw im not sure which objects you made xmls for but if i may make a request--please make one for nibble's dildo animation. huge fan of nibbles anims, amazing stuff

Of course I will include Nibbles' animation.

 

There's a limit to what I can do with havok objects though. If the sex toy or object is moving on its own without someone holding it (that mimic chest or Estrus for example) then I'm afraid this method won't work.

 

 

that's still awesome. im surprised it hasn't already been done yet tbh. when i dl'ed hanimations and tropicalisland my first instinct was to try to figure out how it is they manage to get collisions to work on them and work so well. unfortunately the only tools i have to work with are jff and nifskope so i didn't really know how to visualize the havok shapes defined in the xml files.

 

if it weren't for the fact that they require a full 1.0 scale body to even play the animations, i would have kept OSA in my load order just for those specific animations, even if they didn't have the integration SL anims have. but the 1.0 body scale requirement was too much for me

 

really excited about the fact that someone is finally going to add some collisions to animobject animations. this is going to go great with the new Lure function from PSQ giving an incentive to play solo anims

Link to comment

Archived

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

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use