Home - DeviousFramework/SkyrimDeviousFramework GitHub Wiki

Table of Contents

This Page
Mod Description
Reasons
Main Features
Mod Content
Support Mod
DeviousFramework API
API General
API Master
API Player Status
API Nearby Actors
API Leash
API NPC Disposition
API Outgoing Events
DeviousFramework Code Samples
Code Samples: General
Code Samples: Master
Code Samples: Player Status
Code Samples: Nearby Actors
Code Samples: Leash
Code Samples: NPC Disposition
Code Samples: Outgoing Events
Things I Learned
Things I Learned: Mod Dependencies - Removing
Things I Learned: Threadding and Mutexes
Things I Learned: ZaZ Player Slavery
Things I Learned: ZaZ Animations
Things I Learned: Devious Devices
Things I Learned: Zaz Animation Pack Devices
Things I Learned: Reporting Quest Variables
Things I Learned: Making a Clean Save

Mod Description

This mod is intended to support other mods that want to make use of devious devices and help them co-ordinate between each other. Additionally it is intended to help mod developers understand good processes for developing mods and writing papyrus scripts. Because there is such a vast number of features involved in writing scripts and implementing a mod this mod and it's documentation will also cover a great deal of topics. As such the documentation will be separated into quite a few sections. Many "features of the mod" will exist only in the documentation, such as "things I've learned" and examples of how to write scripts. This mod was built specifically to work with the Deviously Enslaved Continued mod; however, I hope that many mod developers will find it useful.

Reasons

  1. While looking into the Deviously Enslaved mod I found it was checking IsPlayerEnslaved(DCUR_SLUT_COLLAR) & IsPlayerEnslaved(SD+) & IsPlayerEnslaved(MARIA_EDEN) & IsPlayerEnslaved(DARKWIND_SLAVE_FACTION) ... There are well over a dozen such checks that need to be made. And there are dozens of other mods that would also need to make all of these same checks. Each time a new slavery mod is created all such mods would need to be updated to work with it. And the Deviously Enslaved mod only needs to check a few things: Is the player enslaveable? Can the mod use the player for sex? and Will adding restraints cause trouble for other mods? Using a generic "IsPlayerEnslaved()" function doesn't specifically answer these questions as well as it should.
  2. ZAZ Animation Pack has done a fair bit of work in this area. It has a faction to identify if the player is enslaved. If all of the mods (Devious Cursed Loot, SD+, Maria Eden, Darkwind Island) set this flag properly, Deviously Enslaved would only need to make one check. IsPlayerInZazSlaveryFaction(). I don't know the reason many of the mods don't use the ZAZ Animation Pack interface. Perhaps it is not documented well enough or its existence is not know widely enough. While use of the interfaces provided by ZAZ would improve things greatly, it still has some shortcomings:
    2-a) It only keeps track of player slavery. Just because the player is enslaved doesn't mean she is not available for further slavery (purchased for example). And the player being a slave doesn't tell us if she is off limits for sex.
    2-b) Additionally with the ZAZ interface you can take an actor and determine if she is a slave, a slave owner, a slaver, or none of the above. But what you can't determine is which slave they own or who owns them. Yes, you can find out the player is enslaved. But it is much more difficult to determine who is controlling the player. It is not unreasonable to need to know if the player's controller is nearby. For instance a brigand can harass the player if the player's controller is nowhere to be found. At home, perhaps allowing the player to wander on her own.
  3. The Deviously Enslaved mod also checks how "vulnerable" the player is. Based on restraints she is wearing, clothing, whether it is night or not. It seems to me that a great number of mods could be interested in this information and having a readily accessible, centralized, standardized vulnerability value could help a number of mods and reduce the overhead of each mod keeping track of such things.
  4. The clothing information options are rather limited, complex, and scattered. Creating an API that allows for more detailed clothing information seems like it could have a lot of potential. The player can't dress herself in a top when she is locked in an arm binder or yoke but maybe she can wriggle into a skirt or leggings. Similarly the player can't put on greaves, full body armour, or leggins when her legs are locked with a hobble. This mod strives to enhance this game play by providing better information on what is a chest piece, a waist piece, or a full body outfit. It even has a hobble exception list that skirts and dresses can be added to.
  5. NPC dispositions (whether they want to help the player, see her in more bondage, or take advantage of her helplessness) has always been a random reaction. You could ask the NPC for help once and get a very aggressive reaction and ask him again a few seconds later and get a very helpful reaction. While this is not really implemented yet I want to keep track of the NPC dispositions for actors that have been interacted with recently or often.
  6. A lot of information was difficult for me to come by. I wanted a module that would provide me with some of this information on demand: What factions an actor is in, what slots an article of clothing has, what keywords the clothing has, etc.
  7. In addition to the main module, I am working on an accompanying support module that can help bridge the gap between some modules. For example it can detect when SD+ slavery has begun and register the player as a slave in the ZAZ Animation Pack interface. Whether things like this are useful is still to be determined but it is something I am looking into.
  8. While this was not a reason for my developing the mod, I created a periodic spell to keep track of nearby actors. I don't know whether this is a fast enough process to really be usable mainstream; however, I have not had any trouble with it and it may turn out to be quite useful.
  9. While this was not a reason for my developing the mod, I created a leash interface as a bit of an experiment. I know there are other leash system out there (Devious Integration, Prison Overhaul) but I have yet to find one I am happy with. Some of the problems I've found is the leash holder will follow the player (rather than the other way around). The player is "compelled" into walking toward the leash holder. And there is no visible indication of the leash. I have tried to address these issues with my leash but more than that, it would be nice to centralize leash functions into one place. The MCM could allow the player to select what style of leash they like, Devious Integration, Prison Overhaul, basic teleport, or drag and jerk. And this style could be used by most of the features in other mods.

