-
Notifications
You must be signed in to change notification settings - Fork 107
/
NPCs.bb
7461 lines (6427 loc) · 254 KB
/
NPCs.bb
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
;[Block]
Global Curr173.NPCs, Curr106.NPCs, Curr096.NPCs, Curr5131.NPCs
Const NPCtype173% = 1, NPCtypeOldMan% = 2, NPCtypeGuard% = 3, NPCtypeD% = 4
Const NPCtype372% = 6, NPCtypeApache% = 7, NPCtypeMTF% = 8, NPCtype096 = 9
Const NPCtype049% = 10, NPCtypeZombie% = 11, NPCtype5131% = 12, NPCtypeTentacle% = 13
Const NPCtype860% = 14, NPCtype939% = 15, NPCtype066% = 16, NPCtypePdPlane% = 17
Const NPCtype966% = 18, NPCtype1048a = 19, NPCtype1499% = 20, NPCtype008% = 21, NPCtypeClerk% = 22
;[End Block]
Type NPCs
Field obj%, obj2%, obj3%, obj4%, Collider%
Field NPCtype%, ID%
Field DropSpeed#, Gravity%
Field State#, State2#, State3#, PrevState%
Field MakingNoise%
Field Frame#
Field Angle#
Field Sound%, SoundChn%, SoundTimer#
Field Sound2%, SoundChn2%
Field Speed#, CurrSpeed#
Field texture$
Field Idle#
Field Reload#
Field LastSeen%, LastDist#
Field PrevX#, PrevY#, PrevZ#
Field Target.NPCs, TargetID%
Field EnemyX#, EnemyY#, EnemyZ#
Field Path.WayPoints[20], PathStatus%, PathTimer#, PathLocation%
Field NVX#,NVY#,NVZ#,NVName$
Field GravityMult# = 1.0
Field MaxGravity# = 0.2
Field MTFVariant%
Field MTFLeader.NPCs
Field IsDead%
Field BlinkTimer# = 1.0
Field IgnorePlayer%
Field ManipulateBone%
Field ManipulationType%
Field BoneToManipulate$
Field BonePitch#
Field BoneYaw#
Field BoneRoll#
Field NPCNameInSection$
Field InFacility% = True
Field CanUseElevator% = False
Field CurrElevator.ElevatorObj
Field HP%
Field PathX#,PathZ#
Field Model$
Field ModelScaleX#,ModelScaleY#,ModelScaleZ#
Field HideFromNVG
Field TextureID%=-1
Field CollRadius#
Field IdleTimer#
Field SoundChn_IsStream%,SoundChn2_IsStream%
Field FallingPickDistance#
End Type
Function CreateNPC.NPCs(NPCtype%, x#, y#, z#)
Local n.NPCs = New NPCs, n2.NPCs
Local temp#, i%, diff1, bump1, spec1
Local sf, b, t1
n\NPCtype = NPCtype
n\GravityMult = 1.0
n\MaxGravity = 0.2
n\CollRadius = 0.2
n\FallingPickDistance = 10
Select NPCtype
Case NPCtype173
;[Block]
n\NVName = "SCP-173"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.23, 0.32
EntityType n\Collider, HIT_PLAYER
n\Gravity = True
n\obj = LoadMesh_Strict("GFX\npcs\173_2.b3d")
;On Halloween set jack-o-latern texture.
If (Left(CurrentDate(), 7) = "31 Oct ") Then
HalloweenTex = True
Local texFestive = LoadTexture_Strict("GFX\npcs\173h.pt", 1)
EntityTexture n\obj, texFestive, 0, 0
FreeTexture texFestive
EndIf
temp# = (GetINIFloat("DATA\NPCs.ini", "SCP-173", "scale") / MeshDepth(n\obj))
ScaleEntity n\obj, temp,temp,temp
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-173", "speed") / 100.0)
n\obj2 = LoadMesh_Strict("GFX\173box.b3d")
ScaleEntity n\obj2, RoomScale, RoomScale, RoomScale
HideEntity n\obj2
n\CollRadius = 0.32
;[End Block]
Case NPCtypeOldMan
;[Block]
n\NVName = "SCP-106"
n\Collider = CreatePivot()
n\GravityMult = 0.0
n\MaxGravity = 0.0
EntityRadius n\Collider, 0.2
EntityType n\Collider, HIT_PLAYER
n\obj = LoadAnimMesh_Strict("GFX\npcs\106_2.b3d")
temp# = (GetINIFloat("DATA\NPCs.ini", "SCP-106", "scale") / 2.2)
ScaleEntity n\obj, temp, temp, temp
Local OldManEyes% = LoadTexture_Strict("GFX\npcs\oldmaneyes.jpg")
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-106", "speed") / 100.0)
n\obj2 = CreateSprite()
ScaleSprite(n\obj2, 0.03, 0.03)
EntityTexture(n\obj2, OldManEyes)
EntityBlend (n\obj2, 3)
EntityFX(n\obj2, 1 + 8)
SpriteViewMode(n\obj2, 2)
FreeTexture OldManEyes%
;[End Block]
Case NPCtypeGuard
;[Block]
n\NVName = "Human"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
;EntityRadius Collider, 0.15, 0.30
EntityType n\Collider, HIT_PLAYER
n\obj = CopyEntity(GuardObj) ;LoadAnimMesh_Strict("GFX\npcs\mtf.b3d")
n\Speed = (GetINIFloat("DATA\NPCs.ini", "Guard", "speed") / 100.0)
temp# = (GetINIFloat("DATA\NPCs.ini", "Guard", "scale") / 2.5)
ScaleEntity n\obj, temp, temp, temp
MeshCullBox (n\obj, -MeshWidth(GuardObj), -MeshHeight(GuardObj), -MeshDepth(GuardObj), MeshWidth(GuardObj)*2, MeshHeight(GuardObj)*2, MeshDepth(GuardObj)*2)
;[End Block]
Case NPCtypeMTF
;[Block]
n\NVName = "Human"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
;EntityRadius Collider, 0.15, 0.30
EntityType n\Collider, HIT_PLAYER
;EntityPickMode n\Collider, 1
n\obj = CopyEntity(MTFObj) ;LoadAnimMesh_Strict("GFX\npcs\mtf.b3d")
n\Speed = (GetINIFloat("DATA\NPCs.ini", "MTF", "speed") / 100.0)
temp# = (GetINIFloat("DATA\NPCs.ini", "MTF", "scale") / 2.5)
ScaleEntity n\obj, temp, temp, temp
MeshCullBox (n\obj, -MeshWidth(MTFObj), -MeshHeight(MTFObj), -MeshDepth(MTFObj), MeshWidth(MTFObj)*2, MeshHeight(MTFObj)*2, MeshDepth(MTFObj)*2)
If MTFSFX(0)=0 Then
MTFSFX(0)=LoadSound_Strict("SFX\Character\MTF\ClassD1.ogg")
MTFSFX(1)=LoadSound_Strict("SFX\Character\MTF\ClassD2.ogg")
MTFSFX(2)=LoadSound_Strict("SFX\Character\MTF\ClassD3.ogg")
MTFSFX(3)=LoadSound_Strict("SFX\Character\MTF\ClassD4.ogg")
;MTFSFX(4)=LoadSound_Strict("SFX\Character\MTF\Tesla0.ogg")
MTFSFX(5)=LoadSound_Strict("SFX\Character\MTF\Beep.ogg")
MTFSFX(6)=LoadSound_Strict("SFX\Character\MTF\Breath.ogg")
EndIf
If MTFrooms[6]=Null Then
For r.Rooms = Each Rooms
Select Lower(r\RoomTemplate\Name)
Case "room106"
MTFrooms[0]=r
Case "roompj"
MTFrooms[1]=r
Case "room079"
MTFrooms[2]=r
Case "room2poffices"
MTFrooms[3]=r
Case "914"
MTFrooms[4]=r
Case "coffin"
MTFrooms[5]=r
Case "start"
MTFrooms[6]=r
End Select
Next
EndIf
;[End Block]
Case NPCtypeD
;[Block]
n\NVName = "Human"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.32
EntityType n\Collider, HIT_PLAYER
n\obj = CopyEntity(ClassDObj)
temp# = 0.5 / MeshWidth(n\obj)
ScaleEntity n\obj, temp, temp, temp
n\Speed = 2.0 / 100
MeshCullBox (n\obj, -MeshWidth(ClassDObj), -MeshHeight(ClassDObj), -MeshDepth(ClassDObj), MeshWidth(ClassDObj)*2, MeshHeight(ClassDObj)*2, MeshDepth(ClassDObj)*2)
n\CollRadius = 0.32
;[End Block]
Case NPCtype372
;[Block]
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
n\obj = LoadAnimMesh_Strict("GFX\npcs\372.b3d")
temp# = 0.35 / MeshWidth(n\obj)
ScaleEntity n\obj, temp, temp, temp
;[End Block]
Case NPCtype5131
;[Block]
n\NVName = "SCP-513-1"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
n\obj = LoadAnimMesh_Strict("GFX\npcs\bll.b3d")
n\obj2 = CopyEntity (n\obj)
EntityAlpha n\obj2, 0.6
temp# = 1.8 / MeshWidth(n\obj)
ScaleEntity n\obj, temp, temp, temp
ScaleEntity n\obj2, temp, temp, temp
;[End Block]
Case NPCtype096
;[Block]
n\NVName = "SCP-096"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.26
EntityType n\Collider, HIT_PLAYER
n\obj = LoadAnimMesh_Strict("GFX\npcs\scp096.b3d")
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-096", "speed") / 100.0)
temp# = (GetINIFloat("DATA\NPCs.ini", "SCP-096", "scale") / 3.0)
ScaleEntity n\obj, temp, temp, temp
MeshCullBox (n\obj, -MeshWidth(n\obj)*2, -MeshHeight(n\obj)*2, -MeshDepth(n\obj)*2, MeshWidth(n\obj)*2, MeshHeight(n\obj)*4, MeshDepth(n\obj)*4)
n\CollRadius = 0.26
;[End Block]
Case NPCtype049
;[Block]
n\NVName = "SCP-049"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
EntityType n\Collider, HIT_PLAYER
;n\obj = LoadAnimMesh_Strict("GFX\npcs\scp-049.b3d")
n\obj = CopyEntity(NPC049OBJ)
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-049", "speed") / 100.0)
temp# = GetINIFloat("DATA\NPCs.ini", "SCP-049", "scale")
ScaleEntity n\obj, temp, temp, temp
n\Sound = LoadSound_Strict("SFX\Horror\Horror12.ogg")
If HorrorSFX(13)=0 Then HorrorSFX(13)=LoadSound_Strict("SFX\Horror\Horror13.ogg")
n\CanUseElevator = True
;[End Block]
Case NPCtypeZombie
;[Block]
n\NVName = "Human"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
EntityType n\Collider, HIT_PLAYER
;For n2.NPCs = Each NPCs
; If n\NPCtype = n2\NPCtype And n<>n2 Then
; n\obj = CopyEntity (n2\obj)
; Exit
; EndIf
;Next
If n\obj = 0 Then
;n\obj = LoadAnimMesh_Strict("GFX\npcs\zombie1.b3d")
n\obj = CopyEntity(NPC0492OBJ)
temp# = (GetINIFloat("DATA\NPCs.ini", "SCP-049-2", "scale") / 2.5)
ScaleEntity n\obj, temp, temp, temp
MeshCullBox (n\obj, -MeshWidth(n\obj), -MeshHeight(n\obj), -MeshDepth(n\obj), MeshWidth(n\obj)*2, MeshHeight(n\obj)*2, MeshDepth(n\obj)*2)
EndIf
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-049-2", "speed") / 100.0)
SetAnimTime(n\obj, 107)
n\Sound = LoadSound_Strict("SFX\SCP\049\0492Breath.ogg")
n\HP = 100
;[End Block]
Case NPCtypeApache
;[Block]
n\NVName = "Human"
n\GravityMult = 0.0
n\MaxGravity = 0.0
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
n\obj = CopyEntity(ApacheObj);LoadAnimMesh_Strict("GFX\apache.b3d")
n\obj2 = CopyEntity(ApacheRotorObj);LoadAnimMesh_Strict("GFX\apacherotor.b3d",n\obj)
EntityParent n\obj2,n\obj
For i = -1 To 1 Step 2
Local rotor2 = CopyEntity(n\obj2,n\obj2)
RotateEntity rotor2,0,4.0*i,0
EntityAlpha rotor2, 0.5
Next
n\obj3 = LoadAnimMesh_Strict("GFX\apacherotor2.b3d",n\obj)
PositionEntity n\obj3, 0.0, 2.15, -5.48
EntityType n\Collider, HIT_APACHE
EntityRadius n\Collider, 3.0
For i = -1 To 1 Step 2
Local Light1 = CreateLight(2,n\obj)
;room\LightDist[i] = range
LightRange(Light1,2.0)
LightColor(Light1,255,255,255)
PositionEntity(Light1, 1.65*i, 1.17, -0.25)
Local lightsprite = CreateSprite(n\obj)
PositionEntity(lightsprite, 1.65*i, 1.17, 0, -0.25)
ScaleSprite(lightsprite, 0.13, 0.13)
EntityTexture(lightsprite, LightSpriteTex(0))
EntityBlend (lightsprite, 3)
EntityFX lightsprite, 1+8
Next
temp# = 0.6
ScaleEntity n\obj, temp, temp, temp
;[End Block]
Case NPCtypeTentacle
;[Block]
n\NVName = "Unidentified"
n\Collider = CreatePivot()
For n2.NPCs = Each NPCs
If n\NPCtype = n2\NPCtype And n<>n2 Then
n\obj = CopyEntity (n2\obj)
Exit
EndIf
Next
If n\obj = 0 Then
n\obj = LoadAnimMesh_Strict("GFX\NPCs\035tentacle.b3d")
ScaleEntity n\obj, 0.065,0.065,0.065
EndIf
SetAnimTime n\obj, 283
;[End Block]
Case NPCtype860
;[Block]
n\NVName = "Unidentified"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.25
EntityType n\Collider, HIT_PLAYER
n\obj = LoadAnimMesh_Strict("GFX\npcs\forestmonster.b3d")
EntityFX(n\obj, 1)
tex = LoadTexture_Strict("GFX\npcs\860_eyes.png",1+2)
n\obj2 = CreateSprite()
ScaleSprite(n\obj2, 0.1, 0.1)
EntityTexture(n\obj2, tex)
FreeTexture tex
EntityFX(n\obj2, 1 + 8)
EntityBlend(n\obj2, BLEND_ADD)
SpriteViewMode(n\obj2, 2)
n\Speed = (GetINIFloat("DATA\NPCs.ini", "forestmonster", "speed") / 100.0)
temp# = (GetINIFloat("DATA\NPCs.ini", "forestmonster", "scale") / 20.0)
ScaleEntity n\obj, temp, temp, temp
MeshCullBox (n\obj, -MeshWidth(n\obj)*2, -MeshHeight(n\obj)*2, -MeshDepth(n\obj)*2, MeshWidth(n\obj)*2, MeshHeight(n\obj)*4, MeshDepth(n\obj)*4)
n\CollRadius = 0.25
;[End Block]
Case NPCtype939
;[Block]
;i = 53
;For n2.NPCs = Each NPCs
; If (n\NPCtype = n2\NPCtype) And (n<>n2) Then i=i+36
;Next
;n\NVName = "SCP-939-"+i
Local amount939% = 0
For n2.NPCs = Each NPCs
If (n\NPCtype = n2\NPCtype) And (n<>n2)
amount939% = amount939% + 1
EndIf
Next
If amount939% = 0 Then i = 53
If amount939% = 1 Then i = 89
If amount939% = 2 Then i = 96
n\NVName = "SCP-939-"+i
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.3
EntityType n\Collider, HIT_PLAYER
For n2.NPCs = Each NPCs
If n\NPCtype = n2\NPCtype And n<>n2 Then
n\obj = CopyEntity (n2\obj)
Exit
EndIf
Next
If n\obj = 0 Then
n\obj = LoadAnimMesh_Strict("GFX\NPCs\scp-939.b3d")
;If BumpEnabled Then
; bump1 = LoadTexture_Strict("GFX\npcs\scp-939_licker_normal.png")
; ;TextureBlend bump1, FE_BUMP ;USE DOT3
;
; For i = 2 To CountSurfaces(n\obj)
; sf = GetSurface(n\obj,i)
; b = GetSurfaceBrush( sf )
; If b<>0 Then
; t1 = GetBrushTexture(b,0)
; If t1<>0 Then
; Select Lower(StripPath(TextureName(t1)))
; Case "scp-939-licker_diffusetest01.png"
;
; ;BrushTexture b, bump1, 0, 0
; BrushTexture b, t1, 0, 1
; PaintSurface sf,b
;
; ;If StripPath(TextureName(t1)) <> "" Then FreeTexture t1
; ;FreeBrush b
; End Select
; FreeTexture t1
; EndIf
; FreeBrush b
; EndIf
; Next
; FreeTexture bump1
;EndIf
temp# = GetINIFloat("DATA\NPCs.ini", "SCP-939", "scale")/2.5
ScaleEntity n\obj, temp, temp, temp
EndIf
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-939", "speed") / 100.0)
n\CollRadius = 0.3
;[End Block]
Case NPCtype066
;[Block]
n\NVName = "SCP-066"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
EntityType n\Collider, HIT_PLAYER
n\obj = LoadAnimMesh_Strict("GFX\NPCs\scp-066.b3d")
temp# = GetINIFloat("DATA\NPCs.ini", "SCP-066", "scale")/2.5
ScaleEntity n\obj, temp, temp, temp
;If BumpEnabled Then
; diff1 = LoadTexture_Strict("GFX\npcs\scp-066_diffuse01.jpg")
; bump1 = LoadTexture_Strict("GFX\npcs\scp-066_normal.png")
; ;TextureBlend bump1, FE_BUMP ;USE DOT3
; EntityTexture n\obj, bump1, 0, 1
; EntityTexture n\obj, diff1, 0, 2
; FreeTexture diff1
; FreeTexture bump1
;EndIf
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-066", "speed") / 100.0)
;[End Block]
Case NPCtype966
;[Block]
i = 1
For n2.NPCs = Each NPCs
If (n\NPCtype = n2\NPCtype) And (n<>n2) Then i=i+1
Next
n\NVName = "SCP-966-"+i
n\Collider = CreatePivot()
EntityRadius n\Collider,0.2
For n2.NPCs = Each NPCs
If (n\NPCtype = n2\NPCtype) And (n<>n2) Then
n\obj = CopyEntity (n2\obj)
Exit
EndIf
Next
If n\obj = 0 Then
n\obj = LoadAnimMesh_Strict("GFX\npcs\scp-966.b3d")
EndIf
EntityFX n\obj,1
temp# = GetINIFloat("DATA\NPCs.ini", "SCP-966", "scale")/40.0
ScaleEntity n\obj, temp, temp, temp
;EntityColor n\obj,Rnd(0,50),0,Rnd(50,100)
SetAnimTime n\obj,15.0
EntityType n\Collider,HIT_PLAYER
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-966", "speed") / 100.0)
;[End Block]
Case NPCtype1048a
;[Block]
n\NVName = "SCP-1048-A"
n\obj = LoadAnimMesh_Strict("GFX\npcs\scp-1048a.b3d")
ScaleEntity n\obj, 0.05,0.05,0.05
SetAnimTime(n\obj, 2)
n\Sound = LoadSound_Strict("SFX\SCP\1048A\Shriek.ogg")
n\Sound2 = LoadSound_Strict("SFX\SCP\1048A\Growth.ogg")
;[End Block]
Case NPCtype1499
;[Block]
n\NVName = "Unidentified"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
EntityType n\Collider, HIT_PLAYER
For n2.NPCs = Each NPCs
If (n\NPCtype = n2\NPCtype) And (n<>n2) Then
n\obj = CopyEntity (n2\obj)
Exit
EndIf
Next
If n\obj = 0 Then
n\obj = LoadAnimMesh_Strict("GFX\npcs\1499-1.b3d")
EndIf
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-1499-1", "speed") / 100.0) * Rnd(0.9,1.1)
temp# = (GetINIFloat("DATA\NPCs.ini", "SCP-1499-1", "scale") / 4.0) * Rnd(0.8,1.0)
ScaleEntity n\obj, temp, temp, temp
EntityFX n\obj,1
EntityAutoFade n\obj,HideDistance*2.5,HideDistance*2.95
;[End Block]
Case NPCtype008
;[Block]
n\NVName = "Human"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
EntityType n\Collider, HIT_PLAYER
n\obj = LoadAnimMesh_Strict("GFX\npcs\zombiesurgeon.b3d")
temp# = 0.5 / MeshWidth(n\obj)
ScaleEntity n\obj, temp, temp, temp
n\Speed = 2.0 / 100
MeshCullBox (n\obj, -MeshWidth(n\obj), -MeshHeight(n\obj), -MeshDepth(n\obj), MeshWidth(n\obj)*2, MeshHeight(n\obj)*2, MeshDepth(n\obj)*2)
SetNPCFrame n,11
n\Sound = LoadSound_Strict("SFX\SCP\049\0492Breath.ogg")
n\HP = 120
;[End Block]
Case NPCtypeClerk
;[Block]
n\NVName = "Human"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.32
EntityType n\Collider, HIT_PLAYER
n\obj = CopyEntity(ClerkOBJ)
temp# = 0.5 / MeshWidth(n\obj)
ScaleEntity n\obj, temp, temp, temp
n\Speed = 2.0 / 100
MeshCullBox (n\obj, -MeshWidth(ClerkOBJ), -MeshHeight(ClerkOBJ), -MeshDepth(ClerkOBJ), MeshWidth(ClerkOBJ)*2, MeshHeight(ClerkOBJ)*2, MeshDepth(ClerkOBJ)*2)
n\CollRadius = 0.32
;[End Block]
End Select
PositionEntity(n\Collider, x, y, z, True)
PositionEntity(n\obj, x, y, z, True)
ResetEntity(n\Collider)
n\ID = 0
n\ID = FindFreeNPCID()
DebugLog ("Created NPC "+n\NVName+" (ID: "+n\ID+")")
NPCSpeedChange(n)
Return n
End Function
Function RemoveNPC(n.NPCs)
If n=Null Then Return
If n\obj2 <> 0 Then
FreeEntity n\obj2
n\obj2 = 0
EndIf
If n\obj3 <> 0 Then
FreeEntity n\obj3
n\obj3 = 0
EndIf
If n\obj4 <> 0 Then
FreeEntity n\obj4
n\obj4 = 0
EndIf
If (Not n\SoundChn_IsStream)
If (n\SoundChn <> 0 And ChannelPlaying(n\SoundChn)) Then
StopChannel(n\SoundChn)
EndIf
Else
If (n\SoundChn <> 0)
StopStream_Strict(n\SoundChn)
EndIf
EndIf
If (Not n\SoundChn2_IsStream)
If (n\SoundChn2 <> 0 And ChannelPlaying(n\SoundChn2)) Then
StopChannel(n\SoundChn2)
EndIf
Else
If (n\SoundChn2 <> 0)
StopStream_Strict(n\SoundChn2)
EndIf
EndIf
If n\Sound<>0 Then FreeSound_Strict n\Sound
If n\Sound2<>0 Then FreeSound_Strict n\Sound2
FreeEntity(n\obj) : n\obj = 0
FreeEntity(n\Collider) : n\Collider = 0
Delete n
End Function
Function UpdateNPCs()
CatchErrors("Uncaught (UpdateNPCs)")
Local n.NPCs, n2.NPCs, d.Doors, de.Decals, r.Rooms, eo.ElevatorObj, eo2.ElevatorObj
Local i%, dist#, dist2#, angle#, x#, y#, z#, prevFrame#, PlayerSeeAble%, RN$
Local target
For n.NPCs = Each NPCs
;A variable to determine if the NPC is in the facility or not
n\InFacility = CheckForNPCInFacility(n)
Select n\NPCtype
Case NPCtype173
;[Block]
If Curr173\Idle <> 3 Then
dist# = EntityDistance(n\Collider, Collider)
n\State3 = 1
If n\Idle < 2 Then
If n\IdleTimer > 0.1
n\Idle = 1
n\IdleTimer = Max(n\IdleTimer-FPSfactor,0.1)
ElseIf n\IdleTimer = 0.1
n\Idle = 0
n\IdleTimer = 0
EndIf
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider) - 0.32, EntityZ(n\Collider))
RotateEntity (n\obj, 0, EntityYaw(n\Collider)-180, 0)
If n\Idle = False Then
Local temp% = False
Local move% = True
If dist < 15 Then
If dist < 10.0 Then
If EntityVisible(n\Collider, Collider) Then
temp = True
n\EnemyX = EntityX(Collider, True)
n\EnemyY = EntityY(Collider, True)
n\EnemyZ = EntityZ(Collider, True)
EndIf
EndIf
Local SoundVol# = Max(Min((Distance(EntityX(n\Collider), EntityZ(n\Collider), n\PrevX, n\PrevZ) * 2.5), 1.0), 0.0)
n\SoundChn = LoopSound2(StoneDragSFX, n\SoundChn, Camera, n\Collider, 10.0, n\State)
n\PrevX = EntityX(n\Collider)
n\PrevZ = EntityZ(n\Collider)
If (BlinkTimer < - 16 Or BlinkTimer > - 6) And (IsNVGBlinking=False) Then
If EntityInView(n\obj, Camera) Then move = False
EndIf
EndIf
If NoTarget Then move = True
;player is looking at it -> doesn't move
If move=False Then
BlurVolume = Max(Max(Min((4.0 - dist) / 6.0, 0.9), 0.1), BlurVolume)
CurrCameraZoom = Max(CurrCameraZoom, (Sin(Float(MilliSecs2())/20.0)+1.0)*15.0*Max((3.5-dist)/3.5,0.0))
If dist < 3.5 And MilliSecs2() - n\LastSeen > 60000 And temp Then
PlaySound_Strict(HorrorSFX(Rand(3,4)))
n\LastSeen = MilliSecs2()
EndIf
If dist < 1.5 And Rand(700) = 1 Then PlaySound2(Scp173SFX(Rand(0, 2)), Camera, n\obj)
If dist < 1.5 And n\LastDist > 2.0 And temp Then
CurrCameraZoom = 40.0
HeartBeatRate = Max(HeartBeatRate, 140)
HeartBeatVolume = 0.5
Select Rand(5)
Case 1
PlaySound_Strict(HorrorSFX(1))
Case 2
PlaySound_Strict(HorrorSFX(2))
Case 3
PlaySound_Strict(HorrorSFX(9))
Case 4
PlaySound_Strict(HorrorSFX(10))
Case 5
PlaySound_Strict(HorrorSFX(14))
End Select
EndIf
n\LastDist = dist
n\State = Max(0, n\State - FPSfactor / 20)
Else
;more than 6 room lengths away from the player -> teleport to a room closer to the player
If dist > 50 Then
If Rand(70)=1 Then
If PlayerRoom\RoomTemplate\Name <> "exit1" And PlayerRoom\RoomTemplate\Name <> "gatea" And PlayerRoom\RoomTemplate\Name <> "pocketdimension" Then
For w.waypoints = Each WayPoints
If w\door=Null And Rand(5)=1 Then
x = Abs(EntityX(Collider)-EntityX(w\obj,True))
If x < 25.0 And x > 15.0 Then
z = Abs(EntityZ(Collider)-EntityZ(w\obj,True))
If z < 25 And z > 15.0 Then
DebugLog "MOVING 173 TO "+w\room\roomtemplate\name
PositionEntity n\Collider, EntityX(w\obj,True), EntityY(w\obj,True)+0.25,EntityZ(w\obj,True)
ResetEntity n\Collider
Exit
EndIf
EndIf
EndIf
Next
EndIf
EndIf
ElseIf dist > HideDistance*0.8 ;3-6 rooms away from the player -> move randomly from waypoint to another
If Rand(70)=1 Then TeleportCloser(n)
Else ;less than 3 rooms away -> actively move towards the player
n\State = CurveValue(SoundVol, n\State, 3)
;try to open doors
If Rand(20) = 1 Then
For d.Doors = Each Doors
If (Not d\locked) And d\open = False And d\Code = "" And d\KeyCard=0 Then
For i% = 0 To 1
If d\buttons[i] <> 0 Then
If Abs(EntityX(n\Collider) - EntityX(d\buttons[i])) < 0.5 Then
If Abs(EntityZ(n\Collider) - EntityZ(d\buttons[i])) < 0.5 Then
If (d\openstate >= 180 Or d\openstate <= 0) Then
pvt = CreatePivot()
PositionEntity pvt, EntityX(n\Collider), EntityY(n\Collider) + 0.5, EntityZ(n\Collider)
PointEntity pvt, d\buttons[i]
MoveEntity pvt, 0, 0, n\Speed * 0.6
If EntityPick(pvt, 0.5) = d\buttons[i] Then
PlaySound_Strict (LoadTempSound("SFX\Door\DoorOpen173.ogg"))
UseDoor(d,False)
EndIf
FreeEntity pvt
EndIf
EndIf
EndIf
EndIf
Next
EndIf
Next
EndIf
If NoTarget
temp = False
n\EnemyX = 0
n\EnemyY = 0
n\EnemyZ = 0
EndIf
;player is not looking and is visible from 173's position -> attack
If temp Then
If dist < 0.65 Then
If KillTimer >= 0 And (Not GodMode) Then
Select PlayerRoom\RoomTemplate\Name
Case "lockroom", "room2closets", "coffin"
DeathMSG = "Subject D-9341. Cause of death: Fatal cervical fracture. The surveillance tapes confirm that the subject was killed by SCP-173."
Case "173"
DeathMSG = "Subject D-9341. Cause of death: Fatal cervical fracture. According to Security Chief Franklin who was present at SCP-173's containment "
DeathMSG = DeathMSG + "chamber during the breach, the subject was killed by SCP-173 as soon as the disruptions in the electrical network started."
Case "room2doors"
DeathMSG = Chr(34)+"If I'm not mistaken, one of the main purposes of these rooms was to stop SCP-173 from moving further in the event of a containment breach. "
DeathMSG = DeathMSG + "So, who's brilliant idea was it to put A GODDAMN MAN-SIZED VENTILATION DUCT in there?"+Chr(34)
Default
DeathMSG = "Subject D-9341. Cause of death: Fatal cervical fracture. Assumed to be attacked by SCP-173."
End Select
If (Not GodMode) Then n\Idle = True
PlaySound_Strict(NeckSnapSFX(Rand(0,2)))
If Rand(2) = 1 Then
TurnEntity(Camera, 0, Rand(80,100), 0)
Else
TurnEntity(Camera, 0, Rand(-100,-80), 0)
EndIf
Kill()
EndIf
Else
PointEntity(n\Collider, Collider)
RotateEntity n\Collider, 0, EntityYaw(n\Collider), EntityRoll(n\Collider)
;MoveEntity(n\Collider, 0, 0, n\Speed * FPSfactor)
TranslateEntity n\Collider,Cos(EntityYaw(n\Collider)+90.0)*n\Speed*FPSfactor,0.0,Sin(EntityYaw(n\Collider)+90.0)*n\Speed*FPSfactor
EndIf
Else ;player is not visible -> move to the location where he was last seen
If n\EnemyX <> 0 Then
If Distance(EntityX(n\Collider), EntityZ(n\Collider), n\EnemyX, n\EnemyZ) > 0.5 Then
AlignToVector(n\Collider, n\EnemyX-EntityX(n\Collider), 0, n\EnemyZ-EntityZ(n\Collider), 3)
MoveEntity(n\Collider, 0, 0, n\Speed * FPSfactor)
If Rand(500) = 1 Then n\EnemyX = 0 : n\EnemyY = 0 : n\EnemyZ = 0
Else
n\EnemyX = 0 : n\EnemyY = 0 : n\EnemyZ = 0
End If
Else
If Rand(400)=1 Then RotateEntity (n\Collider, 0, Rnd(360), 10)
TranslateEntity n\Collider,Cos(EntityYaw(n\Collider)+90.0)*n\Speed*FPSfactor,0.0,Sin(EntityYaw(n\Collider)+90.0)*n\Speed*FPSfactor
End If
EndIf
EndIf ; less than 2 rooms away from the player
EndIf
EndIf ;idle = false
PositionEntity(n\Collider, EntityX(n\Collider), Min(EntityY(n\Collider),0.35), EntityZ(n\Collider))
Else ;idle = 2
If n\Target <> Null Then
Local tmp = False
If dist > HideDistance*0.7
If EntityVisible(n\obj,Collider)=False
tmp = True
EndIf
EndIf
If (Not tmp)
PointEntity n\obj, n\Target\Collider
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),10.0), 0, True
dist = EntityDistance(n\Collider, n\Target\Collider)
;MoveEntity n\Collider, 0, 0, 0.008*FPSfactor*Max(Min((dist*2-1.0)*0.5,1.0),-0.5)
MoveEntity n\Collider, 0, 0, 0.016*FPSfactor*Max(Min((dist*2-1.0)*0.5,1.0),-0.5)
n\GravityMult = 1.0
Else
PositionEntity n\Collider,EntityX(n\Target\Collider),EntityY(n\Target\Collider)+0.3,EntityZ(n\Target\Collider)
ResetEntity n\Collider
n\DropSpeed = 0
n\GravityMult = 0.0
;PointEntity n\Collider, n\Target\Collider
;RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),10.0), 0, True
;dist = EntityDistance(n\Collider, n\Target\Collider)
;MoveEntity n\Collider, 0, 0, dist-0.6
EndIf
;For r.Rooms = Each Rooms
; If r\RoomTemplate\Name = "start" Then
; If Distance(EntityX(n\Collider),EntityZ(n\Collider),EntityX(r\obj,True)+1024*RoomScale,EntityZ(r\obj,True)+384*RoomScale)<1.6 Then
; n\Idle = 3
; n\Target = Null
; EndIf
; Exit
; EndIf
;Next
EndIf
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider) + 0.05 + Sin(MilliSecs2()*0.08)*0.02, EntityZ(n\Collider))
RotateEntity (n\obj, 0, EntityYaw(n\Collider)-180, 0)
ShowEntity n\obj2
PositionEntity(n\obj2, EntityX(n\Collider), EntityY(n\Collider) - 0.05 + Sin(MilliSecs2()*0.08)*0.02, EntityZ(n\Collider))
RotateEntity (n\obj2, 0, EntityYaw(n\Collider)-180, 0)
EndIf
EndIf
;[End block]
Case NPCtypeOldMan ;------------------------------------------------------------------------------------------------------------------
;[Block]
If Contained106 Then
n\Idle = True
HideEntity n\obj
HideEntity n\obj2
PositionEntity n\obj, 0,500.0,0, True
Else
dist = EntityDistance(n\Collider, Collider)
Local spawn106% = True
;checking if 106 is allowed to spawn
If PlayerRoom\RoomTemplate\Name$ = "dimension1499" Then spawn106% = False
For e.Events = Each Events
If e\EventName = "room860"
If e\EventState = 1
spawn106% = False
EndIf
Exit
EndIf
Next
If PlayerRoom\RoomTemplate\Name$ = "room049" And EntityY(Collider) <= -2848*RoomScale Then
spawn106% = False
EndIf
;GateA event has been triggered - don't make 106 disapper!
;The reason why this is a seperate For loop is because we need to make sure that room860 would not be able to overwrite the "spawn106%" variable
For e.events = Each Events
If e\EventName = "gatea"
If e\EventState <> 0
spawn106% = True
If PlayerRoom\RoomTemplate\Name$ = "dimension1499" Then
n\Idle = True
Else
n\Idle = False
EndIf
EndIf
Exit
EndIf
Next
If (Not spawn106%) And n\State <= 0 Then
n\State = Rand(22000, 27000)
PositionEntity n\Collider,0,500,0
EndIf
If (Not n\Idle) And spawn106%
If n\State <= 0 Then ;attacking
If EntityY(n\Collider) < EntityY(Collider) - 20.0 - 0.55 Then
If Not PlayerRoom\RoomTemplate\DisableDecals Then
de.Decals = CreateDecal(0, EntityX(Collider), 0.01, EntityZ(Collider), 90, Rand(360), 0)
de\Size = 0.05 : de\SizeChange = 0.001 : EntityAlpha(de\obj, 0.8) : UpdateDecals
EndIf
n\PrevY = EntityY(Collider)
SetAnimTime n\obj, 110
If PlayerRoom\RoomTemplate\Name <> "coffin"
PositionEntity(n\Collider, EntityX(Collider), EntityY(Collider) - 15, EntityZ(Collider))
EndIf
PlaySound_Strict(DecaySFX(0))
End If
If Rand(500) = 1 Then PlaySound2(OldManSFX(Rand(0, 2)), Camera, n\Collider)
n\SoundChn = LoopSound2(OldManSFX(4), n\SoundChn, Camera, n\Collider, 8.0, 0.8)