-
Notifications
You must be signed in to change notification settings - Fork 7
/
UD_CustomDevice_RenderScript.psc
4882 lines (4227 loc) · 140 KB
/
UD_CustomDevice_RenderScript.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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Scriptname UD_CustomDevice_RenderScript extends ObjectReference
;bit maps used to code simple values to reduce memory size of script
;-----_deviceControlBitMap_1-----
;00 = 1b, struggleGame_on
;01 = 1b, lockpickGame_on
;02 = 1b, cuttingGame_on
;03 = 1b, keyGame_on
;04 = 1b, repairLocksMinigame_on
int _deviceControlBitMap_1 = 0x00000000 ;BOOL
int _deviceControlBitMap_2 = 0x00000000 ;FLOAT-FULL
int _deviceControlBitMap_3 = 0x00000000 ;FLOAT-FULL
int _deviceControlBitMap_4 = 0x00000000 ;FLOAT-FULL
int _deviceControlBitMap_5 = 0x00000000 ;INT
;-----_deviceControlBitMap_6-----
;00 - 06 = UD_StruggleCritChance
;07 - 14 = UD_LockpickDifficulty
;15 - 19 = UD_Locks
;20 - 26 = UD_CutChance
;27 - 31 = UD_base_stat_drain
int _deviceControlBitMap_6 = 0x4000008F
;-----_deviceControlBitMap_7-----
;00 - 11 = 12b, UD_durability_damage_base
;12 - 21 = 10b, UD_ResistMagicka
;22 - 24 = 3b, !UNUSED!
;25 - 27 = 3b, _struggleGame_Subtype
;28 - 30 = 3b, _struggleGame_Subtype_NPC
int _deviceControlBitMap_7 = 0x001F4064
;-----_deviceControlBitMap_8-----
;00 - 06 = 7b, UD_RegenMagHelper_Stamina
;07 - 13 = 7b, UD_RegenMagHelper_Health
;14 - 20 = 7b, UD_RegenMagHelper_Magicka
;21 - 27 = 7b, _customMinigameCritChance
;28 - 31 = 4b, !UNUSED!
int _deviceControlBitMap_8 = 0x00000000
;-----_deviceControlBitMap_9-----
;00 - 06 = 7b, _customMinigameCritDuration
;07 - 18 = 12b, _customMinigameCritMult
;19 - 25 = 7b, _minMinigameStatHP
;26 - 31 = 6b, !UNUSED!
int _deviceControlBitMap_9 = 0x00000000
;-----_deviceControlBitMap_10-----
;00 - 06 = 7b, _minMinigameStatMP
;07 - 13 = 7b, _minMinigameStatSP
;14 - 21 = 8b, _condition_mult_add
;22 - 29 = 8b, _exhaustion_mult
;30 - 31 = 2b, !UNUSED!
int _deviceControlBitMap_10 = 0x00000000
;-----_deviceControlBitMap_11-----
;00 - 9 = 6b, UD_WeaponHitResist
;10 - 19 = 6b, UD_SpellHitResist
;20 - 29 = 6b, UD_ResistPhysical
;30 - 31 = 2b, !UNUSED!
int _deviceControlBitMap_11 = 0x1F4FFFFF
;--------------------------------PUBLIC VARS----------------------------
;do not modify
Key Property zad_deviceKey auto
Armor Property DeviceRendered auto
;-------------------------------------------------------
;-------!!!!!!!!!!!!ALWAYS FILL!!!!!!!!!!!!!!!----------
Armor Property DeviceInventory auto
zadlibs Property libs auto
Keyword Property UD_DeviceKeyword auto ;keyword of this device for better manipulation
;-------------------------------------------------------
;-------------------------------------------------------
;libs, filled automatically
UnforgivingDevicesMain Property UDmain auto;main function
UD_libs Property UDlibs ;device/keyword library
UD_libs Function get()
return UDmain.UDlibs
EndFunction
EndProperty
UDCustomDeviceMain Property UDCDmain
UDCustomDeviceMain Function get()
return UDmain.UDCDmain
EndFunction
EndProperty
;MAIN VALUES
float property UD_durability_damage_base ;durability dmg per second of struggling, range 0.00 - 40.00, precision 0.01 (4000 values)
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_7 = codeBit(_deviceControlBitMap_7,Round(fRange(fVal,0.0,40.0)*100),12,0)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_7,12,0)/100.0
EndFunction
EndProperty
float Property UD_base_stat_drain ;stamina drain for second of struggling, range 1 - 31, decimal point not used
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_6 = codeBit(_deviceControlBitMap_6,Round(fRange(fVal,1.0,31.0)),5,27)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_6,5,27)
EndFunction
EndProperty
float Property UD_ResistMagicka ;magicka resistence. Needs to be applied to minigame to work!
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_7 = codeBit(_deviceControlBitMap_7,Round(fRange(5.0 + fVal,0.0,10.0)*100),10,12)
endBitMapMutexCheck()
EndFunction
float Function get()
return (decodeBit(_deviceControlBitMap_7,10,12)/100.0) - 5.0
EndFunction
EndProperty
float Property UD_ResistPhysical ;physical resistence. Needs to be applied to minigame to work!
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_11 = codeBit(_deviceControlBitMap_11,Round(fRange(5.0 + fVal,0.0,10.0)*100),10,20)
endBitMapMutexCheck()
EndFunction
float Function get()
return (decodeBit(_deviceControlBitMap_11,10,20)/100.0) - 5.0
EndFunction
EndProperty
float Property UD_WeaponHitResist
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_11 = codeBit(_deviceControlBitMap_11,Round(fRange(5.0 + fVal,0.0,10.0)*100),10,0)
endBitMapMutexCheck()
EndFunction
float Function get()
return (decodeBit(_deviceControlBitMap_11,10,0)/100.0) - 5.0
EndFunction
EndProperty
float Property UD_SpellHitResist
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_11 = codeBit(_deviceControlBitMap_11,Round(fRange(5.0 + fVal,0.0,10.0)*100),10,10)
endBitMapMutexCheck()
EndFunction
float Function get()
return (decodeBit(_deviceControlBitMap_11,10,10)/100.0) - 5.0
EndFunction
EndProperty
float Property UD_CutChance ;chance of cutting device every 1s of minigame, 0.0 is uncuttable
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_6 = codeBit(_deviceControlBitMap_6,Round(fRange(fVal,0.0,100.0)),7,20)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_6,7,20)
EndFunction
EndProperty
float Property UD_LockAccessDifficulty auto ;chance of reaching the lock for every 1s of minigame, 100. is unreachable
float Property UD_StruggleCritMul = 3.0 auto ;how many times of duration is reduced
float Property UD_StruggleCritDuration = 1.0 auto ;crit time, the lover the more faster player needs to press button
Message Property UD_MessageDeviceInteraction auto ;messagebox that is shown when player click on device in inventory
Message Property UD_MessageDeviceInteractionWH auto ;messagebox that is shown when player click on device in NPC inventory
Message Property UD_SpecialMenuInteraction auto
Message Property UD_SpecialMenuInteractionWH auto
LeveledItem Property UD_OnDestroyItemList auto ;items received when device is unlocked
int Property UD_StruggleCritChance ;chance of random crit happening once per second of struggling, range 0-100
Function set(int iVal)
startBitMapMutexCheck()
_deviceControlBitMap_6 = codeBit(_deviceControlBitMap_6,iRange(iVal,0,100),7,0)
endBitMapMutexCheck()
EndFunction
int Function get()
return decodeBit(_deviceControlBitMap_6,7,0)
EndFunction
EndProperty
int Property UD_LockpickDifficulty ;1 = Novice, 25 = Apprentice, 50 = Adept,75 = Expert,100 = Master,255 = Requires Key, range 1-255
Function set(int iVal)
startBitMapMutexCheck()
_deviceControlBitMap_6 = codeBit(_deviceControlBitMap_6,iRange(iVal,1,255),8,7)
endBitMapMutexCheck()
EndFunction
int Function get()
return decodeBit(_deviceControlBitMap_6,8,7)
EndFunction
EndProperty
int Property UD_Locks ;number of locks, range 0-31
Function set(int iVal)
startBitMapMutexCheck()
_deviceControlBitMap_6 = codeBit(_deviceControlBitMap_6,iRange(iVal,0,31),5,15)
endBitMapMutexCheck()
EndFunction
int Function get()
return decodeBit(_deviceControlBitMap_6,5,15)
EndFunction
EndProperty
;Device cooldown, in minutes. Device will activate itself on after this time (if it can)
;zero or negative value will disable this feature
int Property UD_Cooldown = 0 auto
int _currentRndCooldown = 0
string Property UD_ActiveEffectName = "Share" auto ;name of active effect
string Property UD_DeviceType = "Generic" auto ;name of active effect
string[] Property UD_Modifiers auto ;modifiers
string[] Property UD_struggleAnimations auto
string[] Property UD_struggleAnimationsHobl auto
;------------local variables-------------------
Actor Wearer = none ;current device wearer reference
float device_health = 100.0 ;default max device durability, for now always 100
float current_device_health = 0.0 ;current device durability, if this reaches 0, player will escape restrain
float _total_durability_drain = 0.0 ;how much durability was reduced, aka condition
float _durability_damage_mod ;durability dmg after applied difficulty, dont change this! Use updateDifficulty() if you want to update it
float _updateTimePassed = 0.0
;---------------------------------------PRIVATE VARS----------------------------------------
int Property UD_CurrentLocks Hidden ;how many locked locks remain, max is 31
Function set(int iVal)
startBitMapMutexCheck()
_deviceControlBitMap_5 = codeBit(_deviceControlBitMap_5,iRange(iVal,0,31),6,0)
endBitMapMutexCheck()
EndFunction
int Function get()
return decodeBit(_deviceControlBitMap_5,6,0)
EndFunction
endproperty
int Property UD_JammedLocks Hidden ;jammed locks, max is 31
Function set(int iVal)
startBitMapMutexCheck()
_deviceControlBitMap_5 = codeBit(_deviceControlBitMap_5,iRange(iVal,0,31),6,6)
endBitMapMutexCheck()
EndFunction
int Function get()
return decodeBit(_deviceControlBitMap_5,6,6)
EndFunction
endproperty
int Property UD_condition Hidden ;0 - new , 4 - broke
Function set(int iVal)
startBitMapMutexCheck()
_deviceControlBitMap_5 = codeBit(_deviceControlBitMap_5,iRange(iVal,0,4),3,12)
endBitMapMutexCheck()
EndFunction
int Function get()
return decodeBit(_deviceControlBitMap_5,3,12)
EndFunction
endproperty
;minigame control variables
bool Property struggleGame_on Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,0)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,0))
EndFunction
endproperty
bool Property lockpickGame_on Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,1)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,1))
EndFunction
endproperty
bool Property cuttingGame_on Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,2)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,2))
EndFunction
endproperty
bool Property keyGame_on Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,3)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,3))
EndFunction
endproperty
bool Property repairLocksMinigame_on Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,4)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,4))
EndFunction
endproperty
bool Property force_stop_minigame Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,5)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,5))
EndFunction
endproperty
bool Property pauseMinigame Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,6)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,6))
EndFunction
endproperty
bool Property UD_drain_stats Hidden ;if player will loose stats while struggling
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,9)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,9))
EndFunction
endproperty
bool Property UD_drain_stats_helper Hidden ;if player will loose stats while struggling
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,10)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,10))
EndFunction
endproperty
bool Property UD_damage_device Hidden ;if device can be damaged
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,11)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,11))
EndFunction
endproperty
bool Property UD_applyExhastionEffect Hidden ;applies debuff after mnigame ends
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,12)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,12))
EndFunction
endproperty
bool Property UD_applyExhastionEffectHelper Hidden ;applies debuff after minigame ends
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,13)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,13))
EndFunction
endproperty
bool Property UD_minigame_canCrit Hidden ;if crits can appear
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,14)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,14))
EndFunction
endproperty
bool Property UD_useWidget Hidden ;determinate if widget will be shown
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,15)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,15))
EndFunction
endproperty
bool Property UD_WidgetAutoColor Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,16)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,16))
EndFunction
endproperty
bool Property Ready
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,17)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,17))
EndFunction
endproperty
bool Property zad_DestroyOnRemove Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,18)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,18))
EndFunction
endproperty
bool Property zad_DestroyKey Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,19)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,19))
EndFunction
endproperty
bool Property _AVOK Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,20)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,20))
EndFunction
EndProperty
bool Property minigame_on Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,21)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,21))
EndFunction
EndProperty
bool Property _activated Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,22)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,22))
EndFunction
EndProperty
bool Property _removeDeviceCalled Hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,23)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,23))
EndFunction
EndProperty
bool Property UD_minigame_critRegen
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,24)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,24))
EndFunction
EndProperty
bool Property UD_minigame_critRegen_helper
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,25)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,25))
EndFunction
EndProperty
float Property UD_minigame_stamina_drain Hidden ;stamina drain for second of struggling
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_2 = codeBit(_deviceControlBitMap_2,Round(fRange(fVal,0.0,200.0)),8,0)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_2,8,0)
EndFunction
endproperty
float Property UD_minigame_magicka_drain Hidden ;magicka drain for second of struggling
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_2 = codeBit(_deviceControlBitMap_2,Round(fRange(fVal,0.0,200.0)),8,8)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_2,8,8)
EndFunction
endproperty
float Property UD_minigame_heal_drain Hidden ;health drain for second of struggling
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_2 = codeBit(_deviceControlBitMap_2,Round(fRange(fVal,0.0,200.0)),8,16)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_2,8,16);Math.LogicalAnd(_deviceControlBitMap_2,Math.LeftShift(0xFF,16)) as Float
EndFunction
endproperty
float Property UD_minigame_stamina_drain_helper Hidden ;stamina drain for second of struggling
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_2 = codeBit(_deviceControlBitMap_2,Round(fRange(fVal,0.0,200.0)),8,24)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_2,8,24);Math.LogicalAnd(_deviceControlBitMap_2,Math.LeftShift(0xFF,16)) as Float
EndFunction
endproperty
float Property UD_minigame_magicka_drain_helper Hidden ;magicka drain for second of struggling
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_3 = codeBit(_deviceControlBitMap_3,Round(fRange(fVal,0.0,200.0)),8,0)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_3,8,0)
EndFunction
endproperty
float Property UD_minigame_heal_drain_helper Hidden ;health drain for second of struggling
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_3 = codeBit(_deviceControlBitMap_3,Round(fRange(fVal,0.0,200.0)),8,8)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_3,8,8)
EndFunction
endproperty
;stats regeneration when struggling, 0.0 means that wearer will not regen stats, 1.0 will make stats regen like normaly
float Property UD_RegenMag_Stamina Hidden ;health drain for second of struggling
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_4 = codeBit(_deviceControlBitMap_4,Round(fRange(fVal,0.0,1.0)*100),7,0)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_4,7,0)/100.0
EndFunction
endproperty
float Property UD_RegenMag_Health Hidden ;health drain for second of struggling
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_4 = codeBit(_deviceControlBitMap_4,Round(fRange(fVal,0.0,1.0)*100),7,7)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_4,7,7)/100.0
EndFunction
endproperty
float Property UD_RegenMag_Magicka Hidden ;health drain for second of struggling
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_4 = codeBit(_deviceControlBitMap_4,Round(fRange(fVal,0.0,1.0)*100),7,14)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_4,7,14)/100.0
EndFunction
endproperty
;stats regeneration when struggling, 0.0 means that helper will not regen stats, 1.0 will make stats regen like normaly, range 0.01,1.0 with step 0.01. Lesser then 0.01 -> 0.0
float Property UD_RegenMagHelper_Stamina Hidden
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_8 = codeBit(_deviceControlBitMap_8,Round(fRange(fVal,0.0,1.0)*100),7,0)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_8,7,0)/100.0
EndFunction
EndProperty
float Property UD_RegenMagHelper_Health Hidden
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_8 = codeBit(_deviceControlBitMap_8,Round(fRange(fVal,0.0,1.0)*100),7,7)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_8,7,7)/100.0
EndFunction
EndProperty
float Property UD_RegenMagHelper_Magicka Hidden
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_8 = codeBit(_deviceControlBitMap_8,Round(fRange(fVal,0.0,1.0)*100),7,14)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_8,7,14)/100.0
EndFunction
EndProperty
;custom crits
int Property _customMinigameCritChance Hidden
Function set(int iVal)
startBitMapMutexCheck()
_deviceControlBitMap_8 = codeBit(_deviceControlBitMap_8,iRange(iVal,0,100),7,21)
endBitMapMutexCheck()
EndFunction
int Function get()
return decodeBit(_deviceControlBitMap_8,7,21)
EndFunction
EndProperty
float Property _customMinigameCritDuration Hidden
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_9 = codeBit(_deviceControlBitMap_9,Round(fRange(fVal,0.4,2.0)*100),7,0)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_9,7,0)/100.0
EndFunction
EndProperty
float Property _customMinigameCritMult Hidden
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_9 = codeBit(_deviceControlBitMap_9,Round(fRange(fVal,0.25,1000.0)*4),12,7)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_9,12,7)/4.0
EndFunction
EndProperty
;multiplies the durability dmg of minigame
float UD_DamageMult = 1.0
;additional multiplier for other minigames
float UD_MinigameMult1 = 1.0
float UD_MinigameMult2 = 1.0
float UD_MinigameMult3 = 1.0
float UD_durability_damage_add = 0.0 ;adds flat value to durability dmg. Is added beffor UD_DamageMult is applied
;widget vars
int UD_WidgetColor = 0x0000FF
int UD_WidgetColor2 = -1
int UD_WidgetFlashColor = -1
float UD_CuttingProgress = 0.0
float UD_RepairProgress = 0.0
;required stats to start minigame
float Property _minMinigameStatHP Hidden
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_9 = codeBit(_deviceControlBitMap_9,Round(fRange(fVal,0.0,1.0)*100),7,19)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_9,7,19)/100.0
EndFunction
EndProperty
float Property _minMinigameStatMP Hidden
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_10 = codeBit(_deviceControlBitMap_10,Round(fRange(fVal,0.0,1.0)*100),7,0)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_10,7,0)/100.0
EndFunction
EndProperty
float Property _minMinigameStatSP Hidden
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_10 = codeBit(_deviceControlBitMap_10,Round(fRange(fVal,0.0,1.0)*100),7,7)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_10,7,7)/100.0
EndFunction
EndProperty
float Property _condition_mult_add Hidden ;how much is increased condition dmg (10% increase condition dmg by 10%), step = 0.1, max 25.6
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_10 = codeBit(_deviceControlBitMap_10,Round(fRange(fVal,0.0,25.6)*10),8,14)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_10,8,14)/4.0
EndFunction
EndProperty
float Property _exhaustion_mult Hidden ;multiplier for duration of debuff, step = 0.25, max 64
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_10 = codeBit(_deviceControlBitMap_10,Round(fRange(fVal,0.0,64.0)*4),8,22)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_10,8,22)/4.0
EndFunction
EndProperty
float _exhaustion_mult_helper = 1.0 ;multiplier for duration of debuff
Actor _minigameHelper = none
;variables copied from zadEquipScript. !dont change!
bool[] cameraState
String _sStruggleAnim ;currently selected struggle array. Used by minigame. DONT CHANGE
String _sStruggleAnimHelper ;currently selected struggle array. Used by minigame. DONT CHANGE
int Property _struggleGame_Subtype Hidden
Function set(int iVal)
startBitMapMutexCheck()
_deviceControlBitMap_7 = codeBit(_deviceControlBitMap_7,iRange(iVal,0,7),3,25)
endBitMapMutexCheck()
EndFunction
int Function get()
return decodeBit(_deviceControlBitMap_7,3,25)
EndFunction
EndProperty
int Property _struggleGame_Subtype_NPC Hidden
Function set(int iVal)
startBitMapMutexCheck()
_deviceControlBitMap_7 = codeBit(_deviceControlBitMap_7,iRange(iVal,0,7),3,28)
endBitMapMutexCheck()
EndFunction
int Function get()
return decodeBit(_deviceControlBitMap_7,3,28)
EndFunction
EndProperty
float Property zad_JammLockChance hidden;chance of jamming lock
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_3 = codeBit(_deviceControlBitMap_3,Round(fRange(fVal,0.0,100.0)),8,16)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_3,8,16)
EndFunction
endproperty
float Property zad_KeyBreakChance hidden;chance of breaking the key
Function set(float fVal)
startBitMapMutexCheck()
_deviceControlBitMap_3 = codeBit(_deviceControlBitMap_3,Round(fRange(fVal,0.0,100.0)),8,24)
endBitMapMutexCheck()
EndFunction
float Function get()
return decodeBit(_deviceControlBitMap_3,8,24)
EndFunction
endproperty
bool Property _isRemoved hidden
Function set(bool bVal)
startBitMapMutexCheck()
_deviceControlBitMap_1 = codeBit(_deviceControlBitMap_1,bVal as Int,1,26)
endBitMapMutexCheck()
EndFunction
bool Function get()
return Math.LogicalAnd(_deviceControlBitMap_1,Math.LeftShift(0x01,26))
EndFunction
EndProperty
bool _isUnlocked = false
bool Property isUnlocked
Function set(bool bVal)
;can't be changed externally
EndFunction
bool Function get()
return _isUnlocked
EndFunction
EndProperty
;chekcs if animation are set and if not, sets them
Function safeCheckAnimations()
UDCDmain.UDPatcher.safecheckAnimations(self)
EndFunction
;returns current device wearer
Actor Function getWearer()
return Wearer
EndFunction
;returns current device wearers name
String Function getWearerName()
return Wearer.getActorBase().getName()
EndFunction
Function setHelper(Actor akActor)
_minigameHelper = akActor
EndFunction
;returns current minigame helper
Actor Function getHelper()
return _minigameHelper
EndFunction
String Function getHelperName()
if _minigameHelper
return UDCDmain.getActorName(_minigameHelper)
else
return "ERROR"
endif
EndFunction
bool Function WearerIsRegistered()
return UDCDmain.isRegistered(getWearer())
EndFunction
bool Function HelperIsRegistered()
return UDCDmain.isRegistered(getHelper())
EndFunction
bool Function WearerIsPlayer()
If UDCDmain.ActorIsPlayer(getWearer())
return true
EndIf
return false
EndFunction
bool Function WearerIsFollower()
If UDCDmain.ActorIsFollower(getWearer())
return true
EndIf
return false
EndFunction
bool Function PlayerInMinigame()
return WearerIsPlayer() || HelperIsPlayer()
EndFunction
bool Function hasHelper()
if _minigameHelper
return True
endif
return False
EndFunction
bool Function HelperIsPlayer()
If UDCDmain.ActorIsPlayer(getHelper())
return true
EndIf
return false
EndFunction
bool Function HelperIsFollower()
If UDCDmain.ActorIsFollower(getHelper())
return true
EndIf
return false
EndFunction
bool Function isReady()
return Ready
EndFunction
Event onInit()
current_device_health = device_health
EndEvent
;pc frier 3000
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
if (akNewContainer as Actor) && !akOldContainer && !isUnlocked
Init(akNewContainer as Actor)
endif
if UDmain
if (akOldContainer == UDCDmain.TransfereContainer_ObjRef)
if UDCDmain.TraceAllowed()
UDCDmain.Log("Device " + getDeviceHeader() + " transfered to transfer container!")
endif
UDCDmain._transferedDevice = self
endif
endif
EndEvent
string Function getDeviceHeader()
return (getDeviceName() + "("+getWearerName()+")")
EndFunction
String Function getDeviceName()
return deviceInventory.getName()
EndFunction
UD_CustomDevice_EquipScript Function getInventoryScript()
return (UDCDmain.TransfereContainer_ObjRef.placeatme(deviceInventory,1) as UD_CustomDevice_EquipScript)
EndFunction
Function updateValuesFromInventoryScript()
UD_CustomDevice_EquipScript temp = getInventoryScript()
zad_deviceKey = temp.deviceKey
zad_KeyBreakChance = temp.KeyBreakChance
zad_DestroyOnRemove = temp.DestroyOnRemove
zad_DestroyKey = temp.DestroyKey
zad_JammLockChance = temp.LockJamChance
DeviceRendered = temp.DeviceRendered
temp.delete()
if zad_DestroyOnRemove && !hasModifier("DOR")
addModifier("DOR")
endif
EndFunction
bool Function addModifier(string modifier,string param = "")
if !hasModifier(modifier)
if param != ""
UD_Modifiers = PapyrusUtil.PushString(UD_Modifiers, modifier + ";" + param)