Main Features

Masters: This mod allows other mods to keep track of two "Masters" or actors controlling the player, nearby and distant Masters. Hopefully this will prevent mods from acting spontaneously on the player when they are already involved in a separate quest or scene.
Allowed Sex/Enslavement: In addition to keeping track of Masters this mod allows other mods to keep track of whether sex, enslavement, adding restraints, or dressing is allowed.
Nearby Actors: This mod keeps track of nearby actors and some basic information about their status (slaves, slavers, children, guards, etc.)
Behaviour Persistence: If this mod is used to keep track of an actor's disposition toward the player this disposition will be kept (for at least a while). This will help prevent an actor from having no interest in helping the player and then choosing to be completely helpful when asked the same question again.
The disposition values that I intend to store are: Anger toward the player; Confidence of the NPC; How dominant the NPC is; and How interested he is in the player.
Player Vulnerability: This mod keeps track of what clothes and restraints the player is wearing, whether it is night and reports a "vulnerability status" for the player based on this information. All of these vulnerabilities can be independently configured in the MCM menu allowing each player to select what makes her more vulnerable and keeps vulnerability consistent across mods.
Leash: I am working on creating a leash that can be used by other mods. This has been tried before so I might run into problems but so far it has been working well.
Status: The MCM menu has a status page that provides information about worn item slots, keywords, actor factions, and nearby actors.
Utility Scripts: There is a utility script with general purpose functions: Data mutexes, Hex/String conversion, Array utilities.
Individual Feature Use: Since a lot of these features are new, experimental, and possibly controversial, I've tried to set them up such that every feature can be enabled or disabled individually in the MCM menu.
Script Advice: For those who are not experienced in software development this is a collection of things I have learned, recommended scripting practices, and example scripts.

Mod Content

Quest _dfwDeviousFramework: There is only one quest for this mod. Other than the player alias the quest only exists to run the scripts.
Player Alias: In the quest is a player alias. This is needed for the MCM menu to work, but it also catches events that are triggered by the player. This includes equipment changes, loading the game, and bleedout. Loading the game is important to make sure all of the scripts are up to date each time.
Script dfwDeviousFramework.psc: This is the main script for the mod. It has a polling interval (an OnUpdate() event) which: updates the player's status on equipment changes; manages the leash; casts the nearby actor detection spell; and cleans up the nearby actor list. This script is also the main API for the features of the module. If you want to use this module see the features related to this script.
Script dfwMcm.psc: The script to create and manage the MCM menu with features like last page and script upgrading.
Script dfwUtil.psc: A utility script with general purpose functions: Data mutexes, Hex/String conversion, Array utilities, Teleporting the player, and clothing classification. This mod has a notion of full body armour, chest wear, and clothing worn around the waist/legs.
Script dfwPlayerEvents.psc: This script is attached to the player alias of the quest. It catches equipment changes, loading the game, and bleedout events for the player and simply passes them on to the mod's main script.
Magic Effect _dfwNearbyDetectorEffect: This is an invisible area effect spell that triggers the dfwMagicEffectDetectNearby script on each actor it hits. It is setup to only hit each actor once every five game minutes (unless he is cleared from the nearby actor list). It does not trigger on creatures, hostile actors, or dead bodies.
Script dfwMagicEffectDetectNearby.psc: This simply catches the event when an actor is hit by the nearby actor detector spell and reports it to the mod's main script.
Spell _dfwNearbyDetectorSpell: This is an invisible area effect spell that triggers the _dfwNearbyDetectorEffect script on each actor it hits. The range of this spell can be configured in the MCM menu (and subsequently changed via the mod's main script).
Magic Effect _dfwLeashEffect: This is a visual representation of the leash. Cast every second or so, it projects a small red mystical looking blob from the leash point to the player. It uses a custom _dfwLeashProjectile projectile.
Projectile _dwfLeashProjectile: This is a visual representation of the leash sent from the leash point to the player. This could be improved to look like a rope or chain but since I don't know how to do that I plan to leave it as a rudimentary small red blob based on the AuraWhisperProjectile.nif. Some other existing projectiles have been considered but there are certainly many that haven't been tried. The speed, range, and other options can also be adjusted for a better look but for now it is not too bad.
Spell _dfwLeashSpell: This spell casts the leash from the leash point to the player. It is cast from the mod's main script every poll. It must be cast from the leash point to the player since the same spell cast by the player would travel in the direction the player is facing and cannot be directed otherwise.

Support Mod

There is a support mod that accompanies this mod.
It consists of a way to test the leash mechanism. Additionally, there are a couple of options attempting to improve interaction with other mods.

⚠️ **GitHub.com Fallback** ⚠️