I'm trying to create a mod that bypasses the need to use Death Alternative with Simple Slavery as I can never get the former to damn well work. It's supposed to check when the player has been defeated through any Defeat type mod (by checking a player's health at the moment an aggressive SexLab animation starts) and give a configurable chance of teleporting you to the Simple Slavery market. But I'm clearly missing something key as the only debug message I've inserted that I've managed to trigger is the one to check whether the mod's active. It may be because I'm iffy on how to use StorageUtil - do I need to declare it in the scripts like you do with SexLab or something? It may be any number of other things as I'm still so new at scripting. Here's the MCM menu script:
ScriptName SimplerSlaveryTriggerScript Extends Quest
SexLabFramework Property SexLab Auto
SimplerSlaveryMCMScript Property Config Auto
ObjectReference Property sslv_cagemark2 Auto
Actor Player
Event OnInit()
RegisterForModEvent("AnimationStart", "CheckDefeated")
Debug.Notification("Simpler Slavery Detected")
EndEvent
event CheckDefeated(string eventName, string argString, float argNum, form sender)
int SRSModOnInt = StorageUtil.GetIntValue(none, "SRSModOn")
if SRSModOnInt == 0
Debug.Notification("Mod active check failed")
return
endif
Debug.Notification("Mod active check passed")
int SRSMinHealthInt = StorageUtil.GetIntValue(none, "SRSMinHealth")
If Player.getav("Health") > SRSMinHealthInt
Debug.Notification("Health threshold check failed")
return
endif
Debug.Notification("Health threshold check passed")
sslThreadController controller = SexLab.HookController(argString)
if !controller.HasPlayer
Debug.Notification("Player involvement check failed")
return
endif
Debug.Notification("Player involvement check passed")
actor victim = SexLab.HookVictim(argString)
if victim != player
Debug.Notification("Player is victim check failed")
return
endif
RegisterForModEvent("AnimationEnd", "EnslavePlayerEvent")
Debug.Notification("Player is victim check passed")
EndEvent
event EnslavePlayerEvent(string eventName, string argString, float argNum, form sender)
UnregisterForModEvent("AnimationEnd")
int SRSEnslaveInt = StorageUtil.GetIntValue(none, "SRSChanceofEnslave")
int random = Utility.RandomInt(0, 99)
if random > SRSEnslaveInt
Debug.Notification("Random roll failed")
return
endif
Debug.Notification("Random roll passed")
Game.GetPlayer().MoveTo(sslv_cagemark2)
EndEvent