lacie_ Posted October 26, 2023 Posted October 26, 2023 (edited) Hello, I am trying to edit a script from the dynamic weight system mod so that it recognises some sexlab events that I want to define. For reference I have copied the script below, it's not long. Basically I want the script to recognise a Sexlab AnimationStart event or a stage event, and increment the variable "Sprint". I have read the documentation in the .psc file that sexlab provides but I am very new to papyrus scripts and an struggling to make sense of it. I'm having two main problems with this. The first is syntax, I'm not sure if I am getting the syntax correct or not. I'm using 1.63, and I thought based on documentation the code I pasted below this would work. The second is how I get the script to recognize SL. Is it as simple as just adding SL as a master to the mod's .esp, or do I need to do other stuff. The script compiles fine but I have heard that papyrus needs access to the source scripts for compile to work - can I assume that since the script is compiling this is not my issue? Function RegisterSexlabModEvents() RegisterForModEvent("HookAnimationStart", "OnSexLabAnim") Debug.Notification ("SL events registered for DWS") EndFunction Event OnSexLabAnim(int threadID, bool hasPlayer) Sprint = Sprint + 100 Debug.Notification ("Sprint increased") EndEvent Thanks Script copied here: Spoiler Scriptname _SDWeightGainQuest Extends ReferenceAlias Event OnInit() RegisterEvents(True) Metabolism() _SDUpdateWeight.Cast(PlayerRef) Game.GetPlayer().AddSpell(_SDUpdateWeight, abVerbose = True) Debug.Notification("Dynamic Weight System is ready.") Debug.Notification ("Your Consumption is " +Consumption) EndEvent Function RegisterEvents(Bool _enable) If _enable RegisterForAnimationEvent(PlayerRef, "FootLeft") RegisterForAnimationEvent(PlayerRef, "FootRight") RegisterForAnimationEvent(PlayerRef, "FootSprintLeft") RegisterForAnimationEvent(PlayerRef, "FootSprintRight") RegisterForAnimationEvent(PlayerRef, "JumpUp") Else UnregisterForAnimationEvent(PlayerRef, "FootLeft") UnregisterForAnimationEvent(PlayerRef, "FootRight") UnregisterForAnimationEvent(PlayerRef, "FootSprintLeft") UnregisterForAnimationEvent(PlayerRef, "FootSprintRight") UnregisterForAnimationEvent(PlayerRef, "JumpUp") EndIf EndFunction Function Metabolism() RegisterForUpdateGameTime(6) ; Before we can use onUpdateGameTime() we must register. endFunction Event OnObjectEquipped(Form type, ObjectReference ref) If type as Potion If _SDFoodLight.HasForm(type) Consumption = Consumption + 1 ElseIf _SDFoodMedium.HasForm(type) Consumption = Consumption + 2 ElseIf _SDFoodHeavy.HasForm(type) Consumption = Consumption + 3 ElseIf _SDFoodOthersoup.HasForm(type) Consumption = Consumption + 1 ElseIf _SDFoodOtherAlcohol.HasForm(type) Consumption = Consumption + 1 ElseIf _SDFoodOtherRaw.HasForm(type) Consumption = Consumption + 1 EndIf If Consumption > 10 Consumption = 10 EndIf Debug.Notification ("Your Consumption is " +Consumption) EndIf If type as Potion If Consumption >= 5 If _SDFoodLight.HasForm(type) _SDGaina.Cast(PlayerRef) Debug.Notification("Mild weight gain.") ElseIf _SDFoodMedium.HasForm(type) _SDGainb.Cast(PlayerRef) Debug.Notification("Moderate weight gain.") ElseIf _SDFoodHeavy.HasForm(type) _SDGainc.Cast(PlayerRef) Debug.Notification("Considerable weight gain.") ElseIf _SDFoodOthersoup.HasForm(type) _SDGaind.Cast(PlayerRef) Debug.Notification("Negligible Weight gain.") ElseIf _SDFoodOtherAlcohol.HasForm(type) _SDGaind.Cast(PlayerRef) Debug.Notification("Negligible Weight gain.") ElseIf _SDFoodOtherRaw.HasForm(type) _SDGaind.Cast(PlayerRef) Debug.Notification("Negligible Weight gain.") EndIf EndIf EndIf EndEvent Event OnAnimationEvent(ObjectReference akSource, string asEventName) ;The player is Moving If akSource == PlayerRef If asEventName == "FootLeft" || asEventName == "FootRight" Sprint = Sprint + 1 ElseIf asEventName == "FootSprintLeft" || asEventName == "FootSprintRight" Sprint = Sprint + 2 EndIf EndIf If Sprint >= 0 && Sprint <= 5 Debug.notification("You have traveled 2000 steps.") elseIf Sprint >= 500 && Sprint <= 505 Debug.notification("You have traveled 500 steps.") elseIf Sprint >= 1000 && Sprint <= 1005 Debug.notification("You have traveled 1000 steps.") elseIf Sprint >= 1500 && Sprint <= 1505 Debug.notification("You have traveled 1500 steps.") elseIf Sprint >= 500 && Sprint <= 505 Debug.notification("You have traveled 500 steps.") elseIf Sprint >= 2000 If Consumption - 1 >= -10 Consumption = Consumption - 1 ElseIf Consumption - 1 < -10 Consumption = -10 ElseIf Consumption - 1 > 10 Consumption = 10 EndIf If Consumption < 0 _SDLossa.Cast(PlayerRef) EndIf Sprint = 0 Debug.Notification ("Your Consumption is " +Consumption) EndIf EndEvent Event OnUpdateGameTime() ; because of how we registered, this event occurs every 6 hours of game time If Consumption - 1 > 10 Consumption = 10 ElseIf Consumption - 1 <= 10 && Consumption - 1 >= 0 Consumption = Consumption - 1 ElseIf Consumption - 1 < 0 && Consumption - 1 >= -10 Consumption = Consumption - 1 _SDLossa.Cast(PlayerRef) ElseIf Consumption - 1 < -10 Consumption = -10 _SDLossa.Cast(PlayerRef) EndIf Debug.Notification ("Your Consumption is " +Consumption) EndEvent Event OnAnimationEventUnregistered(ObjectReference akSource, string asEventName) If (asEventName == "FootLeft" || asEventName == "FootRight" || asEventName == "FootSprintLeft" || asEventName == "FootSprintRight") int i = 0 While (i < 100 && !RegisterForAnimationEvent(akSource, asEventName)) Self.RegisterEvents(TRUE) Utility.Wait(0.1) i += 1 EndWhile EndIf EndEvent Actor Property PlayerRef Auto FormList Property _SDFoodLight Auto FormList Property _SDFoodMedium Auto FormList Property _SDFoodHeavy Auto FormList Property _SDFoodOthersoup Auto FormList Property _SDFoodOtherAlcohol Auto FormList Property _SDFoodOtherRaw Auto Spell Property _SDGaina Auto Spell Property _SDGainb Auto Spell Property _SDGainc Auto Spell Property _SDGaind Auto Spell Property _SDLossa Auto Spell Property _SDUpdateWeight Auto Int Property Consumption Auto Int Property Sprint Auto Edited October 26, 2023 by asdj1239
Qviddhartha Posted October 26, 2023 Posted October 26, 2023 What you are showing in these two functions looks ok, but where is "RegisterSexlabModEvents" called? No, you do not need to do anything else if this is the only link to SL. You would need to have the sexlab scripts installed if you were calling any of its functions, and you'd need to add it as a master in your mod's dependency list if you wanted to refer to its objects/quests in your script properties (though there are other ways of doing this).
lacie_ Posted October 27, 2023 Author Posted October 27, 2023 (edited) On 10/26/2023 at 9:20 PM, pfB6cs said: What you are showing in these two functions looks ok, but where is "RegisterSexlabModEvents" called? No, you do not need to do anything else if this is the only link to SL. You would need to have the sexlab scripts installed if you were calling any of its functions, and you'd need to add it as a master in your mod's dependency list if you wanted to refer to its objects/quests in your script properties (though there are other ways of doing this). thanks for the reply. I am calling RegisterSexlabModEvents in OnInit() and OnPlayerLoadGame() (not sure if this last one is necessary). Anyway I managed to fix the problem and get everything working, was just a bunch of silly mistakes xd Edited October 27, 2023 by asdj1239
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now