Roggvir Posted October 16, 2014 Posted October 16, 2014 GOAL: Controling scenes/animations via dialogue with NPC, depending on actor's current situation (furniture in use, position, etc.). EXECUTION: Player tells follower to use a furniture, then talks to follower again to choose a dialog option which starts animation\scene. PROBLEM: Follower stands up at the start of ZaZ pillory sex animation, only to get into the pillory again, which is annoying. How can i make the scene/anim start without the follower to stand up? Here is the script that prepares and starts the scene, activated via player dialog choice added to the DialogueFollower quest dialog: ;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment ;NEXT FRAGMENT INDEX 3 Scriptname TIF__030012C7 Extends TopicInfo Hidden ;BEGIN FRAGMENT Fragment_2 Function Fragment_2(ObjectReference akSpeakerRef) Actor akSpeaker = akSpeakerRef as Actor ;BEGIN CODE Actor akActorA = Game.GetPlayer() Actor akActorB = akspeaker sslBaseAnimation[] Animations Animations = SexLab.GetAnimationsByTags(2, "Pillory,Vaginal,Aggressive,DomSub", "SubSub,Oral,Anal", true) sslThreadModel SexThread = SexLab.NewThread() SexThread.AddActor(akActorB, isVictim = true) SexThread.AddActor(akActorA) SexThread.SetAnimations(Animations) SexThread.SetBedding(0) SexThread.SetHook("MorsTest") SexThread.DisableRagdollEnd(akActorA, disabling = True) SexThread.DisableRagdollEnd(akActorB, disabling = True) SexThread.DisableLeadIn(disabling = True) SexThread.DisableBedUse(disabling = True) SexThread.DisableUndressAnimation(akActorB, disabling = True) SexThread.DisableUndressAnimation(akActorA, disabling = True) ; Correct animation position so it fits the real pillory the victim is locked in ; (-22.5 is the Z pos difference between real pillory and the one being part of the animation) float[] posCorrection = new float[3] posCorrection[0] = akActorB.GetPositionX()-(22.5*Math.sin(akActorB.GetAngleZ())) posCorrection[1] = akActorB.GetPositionY()-(22.5*Math.cos(akActorB.GetAngleZ())) posCorrection[2] = akActorB.GetPositionZ() float[] angleCorrection = new float[3] angleCorrection[0] = akActorB.GetAngleX() angleCorrection[1] = akActorB.GetAngleY() angleCorrection[2] = akActorB.GetAngleZ() SexThread.CenterOnObject(akActorB) SexThread.CenterOnCoords(posCorrection[0], posCorrection[1], posCorrection[2], angleCorrection[0], angleCorrection[1], angleCorrection[2], true) SexThread.StartThread() ;END CODE EndFunction ;END FRAGMENT ;END FRAGMENT CODE - Do not edit anything between this and the begin comment sexlabframework Property SexLab Auto
Roggvir Posted October 16, 2014 Author Posted October 16, 2014 Problem solved. A script attached to the furniture object, having OnActivation calling refVictim.SetVehicle(refPillory) and then refVictim.PlayIdle(ZazAPPillSolo01), prevents the victim from standing up when the actual interaction anim kicks in (initiated from the player dialogue). This is how the attached script looks like (just a proof of concept - it still has some issues, like the player is not released properly, etc.): Scriptname RoggFurnitureScript extends ObjectReference {Script attached to a furniture, to ensure the victim gets properly prepared and positioned} faction property CurrentFollowerFaction auto {Used to handle player followers using the furniture object} Idle[] Property CalmAnimations Auto {list of idle anims provided by Zaz} actor property akActor auto hidden {hidden property to track who activated the furniture} bool property isPlayer = false auto hidden {hidden property to track if the actor is a player} bool property isFollower = false auto hidden {hidden property to track if the actor is a follower} objectReference property refFurniture auto hidden {hidden property referencing the activated furniture} Event OnLoad() BlockActivation(true) EndEvent Event OnUnload() UnregisterForUpdate() EndEvent auto STATE normal Event OnActivate(ObjectReference akActionRef) GotoState("busy") refFurniture = self as ObjectReference akActor = akActionRef as Actor If akActionRef == Game.GetPlayer() isPlayer = true isFollower = false Else isPlayer = false If akActor.isInFaction(CurrentFollowerFaction) isFollower = true EndIf EndIf ; SetVehicle is supposed to prevent the actor from being pushed away when someone/something bumps into him akActor.SetVehicle(refFurniture) If isPlayer == false ; Translate victim's position and rotation to the furniture, and register for update in one second to set the position as the translation sometimes doesnt end where it should be. akActor.TranslateTo(X,Y,Z, GetAngleX(), GetAngleY(), GetAngleZ(), 10.0) EndIf RegisterForSingleUpdate(1.0) EndEvent EndState STATE busy Event OnActivate(ObjectReference akActionRef) akActor.SetVehicle(None) GotoState("normal") EndEvent Event OnUpdate() UnregisterForUpdate() ; Set victim's position and rotation to the furniture as a workaround for sometimes inaccurate translation (is there a better way?). If akActor ; Start playing the ZazAPPillSolo01 idle animation akActor.PlayIdle(CalmAnimations[0]) If isPlayer akActor.SetPosition(X,Y,Z) akActor.SetAngle(GetAngleX(), GetAngleY(), GetAngleZ()) Else akActor.StopTranslation() akActor.TranslateTo(X,Y,Z, GetAngleX(), GetAngleY(), GetAngleZ(), 0.01, 0.01) akActor.setRestrained() EndIf EndIf EndEvent Event OnEndState() If akActor If isPlayer == false akActor.StopTranslation() EndIf akActor.SetVehicle(None) EndIf UnregisterForUpdate() EndEvent EndState And here is the script started via player dialogue, once the victim is locked in pillory furniture: ;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment ;NEXT FRAGMENT INDEX 3 Scriptname TIF__030012C7 Extends TopicInfo Hidden ;BEGIN FRAGMENT Fragment_2 Function Fragment_2(ObjectReference akSpeakerRef) Actor akSpeaker = akSpeakerRef as Actor ;BEGIN CODE Actor akActorA = Game.GetPlayer() Actor akActorB = akspeaker sslBaseAnimation[] Animations Animations = SexLab.GetAnimationsByTags(2, "Pillory,Vaginal,Aggressive,DomSub", "SubSub,Oral,Anal", true) sslThreadModel SexThread = SexLab.NewThread() SexThread.AddActor(akActorB, isVictim = true) SexThread.AddActor(akActorA) SexThread.SetAnimations(Animations) SexThread.SetBedding(0) SexThread.SetHook("RoggSLTest") SexThread.DisableRagdollEnd(akActorA, disabling = true) SexThread.DisableRagdollEnd(akActorB, disabling = true) SexThread.DisableLeadIn(disabling = true) SexThread.DisableBedUse(disabling = true) ;SexThread.SetStrip(akActorB, New Bool[33]) SexThread.DisableUndressAnimation(akActorB, disabling = true) ;SexThread.SetStrip(akActorA, New Bool[33]) SexThread.DisableUndressAnimation(akActorA, disabling = true) ; Correct animation position so it fits the real pillory the victim is locked in (-22.5 is the correct Z offset for pillory furniture) float[] posCorrection = new float[3] posCorrection[0] = akActorB.GetPositionX()-(22.5*Math.sin(akActorB.GetAngleZ())) posCorrection[1] = akActorB.GetPositionY()-(22.5*Math.cos(akActorB.GetAngleZ())) posCorrection[2] = akActorB.GetPositionZ() float[] angleCorrection = new float[3] angleCorrection[0] = akActorB.GetAngleX() angleCorrection[1] = akActorB.GetAngleY() angleCorrection[2] = akActorB.GetAngleZ() SexThread.CenterOnObject(akActorB) SexThread.CenterOnCoords(posCorrection[0], posCorrection[1], posCorrection[2], angleCorrection[0], angleCorrection[1], angleCorrection[2], true) ;SexThread.Stage = 1 SexThread.StartThread() ;END CODE EndFunction ;END FRAGMENT ;END FRAGMENT CODE - Do not edit anything between this and the begin comment sexlabframework Property SexLab Auto
Recommended Posts
Archived
This topic is now archived and is closed to further replies.