Skip to content

DeviousFramework API

legume-Vancouver edited this page Mar 22, 2017 · 11 revisions

API General Functions

GetModVersion()

|-----------------------------------------------------------------------------------|
String GetModVersion()

Returns the version string for the mod.

IsPlayerCriticallyBusy()

Bool IsPlayerCriticallyBusy(Bool bIncludeBleedout)
bIncludeBleedout: Optional. Default to true. If false the player will not be
                  considered busy during the bleedout time regardless of whether
                  other conditions are met.

Note: Detecting that the player is in bleedout is a bit of a best guess right now so use with caution. This checks if the player is involved in something that should not be interrupted. Primarily it checks if the player is involved in any scene and it does so by checking if the player's controls are locked. This will include sex, dialog scenes, and bleedout.

SceneStarting()

Int SceneStarting(String szSceneName, Int iSceneTimeout, Int iWaitMs)
szSceneName: Any short unique name to give the scene.
iSceneTimeout: The amount of time in seconds to wait before automatically
               considering the scene to be finished.
iWaitMs: Optional. Default to 0 (don't wait). The time in milliseconds to wait if a
         current scene is running.
Returns FAIL(-1) if another scene is running even after the wait period is over.
Returns SUCCESS(0) if the scene lock can be locked for this scene.

This function sets a flag to "lock" the scene. This "lock" flag should be used to prevent multiple scenes from different mods running at the same time. If the scene "lock" flag is already in use by another mod this function will return FAIL, indicating a new scene should not start.

SceneDone()

SceneDone(String szSceneName)
szSceneName: This must be the same name given in the SceneStarting() call.

This function is used to release the scene "lock" flag indicating that a scene is done. The "lock" flag can be automatically released if the timeout from the SceneStarting() function call expires.

GetCurrentScene()

String GetCurrentScene()
Returns the string name given in the most recent call to SceneStarting().
Returns "" if the timeout has expired or SceneDone() has been called since.

Returns the name of the scene the DFW mod has it's scene "lock" flag locked for.

Block<Stat>Regen()

BlockHealthRegen()
BlockMagicaRegen()
BlockStaminaRegen()
These functions require no paramenters.

When a player is enslaved sometimes it is unrealistic and detrimental to the enslavement for her to regenerate health, magica, and stamina at her normal (out of combat) rate. What good is it to punish a player with a whipping if she fully recovers in a few seconds? Calling these functions will significantly inhibit the player's regeneration of her stats, while not preventing the regeneration entirely. Each stat will be inhibited until the corresponding "Restore" function is called. The restore function must be called once for each time the block function is called. Thus, if two mods have health blocked it will not be restored until both mods call the restore function.

Disable<Stat>()

DisableMagicka(Bool bDisable)
DisableStamina(Bool bDisable)
bDisable: Optional. Default to true. If false the stat will be re-enabled instead.

These functions are similar to to BlockMagickaRegen() and BlockStaminaRegen() except that they take away all of the player's Magicka or Stamina and reduce all regeneration of that stat.

Restore<Stat>Regen()

RestoreHealthRegen()
RestoreMagicaRegen()
RestoreStaminaRegen()
These functions require no paramenters.

Restores the player to her normal regeneration rates. These functions must be called once for each time the corresponding "Block" function is called. See Block<Stat>Regen() for further details.

Block<Control>()

BlockFastTravel()
BlockMovement()
BlockFighting()
BlockCameraSwitch()
BlockLooking()
BlockSneaking()
BlockMenu()
BlockActivate()
BlockJournal()
These functions require no paramenters.

The game has a number of functions that block various controls the player normally has access to. A lot of mods will enable and disable these controls on their own; however, this causes the situation where one mod will diable the control while another mod will enable it without knowing whether the first wants it to remain disabled.
Having access to these features centralized allows us to keep track of how many mods have blocked each of these controls. Controls will not be unblocked until all mods keeping them blocked have reported that is no longer necessary.

Restore<Control>()

RestoreFastTravel()
RestoreMovement()
RestoreFighting()
RestoreCameraSwitch()
RestoreLooking()
RestoreSneaking()
RestoreMenu()
RestoreActivate()
RestoreJournal()
These functions require no paramenters.

See Block<Control>() for further details.

API Master Functions

Constants: Master distances (MD_)

MD_NONE 0x00000000 Specifies no Master distance is applicable.
MD_ANY 0x00000001 Specifies any Master distance is acceptable.
MD_ALL 0x00000002 Specifies the Master is both close and far.
MD_CLOSE 0x00000004 Specifies the Master is nearby to the player.
MD_DISTANT 0x00000008 Specifies the Master controls the player but is normally not near the player.

Constants: Action Permissions (AP_)

AP_NONE 0x00000000 No permissions are allowed. All permissions are blocked.
AP_SEX 0x00000001 NPCs may randomly stop the player for sexual encounters.
AP_ENSLAVE 0x00000002 Mods may initiate encounters that will result in the player being enslaved or a transfer of ownership of the player.
AP_RESTRAIN 0x00000004 Mods may add various restraints to the player provided they do not interfere with restraints the player is already wearing.
AP_DRESSING_ALONE 0x00000010 Any mod may change the non-restrictive items the player is wearing.
AP_DRESSING_ASSISTED 0x00000020 When this is set a nearby Master is considered to be helping the player dress, thus overriding restrictions such as wearing leggings over a hobble or getting body armour over a leash.
AP_DRESSING 0x00000030 This is a mask that includes both dressing related permissions, AP_DRESSING_ALONE and AP_DRESSING.
AP_NO_SEX 0xFFFFFFFE This is a mask that includes everything except AP_SEX.
AP_NO_BDSM 0xFFFFFFF9 This is a mask that includes everything except BDSM related permissions (Enslavement and restraints).
AP_ALL 0xFFFFFFFF All permissions are allowed. No permissions are blocked.

GetMaster()

Actor GetMaster(Int iMasterDistance, Int iInstance)
iMasterDistance: Optional. Default to MD_ANY. Whether a nearby or distant Master
                 should be considered. Currently only MD_DISTANT is supported.
                 Anything else (including the default) is considered to be MD_CLOSE.
iInstance: Optional. Default to 1. Can be used in subsequent calls to get different
           Masters if the function could return more than one. This parameter is not
           yet supported.
Returns None if no mod has registered that the player has a Master.
Returns the actor that has been registered as controlling the player.

GetMasterMod()

String GetMasterMod(Int iMasterDistance, Int iInstance)
iMasterDistance: Optional. Default to MD_ANY. Whether a nearby or distant Master
                 should be considered. Currently only MD_DISTANT is supported.
                 Anything else (including the default) is considered to be MD_CLOSE.
iInstance: Optional. Default to 1. Can be used in subsequent calls to get different
           Masters if the function could return more than one. This parameter is not
           yet supported.
Returns "" if no mod has registered that the player has a Master.

Upon registering an actor as the player's Master the registering mod is required to provide a string to identify itself, "DFW" for example. This is the string returned. The purpose of this is for a mod to check if one of it's features is controlling the player.

SetMaster()

Int SetMaster(Actor aNewMaster, String szMod, Int iPermissions,
              Int iMasterDistance, Bool bOverride)
aNewMaster: The actor who should be registered as controlling the player.
szMod: A unique string identify which mod or feature is managing this Master.
iPermissions: A set of actions permitted by this Master.
iMasterDistance: Optional. Default MD_CLOSE. Whether this Master is near the player
                 or not. Supports: MD_CLOSE and MD_DISTANT.
bOverride: Optional. Default False. Whether any previous Master should be cleared
           prior to registering the new Master.
Returns FAIL(-1) if a previous Master existed and bOverride is set to False.
                 If this happens the registering mod should not continue controlling
                 the player.
Returns WARNING(1) if a previous Master existed but the new Master was successfully
                   registered.
Returns SUCCESS(0) if no previous Master existed and the new Master was successfully
                   registered.

This function should be called when a mod is attempting to take control of the player. It registers a new actor as the player's Master, controlling the player. Two different types of Masters can control the player. Nearby Masters typically represent someone keeping the player on a leash or actively watching the player. Distant Masters typically represent someone who has a collar or chastity belt locked on the player but has allowed the player to wander and explore on her own.
If bOverride is set, any existing Master will be cleared. Note that nearby Masters only clear existing nearby Masters and distant Masters only clear distant Masters.
If a Master is cleared this way, a New Master Event will be generated to notify the old mod that the mod's control of the player has been taken over.
Warning: Some mods may not handle this New Master Event so check that enslavement is allowed before overriding a current Master.
If the permissions include AP_SEX the player may be stopped at any time for sex from other mods. Make sure your Master's behaviour accounts for this.
If the permissions include AP_ENSLAVE enslavement by your mod may be terminated by another mod taking control of the the player. Make sure your mod accounts for this by handling the New Master Event.

ClearMaster()

Int ClearMaster(Actor aMaster, Bool bEscaped=False)
aMaster: The actor to be cleared as the player's Master.
bEscaped: Whether the player has escaped or was released.
          This affects the ZAZ Animation Pack mod.
Returns WARNING(1) if the actor is not registered as the player's Master.
Returns SUCCESS(0) if the actor was registered as the player's Master and has been
                   cleared.

Clears the specified actor indicating he is no longer controlling the player. The actor must be specified to help prevent mods from clearing Masters registered by other mods without authorization.
Note: No event is generated when a Master is cleared this way. (Should this change?)

ChangeMasterDistance()

Int ChangeMasterDistance(Actor aMaster, Bool bMoveToDistant, Bool bOverride)
aMaster: The Master who is being changed.
bMoveToDistant: Optional. Default True. Whether the Master should now be considered
                Distant. Will be considered close otherwise.
bOverride: Optional. Default False. Whether any previous Master should be cleared
           prior to moving the new Master.
Returns FAIL(-1) if the specified Master is not registered at the proper distance
                 to be moved. E.g. if the Master is not registered as nearby we
                 cannot move him to a distant Master.
Returns FAIL(-1) if a previous Master existed at the specified distance and bOverride
                 is set to False.
Returns WARNING(1) if the Master is already registered at the specified distance.
Returns WARNING(1) if a previous Master existed at the specified distance but the new
                   Master was successfully registered.
Returns SUCCESS(0) if the Master can be moved to the new distance.

Updates the distance associated with the Master. For example, if a Master is keeping the player on a leash (a nearby Master) and he unlocks the leash allowing the player to wander off and explore (a distant Master) the Master should be changed from nearby to distant.

AddPermission()

AddPermission(Actor aMaster, Int iPermissionMask)
aMaster: The master whose permissions are being changed.
iPermissionMask: The actions that will now be allowed by the Master.

Changes the set of actions permitted by the specified Master to now allow the specified actions.
See the Actor Permission Flags for further details.

RemovePermission()

RemovePermission(Actor aMaster, Int iPermissionMask)
aMaster: The master whose permissions are being changed.
iPermissionMask: The actions that will no longer be allowed by the Master.

Changes the set of actions permitted by the specified Master to no longer allow the specified actions.
See the Actor Permission Flags for further details.

IsAllowed()

Bool IsAllowed(Int iAction)
iAction: The AP_ constant mask of the action(s) in question.
Returns False if a nearby or distant Master has been registered indicating that the
              requested action is not allowed.
Returns True if no such registration has been made.

If multiple actions are specified in the action mask it will return False if any of the actions are forbidden.
See the Actor Permission Flags for further details.

API Player Status Functions

Constants: Naked Status (NS_)

NS_NAKED 0x00000000 The player is not wearing any body, chest, or waist clothing or armour.
NS_WAIST_PARTIAL 0x00000001 The player is wearing waist coverings and it is considered naked by SexLab aroused.
NS_WAIST_COVERED 0x00000002 The player is wearing waist coverings.
NS_CHEST_PARTIAL 0x00000004 The player is wearing chest coverings and it is considered naked by SexLab aroused.
NS_CHEST_COVERED 0x00000008 The player is wearing chest coverings.
NS_BOTH_PARTIAL 0x00000010 Wearing body clothing/armour considered naked by SexLab aroused or both waist and chest coverings, at least one of which is considered naked.
NS_BOTH_COVERED 0x00000020 Wearing body clothing/armour or both waist and chest coverings.
NS_WAIST_PROTECTED 0x00000032 A mask for all permutations that cover the waist above, not including naked clothing.
NS_CHEST_PROTECTED 0x00000038 A mask for all permutations that cover the chest above, not including naked clothing.

GetNakedLevel()

Int GetNakedLevel()
Returns a Naked Status (NS_) constant indicating the player's current naked level.

Note: This mod has the concept of chest and waist coverings. These concepts are based on information from the following web page which attempts to to standardize clothing worn on specific slots: 46 & 56 for chest and 49 & 52 for waist. These slots conflict a little with devious devices; however, they only apply to clothing, which shouldn't have the devious keyword. These slots can also be adjusted in the MCM menu if the player frequently wears clothing from a mod that doesn't follow these standards.
http://www.creationkit.com/index.php?title=Biped_Object
The following web page is a good instruction manual for how to change the body slot of clothing in a mod you are making or using. In summary it must be changed in three places:

  1. In one of the .NIF files (note there are two. If you chose the wrong one you will notice) under NiNode => NiTriShapeData => BSDismemberSkinInstance => Partitions => Partitions => Body Part
  2. In the Creation Kit's "Armor" section under Items
  3. In the Creation Kit's "ArmorAddon" section under Items
    http://wiki.tesnexus.com/index.php/Skyrim_bodyparts_number

IsPlayerBound()

Bool IsPlayerBound(Bool bIncludeHidden, Bool bOnlyLocked)
bIncludeHidden: Optional. Default False. Whether or not to include restraints covered
                by clothing.
bOnlyLocked: Optional. Default False. Whether or not to exclude restraints that are
             not locked. Not yet supported.
Returns True if the player is wearing restraints that match the specified conditions.
              False otherwise.

Note: Keeping track of what restraints are worn and/or hidden is not 100% yet. Some improvements and much testing are still needed.
Trigger Keywords: All keywords from the individual functions below + zad_DeviousArmCuffs, zad_DeviousGloves, zad_DeviousPiercingsVaginal, zad_DeviousBlindfold, zad_DeviousHood, zbfWornBlindfold, zbfWornHood, zad_DeviousBra, zbfWornBra, zad_DeviousClamps, zad_DeviousPiercingsNipple, zad_DeviousCorset, zad_DeviousHarness, zbfWornWrist (without the movement restrictions of a hobble), zad_DeviousLegCuffs (without the movement restrictions of a hobble), zad_DeviousSuit
Hidden by chest coverings: Chastity Bra, Nipple Clamps, Nipple Piercings
Hidden by waist coverings: Chastity Belt, Vaginal Piercings
Hidden by full body coverings: All above + Corset, Harness

IsPlayerArmLocked()

Bool IsPlayerArmLocked()

Are the player's arms locked in such a way as to be restrictive? Simply wearing cuffs that are not locked together should not register as being arm locked.
Trigger Keywords: zad_DeviousArmbinder, zad_DeviousYoke, zbfWornYoke, zbfWornWrist

IsPlayerBelted()

Bool IsPlayerBelted()

Is the player wearing a chastity belt?
Trigger Keywords: zad_DeviousBelt, zbfWornBelt

IsPlayerCollared()

Bool IsPlayerCollared()

Is the player wearing a collar?
Trigger Keywords: zad_DeviousCollar, zbfWornCollar

IsPlayerGagged()

Bool IsPlayerGagged()

Is the player wearing a gag?
Trigger Keywords: zad_DeviousGag, zbfWornGag

IsPlayerHobbled()

Bool IsPlayerHobbled()

Are the player's feet locked in such a way as to be restrictive? Simply wearing cuffs that are not locked together should not register as being hobbled.
Trigger Keywords: zad_DeviousBoots, zbfWornWrist (with zbfEffectNoMove or zbfEffectSlowMove), zad_DeviousLegCuffs (with zbfEffectNoMove or zbfEffectNoSprint or zbfEffectSlowMove)

GetBdsmFurniture()

ObjectReference GetBdsmFurniture()
Returns None if the player is not sitting on any BDSM furniture.

If the player is sitting on any ZAZ furniture (keyword zbfFurniture) a reference to the furniture will be returned.

SetBdsmFurnitureLocked()

SetBdsmFurnitureLocked(Bool bLocked)
bLocked: Optional. Default True. Whether the furniture is being locked (or unlocked).

Sets whether the ZAZ BDSM furniture (keyword zbfFurniture) the player is sitting in is locked. This mod attempts to disable the player's inventory when locked into BDSM furniture.

GetVulnerability()

Int GetVulnerability(Actor aActor)
aActor: Optional. Default player. Only vulnerability for the player is supported.
Returns a value (0 - 100) of how vulnerable the player is.

This is determined by adding a vulnerability for a number of individual items based on how much they are configured in the MCM menu.
Naked/Partially Covered, Collared, Arms Locked, Gagged, Other Restraints, Leashed, Night Time
Other Restraints include: Hobble/Boots/Leg Cuffs, Arm Cuffs/Gloves, Visible Belt/Vaginal Piercings, Blindfold/Hood, Visible Bra/Nipple Clamps/Piercings, Visible Corset/Harness, Full Bondage Suit

GetWeaponLevel()

Int GetWeaponLevel()
Returns the weapon level of weapons or spells the player currently has equipped.

The intent of this function is to evaluate a character's (player or NPC) equipped weapons based on their level. For instance a level 50 player wielding an Iron Dagger should report a rather low value, while a first level character wielding the same weapon would report a more reasonable value.
This is meant to tie into the confidence level of NPCs; however, clearly evaluating a weapon's strength has turned out to be more difficult than expected. While this function should be developed to reliably identify if the player has weapons or offensive spells equipped, it may be quite some time before the "effectiveness" of the weapons reported by this function is reliable.

API Nearby Actor Functions

Constants: Actor Flags (AF_)

AF_ESTIMATE 0x00000001 The information about the actor is based on a first look at the actor. No mod or story event has provided decisive information about the actor's status. For now all information is estimated.
AF_IMPORTANT 0x00000002 This actor is considered important based on the SexLab Aroused definition (Unique, essential, invulnerable, protected).
AF_CHILD 0x00000004 This actor is a child.
AF_GUARDS 0x00000008 This actor is a guard.
AF_MERCHANTS 0x00000010 This actor is a merchant.
AF_HOSTILE 0x00000020 This actor is hostile to the player. Note: This shouldn't be used as hostile actors aren't detected by the spell.
AF_ANIMAL 0x00000040 This actor is an animal. Note: This shouldn't be used as animals aren't detected by the spell.
AF_DOMINANT 0x00000080 This actor is considered dominant. For now everyone who is not wearing restraints is considered dominant.
AF_SUBMISSIVE 0x00000100 This actor is is wearing restraints but is not identified as a slave.
AF_SLAVE 0x00000200 This actor is registered as a slave according to the ZAZ Animation Pack (in the faction zbfFactionSlave)
Or this actor is wearing a Collar, Corset, Harness, Arm Binder, Yoke, or Bondage Suit.
AF_OWNER 0x00000400 This actor is a owns at least one slave. I.e. he is registered as a Master according to the ZAZ Animation Pack (in the faction zbfFactionMaster)
Or this actor is a slave trader (AF_SLAVE_TRADER).
AF_SLAVE_TRADER 0x00000800 This actor is in the business of selling slaves. I.e. he is a Hydra Slavegirls slaver or is registered as a slaver with the ZAZ Animation Pack (in the faction zbfFactionSlaver)
AF_BDSM_AWARE 0x00000F00 A flag to encompass all types of actors (submissive and dominant) that are involved in BDSM in some way: submissives, slaves, owners, and slave traders.

GetNearbyActorList()

Form[] GetNearbyActorList(Float fMaxDistance, Int iIncludeFlags,
                               Int iExcludeFlags)
fMaxDistance: Optional. Default 0-Any Distance. The maximum distance from the player
              to get actors for. Note distance is already limited by the nearby actor
              list which has an MCM configurable scan radius.
iIncludeFlags: Optional. Default 0-All Flags.
               Only return actors whose AF_ flags match these.
iIncludeFlags: Optional. Default 0-No Flags.
               Only return actors whose AF_ flags do not match these.

This returns an array of forms, each of which is an actor in the nearby actors list whose flags match the specified conditions.

GetNearbyActorFlags()

Int[] GetNearbyActorFlags()

Returns an array of actor flags matching actors returned from the last call to GetNearbyActorList()
For any call to get a nearby actor list the set of flags for all actors returned is saved. Calling this function returns a list of actor flags matching the actors returned in the most recent call to get the nearby actor list.
Warning: There can easily be a race condition where another mod makes a call to get a nearby actor list before your mod gets a chance to get the nearby actor flags. This mechanism needs to be improved. For now, at least make sure the two lists are the same size.

GetRandomActor()

Actor GetRandomActor(Float fMaxDistance, Int iIncludeFlags, Int iExcludeFlags)
fMaxDistance: Optional. Default 0-Any Distance. The maximum distance from the player
              to get actors for. Note distance is already limited by the nearby actor
              list which has an MCM configurable scan radius.
iIncludeFlags: Optional. Default 0-All Flags.
               Only return actors whose AF_ flags match these.
iIncludeFlags: Optional. Default 0-No Flags.
               Only return actors whose AF_ flags do not match these.

Return a random actor from the nearby actor list whose flags match the specified conditions.

GetNearestActor()

Actor GetNearestActor(Float fMaxDistance, Int iIncludeFlags, Int iExcludeFlags)
fMaxDistance: Optional. Default 0-Any Distance. The maximum distance from the player
              to get actors for. Note distance is already limited by the nearby actor
              list which has an MCM configurable scan radius.
iIncludeFlags: Optional. Default 0-All Flags.
               Only return actors whose AF_ flags match these.
iIncludeFlags: Optional. Default 0-No Flags.
               Only return actors whose AF_ flags do not match these.

Return the actor from the nearby actor list who is nearest to the player and whose flags match the specified conditions.

IsActorNearby()

Bool IsActorNearby(Actor aActor)
aActor: The actor to check.

Checks if the specified actor is nearby (in the nearby actors list).

GetPlayerTalkingTo()

Actor GetPlayerTalkingTo()
Returns None if no actor is speaking with the player.
Returns the actor the player is speaking with.

This has always been a bit of a problem because there is only an interface to check if an NPC is speaking with the player. All nearby actors are checked. Some implementations check all actors in the same area as the player. Some also check all actors in all surrounding areas. This implementation checks all actors in the nearby actor list. Only time and extensive use will tell if this implementation is effective. Be wary. This feature is likely to be faster than most but it may not be accurate 100% of the time.

API Leash Functions

Constants: Leash Style (LS_)

LS_AUTO 0 The mod will select between LS_DRAG and LS_TELEPORT attempting to provide an immersive leash experience for the player while trying to avoid getting the player into the more difficult situations.
LS_DRAG 1 When the player gets too far away (or when the player's leash is yanked for another reason) the player will be thrown off her feet and will tumble (ragdoll) along the ground.
LS_TELEPORT 2 When the player gets too far away (or when the player's leash is yanked for another reason) the player will be turned around and teleported (MoveTo) toward anchor point for the leash.

SetLeashTarget()

SetLeashTarget(ObjectReference oLeashTarget)
oLeashTarget: The actor or object to leash the player to.
oLeashTarget: Set this to None to unleash the player.

Starts the Devious Framework leash feature keeping the player leashed to the specified actor or object. If being leashed to a nearby actor the actor should probably be registered as the player's Master prior to doing so.

SetLeashLength()

SetLeashLength(Int iLength)
iLength: The distance the player can move before she is jerked back.

Sets the distance the player can move from the leash target before she is jerked back.

YankLeash()

YankLeash(Float fDamageMultiplier, Int iOverrideLeashStyle, Bool bInterruptScene)
fDamageMultiplier: Optional. Default 1-Standard Damage. A value to modify how much
                   damage the leash does. Standard leash damage is normally set by
                   the player in the MCM as a % of current health. Adjusting the
                   standard value should generally be avoided. Setting this to 0 can
                   stop the leash from doing any damage.
iOverrideLeashStyle: Optional. Default 0-Do not override.  Providing a leash style
                     will force that style to be used.
bInterruptScene: Optional. Default True.  Specifies whether sex, conversation, or
                 other scenes should be interrupted. Not supported.

Jerks the player toward the leash target. This will damage the player and cause her some disorientation.
It can be used as a form of punishment, to rough up the player a little, or to gain an advantage in combat.

YankLeashWait()

Int YankLeashWait(Int iTimeoutMs)
iTimeoutMs: The maximum time in milliseconds to wait before returning.
Returns FAIL(-1) if the function has waited the maximum amount of time but there is
                 still a leash yank action in progress.
Returns SUCCESS(0) if there is no leash yank action upon returning.

Yanking the player's leash, starting a conversation, and performing a scene should generally not be done at the same time. Yanking the leash interrupts conversations and causes conversation subtext to disappear while playing scenes at the same time can increase the likelihood of stuck animations. To reduce these issues call YankLeashWait() before starting a scene or a conversation.
The leash yanking feature can have delays of 0.25 - 0.5 seconds to improve the realism of the leash. The wait duration should be at least 500 ms. See Leash Styles for further details.

API NPC Disposition

GetActor<Disposition>()

Int GetActorAnger(Actor aActor, Int iMinValue, Int iMaxValue, Bool bCreateAsNeeded)
Int GetActorConfidence(Actor aActor, Int iMinValue, Int iMaxValue,
                       Bool bCreateAsNeeded)
Int GetActorDominance(Actor aActor, Int iMinValue, Int iMaxValue,
                      Bool bCreateAsNeeded)
Int GetActorInterest(Actor aActor, Int iMinValue, Int iMaxValue,
                     Bool bCreateAsNeeded)
aActor: The actor to get the disposition value for.
iMinValue: If the value has not been set generate a random value between min and max.
           Set to -1 if you do not want and initial value to be created.
iMaxValue: If the value has not been set generate a random value between min and max.
bCreateAsNeeded: If this actor is not known register him in the system.
Returns the actor's disposition value as stored by the system.
Returns 50 if the actor isn't know and should not be created.
Returns -1 if the actor's value hasn't been set and iMinValue is -1.

In order to keep NPC behaviour consistent across encounters these functions can be used to "register" actors with the system and keep track of their anger toward the player, their confidence toward the player, how dominant an individual each one is, and how interested they are in the player. Once an NPC is registered with the system, his disposition toward the player can be increased or decreased using the IncActor<Disposition>() functions.
This system cannot store information about all NPCs the player meets. These functions should only be used with key NPCs that are interacting with the player. At the very least, bCreateAsNeeded should be False for NPCs who are not known to be significant NPCs.

IncActor<Disposition>()

Int Function IncActorAnger(Actor aActor, Int iDelta, Int iMinValue, Int iMaxValue,
                           Bool bCreateAsNeeded)
Int Function IncActorConfidence(Actor aActor, Int iDelta, Int iMinValue,
                                Int iMaxValue, Bool bCreateAsNeeded)
Int Function IncActorDominance(Actor aActor, Int iDelta, Int iMinValue,
                               Int iMaxValue, Bool bCreateAsNeeded)
Int Function IncActorInterest(Actor aActor, Int iDelta, Int iMinValue, Int iMaxValue,
                              Bool bCreateAsNeeded)
aActor: The actor to get the disposition value for.
iDelta: The amount to change the disposition.  Negative values decrease it.
        It will only change if currently between iMinValue and iMaxValue.
iMinValue: If the value has not been set generate a random value between min and max.
           Set to -1 if you do not want and initial value to be created.
iMaxValue: If the value has not been set generate a random value between min and max.
bCreateAsNeeded: If this actor is not known register him in the system.
Returns the actor's disposition value after it has been adjusted.
Returns 50 if the actor isn't know and should not be created.
Returns -1 if the actor's value hasn't been set and iMinValue is -1.

These functions can be used to increase or decrease the NPC's various disposition values.
See GetActor<Disposition>() for further details.

API Outgoing Events

DFW_NewMaster

ModEvent DFW_NewMaster(String szOldMod, Actor aOldMaster)
szOldMod: The old mod that managed the Master who used to control the player.
aOldMaster: The Master who used to control the player but has been replaced.

This event is sent out when a mod registers a new Master (nearby or distant) in a place where there was already an existing Master. It is sent to identify the old Master has been replaced. Any mod that registers a Master allowing the AP_ENSLAVE permission must handle this event.

DFW_NearbyActor

ModEvent DFW_NearbyActor(Int iFlags, Actor aActor)
iFlags: These are the AF_ flags that describe the new nearby actor.
aActor: This is the new actor that has been detected nearby.

This event is sent when a new NPC is detected nearby to the player.
Warning: This event will be sent out quite frequently. Handling it should be performed very fast and efficiently. It has not been thoroughly tested so it is unknown whether sending this event out for each new actor is even a reasonable thing to do.