Modders Guide: being compatible with SexLabs/ZAZ/DD mods.
SendModEvent("dhlp-Suspend")/("dhlp-Resume")
If you running a scene or a lot of dialog or a scripted event that takes some time use.
SendModEvent("dhlp-Suspend") at the start.
SendModEvent("dhlp-Resume") at the end.
A lot of mod respect this.
If you have something happen to the player that might interrupt a scene/event then you should use
RegisterForModEvent("dhlp-Suspend", "SuspendEventName")
RegisterForModEvent("dhlp-Resume", "ResumeEventName")
With the event that create a variable that your mod will use.
DD Keywords
Devices have keywords to indicate what type of content they are from.
DDs that don't have zad_BlockGeneric or zad_QuestItem, replace/remove do whatever with them they aren't relating to any removal content.
DDs that have zad_BlockGeneric indicate that they are hard to remove and should only be removed by systems that require a decent amount of effort or via the mod owner intention.
Example Whiterun Brothel : you have to be a pony girl and make a few deliverys across skyrim. Older mods may break cause zad_Questitem did not exsist
zad_QuestItem most mods should never touch these and work around them. If they do get removed for a quest (not recommended), you NEED to reequip them as soon as your content is done if you don't do this you will likely break other DD mods.
Slavery mods (AKA Don't enslave slaves)
If your mod uses ZAZ the using the zbfSlavefaction ranks are the way to go DON'T enslave players that have 0 or higher and when you enslave use the faction 0 or higher to indicate this then set the rank to -1 when your enslavement is over.
What about DD slavery mod that don't use ZAZ (i think my mod Devious Followers is the only one !)
First you must RegisterForModEvent("PlayerRefEnslaved", "Your Event Name1"), RegisterForModEvent("PlayerRefFreed", "Your Event Name2")
When Sendmodevent("PlayerRefEnslaved") from another mod is sent you must have a flag within your mod that stops your mod enslaving the player.
When Sendmodevent("PlayerRefFreed") from another mod is sent you must have a flag within your mod that allows your mod to enslave the player.
All DD mod that use this will be compatible with each other !!!
BUT WHAT ABOUT ZAZ <---> DD
If SS is installed when you use SendModEvent("PlayerRefIsFree") it will use either Sendmodevent("PlayerRefEnslaved") or Sendmodevent("PlayerRefFreed") depending on players status (either zbfFactionslave is being used or another mod has sent Sendmodevent("PlayerRefEnslaved"))
After this is done if you use this check to make sure your not enslaving a already enslaved player.
Use Sendmodevent("PlayerRefEnslaved") at the start of your enslavement and SS will add zbfSlaveFactions for you and all mods that have that check will not touch your captured player until they escape.
When you are freeing a player/or they escape use Sendmodevent("PlayerRefFreed") and SS will use zbfSlaveFactions to mark the player as fair game for slavery mods that use zaz, and for DD mods that have registered this mod event.
Step by step of how it should work.
- Player has met conditions to be enslaved
- Either before(onUpdateloop) or now your Mod uses SendModEvent("PlayerRefIsFree")
- SS will either do Sendmodevent("PlayerRefEnslaved") or Sendmodevent("PlayerRefFreed") back
- If Sendmodevent("PlayerRefFreed") was the result you enslave player. Otherwise you don't and stop here.
- If you enslave player use Sendmodevent("PlayerRefEnslaved")
- At end of enslavement use Sendmodevent("PlayerRefFreed")
With SS you will be compatible with all mods that use zbfSlaveFaction on the player correctly.
Guide to DD and not having access to Disable player controls.
So since DD4.0 + You are unable to use DisablePlayerControls in mod because some item cause DD to spam enable player controls on some things (Movement,Fighting,Sneaking,Menu,Activation)
Here are some of my solutions to get these thing back.
For Movement = game.setplayeraidriven(true) will stop player moving,
game.setplayeraidriven(False) to reenable,
Fighting =
An Update loop calling
Game.GetPlayer().UnequipItem(Game.GetPlayer().GetEquippedWeapon(),false,true) Game.GetPlayer().UnequipItem(Game.GetPlayer().GetEquippedWeapon(true),false,true)
Game.GetPlayer().UnequipSpell(Game.GetPlayer(). GetEquippedSpell(),0),0)
Game.GetPlayer().UnequipSpell(Game.GetPlayer(). GetEquippedSpell(),1),1)
Game.GetPlayer().UnequipSpell(Game.GetPlayer(). GetEquippedSpell(),2),2)
) (this will allow player to enter combat but only with bare hands)
(if used with game.setplayeraidriven(true) the player can still spin around by drawing weapon)
OR
You could make an armbinder and ankle chains DDs with no model to do this.
(This is the cleanest looking way but you may not want the player to have hands around there back and you can’t do other things)
OR
Update loop with
PlayerRef.IsWeaponDrawn()
PlayerRef.SheatheWeapon()
(This will force player out of combat state if used with game.setplayeraidriven(true) the player can still spin around by drawing weapon)
abSneaking = Use of an update loop w/ Game.GetPlayer().Issneaking() then Game.GetPlayer().StartSneaking() will move them out of sneak.
abMenu = No idea atm ><
abActivate = Unknown the solution will depend on situation…. You can call BlockActivation() or Lock() on some Objectrefences.
Blocking activation in furniture (
An update loop on the furniture that has this
if (Game.GetPlayer().GetSitState()== 0)
Activate(Game.GetPlayer())
Endif
RegisterforSingleUpdate(1.0)
Willpower and Resistance
I really should of added this back in the day because it was a good idea. (Wrote this part on 14/08/2024)
Devious follower Injects a 4 Global's into Update.esm _DWill (0101A2A7), _DResist(0101A2A8), _DLowWill(0103E8F4), _DMedWill(0103E8F4)
The idea of this is that other mods and use the Willpower stat like it's a native stat to Skyrim.
If you add a Float Global called _DWill in your mod.
Then use SSEEdit to change the formID to 0101A2A7 now you'll have a global that you can use in your mod to represent Willpower but other mods that use it will work with your mod without any need for Sendmodevents. For example Spank that ass and SexLab Survival (0.635+) lowers resistance/willpower.
Either way willpower is track 0-10.
Resistance is 0-20.
When Resistance is 0 then willpower should be reduce by 1.
I'm pretty sure you can alter willpower by 0.1/0.01 ect and it should still work fine if you want to ignore Resistance system I used (which I should of done in the first place).
Edited by Lozeak
Update
0 Comments
Recommended Comments
There are no comments to display.