genericuser27 Posted May 18, 2024 Posted May 18, 2024 (edited) Hello, I would appreciate some help with scripting (I'm very new to it) in creation kit (SE 1.5.97). The goal is to edit an existing mod to reward the player for being a virgin as long as possible (with gold). I am editing a script from the defloration mod and I'd like to know how to detect if the player is involved in a scene. Currently the mod checks all scenes, and I would just like it to check if the pc is involved. Here is the script: Spoiler Actor[] defloratedActors SexLabFramework Property SexLab Auto MiscObject Property Gold001 auto GlobalVariable Property TimeAsVirgin auto ; This is executed when the quest is initialized, only once. Event OnInit() ; Global registration for the SexLab event "Animation Start", the function "checkDefloration" will be called. RegisterForModEvent("AnimationStart", "checkDefloration") ; Initialize the array of deflorated actors, to avoid to check if it is null every time defloratedActors = new Actor[1] defloratedActors[0] = None EndEvent ; This event is called by SexLab every time a sex animation starts. event checkDefloration(string eventName, string argString, float argNum, form sender) ; Grab the animation and check if it is Vaginal sslBaseAnimation theAnim = SexLab.HookAnimation(argString) if !theAnim.hasTag("Vaginal") return endIf ; Grab the first NPC of the animation, we need to do some checking to understand if was a real defloration. ; The position 0 (the passive one) has to be a real female ; The animation has to have at least two participant (a masturbation will not deflorate...) Actor[] npcs = SexLab.HookActors(argString) if !npcs || npcs.length<2 || npcs[0].getLeveledActorBase().GetSex()!=1 return endIf Actor theGirl = npcs[0] ; Check if this girl was already deflorated... if defloratedActors.Find(theGirl)==-1 ; Not yet deflorated, do it defloratedActors = PapyrusUtil.PushActor(defloratedActors, theGirl) TimeAsVirgin.setvalue(Utility.GetCurrentGameTime() * 24) Debug.Notification("The girl " + theGirl.getLeveledActorBase().getName() + " becomes a woman after: " + TimeAsVirgin.GetValue() + "hours.") endIf EndEvent Thanks! Edited May 18, 2024 by genericuser27
Taki17 Posted May 18, 2024 Posted May 18, 2024 AnimationStart event carries the ThreadID and a HasPlayer boolen. All you need to do is change the arguments for your checkDefloration event and add a Return condition if HasPlayer is false. This also provides you with an easier way of fetching the animation an the actors too. Example stub: event checkDefloration( Int ThreadID, Bool HasPlayer ) If !HasPlayer Return EndIf sslThreadController Controller = Sexlab.ThreadSlots.GetController( ThreadID ) If !Controller.Animation.hasTag( "Vaginal" ) Return EndIf Actor[] npcs = Controller.Positions
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