Jump to content

Recommended Posts

Posted

Leash Framework

View File

Framework that allows you to attach REAL leashes to NPC's and either have them guide you around, or you guide them. No real limitation, you can make a huge train if you wanted. 

 

I'm releasing this in it's current beta state! I've yet to find any serious bugs, but I do want to gauge the community to see if this mod is worth continuing further or expanding upon. 

 

 

Important Note

This is a FRAMEWORK. NPC's are expected to have AI packages with locomotion. If you try to use it on an NPC who is leaning against a wall, playing an animation, guarding the whiterun gate - this mod ~WILL NOT~ make them follow. Your mod is also expected to equip the leash.

 

Features

  • Rich Papyrus API for connecting actors together in any order you will
  • Advanced physics system that takes full advantage of HAVOK
  • Easy to use debug menu for testing, or just using the mod freely
  • Zero package interruption, this mod has it's own built-in AI system, pathfinder, and locomotion system. Your mod's packages will never be touched!
  • Full support for the player actor, other actors, etc. No animal support yet, although that wouldn't be difficult
  • Contains two test leashes by @kzrp to mess around with
  • Supports ANY/ALL leashes, they just need a series of bones for this mod to move around! This means that all the chain collars in devious devices are fully compatible!

 

How to use (Without Papyrus API)

  • Enough the leash to the actor (Or a leash, it can be any leash like from devious devices)
  • Go into the SKSE Mod Menu using `f1`, find this mod. Open `Debug`. 
  • Select the leasher, and the leashed. Leasher MUST have that leash equipped, the mod doesn't do it for you - stop being lazy
  • The parent bone is `NPC Spine2 [Spn2]` for the included leash. This can be any parent of the chain bones, even just NPC
  • The `Leash Bone Match` is `Leash1` for the included leash. This is the prefix of the bones (or common name) in your leash
  • Select a minimum distance, like ~200+. Don't go too low or it'll be fucked. 
  • `Persistent` means it'll persist with your save. 
  • Click `Leash actor`
  • Enjoy
  • (Note: Make sure the collar/leash is equipped to the actor, this mod doesn't auto equip it)

 

For a funnier experience, go into `Settings` and enable `Forced recovery for NPCs`. This will rag doll the actor once they exceed the distance threshold. Works well!

 

Known issues/limitations

  • The leash will visibility disappear if the leashed actor is not on-screen. This is due to screen culling. Fixable, but I don't know if it's work it - you tell ME. It still functions fine
  • An actor can get stuck obviously. There's no teleport recovery yet
  • The collision isn't perfect. I tried to make it perfect and it was too heavy. So instead it only collides with the surfaces of materials such as the ground, etc. You can enable actor collision in the SKSE Mod Menu too, but that uses the havok hull not the physical body meshes so not perfect
  • The less bones in the leash, the more fucked it'll be when stretching a long distance
  • Mod still lacks polish obviously. It's polished in loverslab standards though!
  • Only supports right hand, because left handed people are satan spawns (Other hands will be supported in the future)

 

Requirements

  • Skyrim SE/AE (Doubt VR support works, this required a lot of reverse engineering)
  • SKSE Mod Menu Framework (Optional for the mod menu)

 

Papyrus API

Scriptname LeashFramework Hidden

;/
Active leash factions supplied by Leash.esp:
- LeashedFaction (form ID 0x000D6A): contains actors that currently have an active leash.
- LeasherFaction (form ID 0x000D6B): contains actors that currently hold one or more active leashes.

Pull mod events:
- LeashFramework_OnActorPulled: sent once when normal direct-locomotion pulling starts.
- LeashFramework_OnActorRagdollPulled: sent once when forced ragdoll pulling starts.

Register with RegisterForModEvent. Both events use the leashed Actor as sender, leave strArg empty,
and provide the holder-to-collar distance at the transition in numArg. An event can be sent again only
after that pull mode stops and later starts again; it is not sent every frame while pulling remains active.
/;

;/
Connects a leash from a holder's right hand to leash bones on another actor.

holder: Actor holding the leash. The current attachment bone is NPC R Hand [RHnd].
leashed: Actor wearing the leash mesh. An actor can have only one active leash.
parentBone: Exact node name to find on the leashed actor before searching its descendants.
leashBoneMatch: Text found anywhere in each ordered leash bone name beneath parentBone. For example,
Main_ matches hdtSSEPhysics_AutoRename_Armor_00000004 Main_01 after SMP renames the node.
minLength: Distance where active leash pulling stops. Must be zero or greater.
maxLength: Maximum holder-to-collar distance. Must be positive and at least minLength.
persistent: When true, the leash is saved and restored until explicitly disconnected.

Applying another leash to the same leashed actor replaces its current leash.
Returns true when the arguments are valid and the leash is accepted.
/;
Bool Function ApplyLeash(Actor holder, Actor leashed, String parentBone, String leashBoneMatch, Float minLength, Float maxLength, Bool persistent) Global Native

;/
Disconnects the leash matching the specific holder and leashed actor.

holder: Actor holding the leash.
leashed: Actor wearing the leash mesh.

Returns true when the matching leash was disconnected.
/;
Bool Function DisconnectLeash(Actor holder, Actor leashed) Global Native

;/
Disconnects every leash where actor is either the holder or the leashed actor.

Returns true when at least one leash was disconnected.
/;
Bool Function UnleashAll(Actor actor) Global Native

;/
Returns true when actor currently has an active leash.
/;
Bool Function IsLeashed(Actor actor) Global Native

;/
Returns true when actor currently holds at least one active leash.
/;
Bool Function IsLeashHolder(Actor actor) Global Native

;/
Returns the actor holding leashed's active leash, or None when leashed has no active leash.
/;
Actor Function GetLeashHolder(Actor leashed) Global Native

;/
Returns every actor currently leashed to holder. Returns an empty array when holder has no active leashes.
/;
Actor[] Function GetLeashedActors(Actor holder) Global Native

;/
Returns the minimum length of leashed's active leash, or -1.0 when leashed has no active leash.
/;
Float Function GetMinLeashLength(Actor leashed) Global Native

;/
Returns the maximum length of leashed's active leash, or -1.0 when leashed has no active leash.
/;
Float Function GetMaxLeashLength(Actor leashed) Global Native

;/
Sets the minimum length of leashed's active leash.

newLength must be zero or greater and cannot exceed the current maximum length.
Returns false when leashed has no active leash or newLength is invalid.
/;
Bool Function SetMinLeashLength(Actor leashed, Float newLength) Global Native

;/
Sets the maximum length of leashed's active leash.

newLength must be positive and cannot be less than the current minimum length.
Returns false when leashed has no active leash or newLength is invalid.
/;
Bool Function SetMaxLeashLength(Actor leashed, Float newLength) Global Native

 

Future todos:

  • Allow attaching the rope to specific bones rather than just the right hand
  • Add explicit API to disable walking control (For now just set minLength/maxLength to high numbers so it never triggers)

 

Known issues:

  • Actors can get stuck on objects like doors rarely
  • Some chains may not converge well (Gaps) - increase the solve iterations in the SKSE Mod Menu
  • Actors wont follow you between load doors (Not a problem, lack of a feature)

 

Source code:

(Soon, check my github in a few days)


  • Submitter
  • Submitted
    07/28/26
  • Category
  • Requirements
  • Regular Edition Compatible
  • Install Instructions

 

Posted

The leash stays attached to the victim as a static object after freeing them. 

 

I was just thinking about why there wasn't a leash mod a few nights ago, seems like someone was working on one. This has loads of potential, good work as always.

ScreenShot1.png

Posted
17 minutes ago, BobaBibba said:

The leash stays attached to the victim as a static object after freeing them. 

 

I was just thinking about why there wasn't a leash mod a few nights ago, seems like someone was working on one. This has loads of potential, good work as always.

 

This is just a framework. It's not designed to handle the equipping/un-equipping that's beyond the scope of the mod. Mods using this framework will do that. 

Posted (edited)

This is delightful and amazing :) Bravo! :)

 

