-
Notifications
You must be signed in to change notification settings - Fork 38
/
sslEffectDebug.psc
225 lines (186 loc) · 6.2 KB
/
sslEffectDebug.psc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
Scriptname sslEffectDebug extends ActiveMagicEffect
import PapyrusUtil
SexLabFramework property SexLab auto
sslSystemConfig property Config auto
Actor property PlayerRef auto
Actor Ref1
Actor Ref2
float scale1
float scale2
string ActorName
ObjectReference MarkerRef
sslBenchmark function Benchmark(int Tests = 1, int Iterations = 5000, int Loops = 10, bool UseBaseLoop = false)
return (Quest.GetQuest("SexLabDev") as sslBenchmark).StartBenchmark(Tests, Iterations, Loops, UseBaseLoop)
endFunction
; GlobalVariable TimeScale
; float TimeStart
; float TimeEnd
event OnEffectStart(Actor TargetRef, Actor CasterRef)
SexLab.QuickStart(CasterRef, TargetRef)
; Form UmbraBossQuest = Game.GetFormFromFile(0xBFC, "ccbgssse016-umbra.esm")
; Log("UmbraBossQuest: "+UmbraBossQuest)
; Form Lurker = Game.GetFormFromFile(0x817, "ccpewsse002-armsofchaos.esl")
; Log("Lurker: "+Lurker)
; StorageUtil.SetFormValue(UmbraBossQuest, "test1", Lurker)
; Log("Test 1: "+StorageUtil.GetFormValue(UmbraBossQuest, "test1"))
; StorageUtil.SetFormValue(Lurker, "test2", UmbraBossQuest)
; Log("Test 2: "+StorageUtil.GetFormValue(Lurker, "test2"))
; StorageUtil.FormListAdd(None, "test3", UmbraBossQuest, false)
; StorageUtil.FormListAdd(None, "test3", Lurker, false)
; StorageUtil.FormListAdd(None, "test3", SexLab, false)
; StorageUtil.FormListAdd(None, "test3", TargetRef, false)
; StorageUtil.FormListAdd(None, "test3", none, false)
; form[] listtest = StorageUtil.FormListToArray(None, "test3")
; Log("Test 3: "+listtest)
; int cleaned = StorageUtil.debug_Cleanup()
; Log("Cleaned: "+cleaned)
; MiscUtil.ToggleFreeCamera()
; Log("Result: "+TestList2)
; TimeScale = Game.GetFormFromFile(0x3A, "Skyrim.esm") as GlobalVariable
; TimeStart = SexLabUtil.GetCurrentGameRealTime()
; TimeEnd = TimeStart + 5.0
; Log("TimeScale: "+(TimeScale.GetValue() as float))
; Log("TimeStart: "+TimeStart)
; Log("TimeEnd: "+TimeEnd)
; Log("Timer Start!")
; RegisterForSingleUpdate(0.1)
; Log("GetCurrentRealTime: "+Utility.GetCurrentRealTime())
; Log("GetCurrentGameTime: "+Utility.GetCurrentGameTime())
; Log("GetCurrentGameRealTime: "+SexLabUtil.GetCurrentGameRealTime())
Dispel()
endEvent
event OnUpdate()
;/ float CurrentTime = SexLabUtil.GetCurrentGameRealTime()
if CurrentTime < TimeEnd
; Log("Timer Continues!\n\t - CurrentTime: "+CurrentTime+"\n\t - TimeStart: "+TimeStart+"\n\t - TimeEnd: "+TimeEnd)
RegisterForSingleUpdate(0.1)
else
float Overage = (TimeEnd - CurrentTime)
Log("Timer End!\n\t - CurrentTime: "+CurrentTime+"\n\t - TimeStart: "+TimeStart+"\n\t - TimeEnd: "+TimeEnd+"\n\t - Overage: "+Overage)
Debug.MessageBox("Timer End!\nOverage: "+Overage)
Dispel()
endIf/;
endEvent
event OnEffectFinish(Actor TargetRef, Actor CasterRef)
if MarkerRef
TargetRef.SetVehicle(none)
MarkerRef.Disable()
MarkerRef.Delete()
MarkerRef = none
endIf
SexLabUtil.PrintConsole("---- DEBUG EFFECT FINISHED ----")
endEvent
;/-----------------------------------------------\;
;| Debug Utility Functions |;
;\-----------------------------------------------/;
function Log(string log)
; Debug.Notification(log)
Debug.Trace(log)
Debug.TraceUser("SexLabDebug", log)
SexLabUtil.PrintConsole(log)
endfunction
string function GetActorNames(Actor[] Actors)
string names
int i = Actors.Length
while i
i -= 1
names += "["+Actors[i].GetLeveledActorBase().GetName()+"]"
endWhile
return names
endFunction
string function GetObjNames(ObjectReference[] Objects)
string names
int i = Objects.Length
while i
i -= 1
names += "["+Objects[i].GetName()+"]"
endWhile
return names
endFunction
Actor[] function ObjsToActors(ObjectReference[] Objects)
int i = Objects.Length
Actor[] output = PapyrusUtil.ActorArray(i)
while i
i -= 1
output[i] = Objects[i] as Actor
endWhile
return output
endFunction
float[] function GetCoords(Actor ActorRef)
float[] coords = new float[6]
coords[0] = ActorRef.GetPositionX()
coords[1] = ActorRef.GetPositionY()
coords[2] = ActorRef.GetPositionZ()
coords[3] = ActorRef.GetAngleX()
coords[4] = ActorRef.GetAngleY()
coords[5] = ActorRef.GetAngleZ()
return coords
endFunction
float[] function OffsetCoords(float[] Loc, float[] CenterLoc, float[] Offsets)
Loc[0] = CenterLoc[0] + ( Math.sin(CenterLoc[5]) * Offsets[0] ) + ( Math.cos(CenterLoc[5]) * Offsets[1] )
Loc[1] = CenterLoc[1] + ( Math.cos(CenterLoc[5]) * Offsets[0] ) + ( Math.sin(CenterLoc[5]) * Offsets[1] )
Loc[2] = CenterLoc[2] + Offsets[2]
Loc[3] = CenterLoc[3]
Loc[4] = CenterLoc[4]
Loc[5] = CenterLoc[5] + Offsets[3]
if Loc[5] >= 360.0
Loc[5] = Loc[5] - 360.0
elseIf Loc[5] < 0.0
Loc[5] = Loc[5] + 360.0
endIf
return Loc
endFunction
float function Scale(Actor ActorRef)
float display = ActorRef.GetScale()
ActorRef.SetScale(1.0)
float base = ActorRef.GetScale()
float ActorScale = ( display / base )
ActorRef.SetScale(ActorScale)
float AnimScale = (1.0 / base)
return AnimScale
endFunction
function LockActor(actor ActorRef)
ActorRef.StopCombat()
; Disable movement
if ActorRef == SexLab.PlayerRef
Game.DisablePlayerControls(false, false, false, false, false, false, true, false, 0)
Game.ForceThirdPerson()
; Game.SetPlayerAIDriven()
else
ActorRef.SetRestrained(true)
ActorRef.SetDontMove(true)
endIf
; Start DoNothing package
ActorUtil.AddPackageOverride(ActorRef, SexLab.ActorLib.DoNothing, 100)
ActorRef.SetFactionRank(SexLab.AnimatingFaction, 1)
ActorRef.EvaluatePackage()
endFunction
function UnlockActor(actor ActorRef)
; Enable movement
if ActorRef == SexLab.PlayerRef
Game.EnablePlayerControls(false, false, false, false, false, false, true, false, 0)
; Game.SetPlayerAIDriven(false)
else
ActorRef.SetRestrained(false)
ActorRef.SetDontMove(false)
endIf
; Remove from animation faction
ActorUtil.RemovePackageOverride(ActorRef, SexLab.ActorLib.DoNothing)
ActorRef.RemoveFromFaction(SexLab.AnimatingFaction)
ActorRef.EvaluatePackage()
; Detach positioning marker
ActorRef.StopTranslation()
ActorRef.SetVehicle(none)
endFunction
function SpawnMarker(Actor TargetRef)
if !MarkerRef
MarkerRef = TargetRef.PlaceAtMe(Config.BaseMarker)
int cycle
while !MarkerRef.Is3DLoaded() && cycle < 50
Utility.Wait(0.1)
cycle += 1
endWhile
endIf
MarkerRef.Enable()
MarkerRef.MoveTo(TargetRef)
endFunction