p.s. Hmm, I wonder if someday this leash framework will replace the follow mechanism of mods like Prison Alternative or Slaverun or the like where you're supposed to automatically follow guards to a pama furniture or ZAZ furniture. In my game that follow mechanism has at most a 25% chance of success. Usually the auto-avigation walks me into walls. A leash system might be capable of allowing us to continue walking on our own, limited by the bounds of a leash to the guard.

Edited by Karna5
Posted
9 minutes ago, Karna5 said:

Hmm, I wonder if someday this leash framework will replace the follow mechanism of mods like Prison Alternative

Actually, if this has a "visual only" option (i.e not forcing its own ai packages on actors), this could easily be made into a soft dependency.


But if it works in a completely different way to regular ai packages this might be interesting as well. Looking forward to hearing from the author.
I would actually be willing to implement this on fairly short notice, so he can gather some more organic feedback.

Posted
20 minutes ago, Pamatronic said:

Oh Boy, this is actually VERY interesting.
Mind giving a small explanation on how this works under the hood? 

 

The rope is essentially a custom physics system that I built into Skyrim's havok engine. So it's similar to SMP physics in many ways, but uses havok instead of Bullet physics since I managed to reverse enough of it to make it viable. Then I built the constraint solver just using XPBD physics. The mesh (rope in this case) stretching is just Skyrim's IK system. 

 

The following was ironically the hardest part. Mods kept overriding my package, and the package broke behaviors I didn't want to break. So I reversed Skyrim's locomotion system (Movement controller) and injected a custom one that overlaps on top. So when you see the NPC's and what not walking, it's purely locomotion - zero package. Making it (In theory) compatible with any/all mods. 

 

I also ended up having to create a pathfinder because Skyrim's kept getting NPC's hung up on every tiny thing. So it uses a simple A* algorithm on the navmesh. However I didn't really bother with improving the smoothing pass or the heuristics so it still need more work. 

 

That also should largely answer your other concern, this mod is indeed purely "visual" in the sense that it is largely stateless. The only state it will manage is the PlayerAI toggle. Although if you want to make it entirely visual, you can just set the min/max to some high number and my locomotion system will never take over. 

 

 

16 minutes ago, sacredfire said:

Are we going to get more leash types?  I would love to finally have a good chain lease for a chain gang.

You just use whatever leash already exists. All the smp leashes on here will work out of the box. Just go into NifSckope and figure out a common shared name between all the bones, and a parent. The leashes provided in this mod are no different than any other leash. 

 

Posted (edited)

Does/can this work on LE? I don't use LE, but some mod authors want their mods to work the same on both versions of Skyrim and it would suck if they couldn't/wouldn't use something as awesome as this because of versioning issues.

Edited by shrtjsrtj
Posted (edited)

this is awesome. thanks for sharing

 

  

3 hours ago, asdt123123 said:
  • Zero package interruption, this mod has it's own built-in AI system, pathfinder, and locomotion system. Your mod's packages will never be touched!

 

so if packages are not touched, then it's purely aesthetic?
and it's up to the player, a 3rd party mod to make sure A follows B (B holds the leash)?

 

Edit: can't get it to work: tried the debug menu > equip the item, persistent ticked and untick, tweaked the variation slider. neither PC NPC or NPC NPC version works for me

 

 

Edited by Fraying9981
Posted
1 hour ago, DukeDog said:

would it be possible to reverse it to have the player on the leash

 

In the video the PC was leashed to a guard while 2 NPC was leashed to the PC, so it seems to be very versial.

Posted

Super rad! I didn't get the ragdoll/past range effects as a player on a leash, but the visuals were rad and im super excited to see where it goes, and I'm looking forward to implementing it in my own mod!

Posted (edited)
7 hours ago, asdt123123 said:

Mods using this framework will do that

If it is comparable with the leash in Conan Exiles and the player can be leashed as well I will integrate it into MariaEden asap. I have an invisible leash system (actually based on Vanilla Escort Package) there already and a lot of quests are using it, integrating yours shouldn't be a big deal.

 

Interesting would be if the leash holder can ride a mount - because in MEP the master will buy a horse and escort the player while riding.

Edited by zaira
Posted

Its peak, I'm afraid.

 

The leash gets a little weird when it's pulled taught, there's a weird bend in it near the player:
 

Spoiler

image.thumb.png.383e2cf14d9347f91c5c32e2758bb005.png

 

I know it's probably done like that to avoid some odd clipping but I feel like the bend could be a bit higher up. I saw you talking about that earlier with kzrp so maybe it already got fixed or it's a known problem. Either way not a big deal.

 

Otherwise it works great, whether used as just a visual or with the actual pulling enabled.

 

Any chance we could tether the leash to an object? Like a hook on the wall or something of that sort? Can always just use an invisible inanimate npc to do it but just being able to pass a static object would be neat.

Posted

I looked into the code - as I am not an expert in meshes and bones area, I have no idea what to pass into the bone parameters...
Some examples would be helpful

Posted
1 minute ago, zaira said:

I looked into the code - as I am not an expert in meshes and bones area, I have no idea what to pass into the bone parameters...
Some examples would be helpful

 

If you are using the included leash then the values are listed under the How to use (Without Papyrus API) header.

 

For reference here's what I did, you can see the bone values here:

 

Spoiler

image.png.a93accba4218a4782c7578119fe51273.png

Posted

Also works with the chain collar from DDNG:

 

Spoiler

 

image.png.3fb9e8f8d4680628fa9f5c15764757dd.png

 

There are some gaps in the chain though which I think is more a problem with the chain mesh and not the mod, as the chain on the collar is split into multiple nodes instead of a single one. The chain also deforms a lot when it's pulled taught but that could probably be mitigated by fine tuning the length settings.

Posted (edited)

I wonder how bad things would break if the rope used Movable Chains....


Would a C api be possible?

Edited by Dowser

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...