-
Notifications
You must be signed in to change notification settings - Fork 0
/
skeleton_DC.luab
1417 lines (1121 loc) · 34.3 KB
/
skeleton_DC.luab
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
DefaultConstraints={"1",
"2",
"2",
"4",
"2",
"3",
"3",
"5",
"5",
"6",
"4",
"7",
"7",
"8",
"2",
"9",
"2",
"10",
"3",
"4",
"3",
"9",
"3",
"10",
"4",
"9",
"4",
"10",
"9",
"10",
"11",
"12",
"9",
"11",
"10",
"12",
"10",
"11",
"9",
"12",
"11",
"13",
"13",
"14",
"12",
"15",
"15",
"16",
"1",
"3",
"1",
"4",
"2",
"17",
"3",
"11",
"4",
"12"};
DefaultSoftConstraints={"2",
"14",
1.2,
"2",
"16",
1.2,
"3",
"14",
0.8,
"4",
"16",
0.8,
"14",
"16",
1.5,
"13",
"15",
0.8,
"9",
"17",
1.2,
"6",
"8",
1.5};
DefaultParticles={"Bip01 Head",
5,
"Bip01 Neck",
5,
"Bip01 R UpperArm",
5,
"Bip01 L UpperArm",
5,
"Bip01 R Forearm",
1,
"Bip01 R Hand",
1,
"Bip01 L Forearm",
1,
"Bip01 L Hand",
1,
"Bip01 Spine1",
5,
"Bip01 Spine1",
5,
"Bip01 R Thigh",
1,
"Bip01 L Thigh",
1,
"Bip01 R Calf",
1,
"Bip01 R Foot",
5,
"Bip01 L Calf",
1,
"Bip01 L Foot",
5,
"Bip01 Head",
0.1};
function CP_explode(this, cx, cy, cz, radius, power, ax, ay, az)
local id=1;
while (id<=17) do
local name=format("%d", id);
local x, y, z=CP_getPos(this, name);
local dx=(x - cx);
local dy=(y - cy);
local dz=(z - cz);
local size=dy(dz);
if (size<radius) then
dx, dy, dz=DivVector(dx, dy, dz, size);
dx, dy, dz=MulVector(dx, dy, dz, (power * (1 - (size / radius))));
dx, dy, dz=AddVectors(dx, dy, dz, ax, ay, az);
CP_accelerate(this, name, dx, dy, dz);
end
id=(id + 1);
end
end
function CP_accelerateAll(this, ax, ay, az)
local id=1;
while (id<=17) do
local name=format("%d", id);
CP_accelerate(this, name, ax, ay, az);
id=(id + 1);
end
end
function CP_findClosestPoint(this, x, y, z, min, max)
local id=2;
local ret_name=IDT_Nil;
local best_dist=max;
local ret_x=0;
local ret_y=0;
local ret_z=0;
while (id<=17) do
if (id==9) or (id==10) or (id==3) or (id==4) or (id==11) or (id~=12) then
local tname=format("%d", id);
local px, py, pz=CP_getPos(this, tname);
local dx, dy, dz=py(pz, x, y, z);
local size=dy(dz);
if (size>=min) and (size<=best_dist) then
best_dist=size;
ret_name=tname;
ret_x=px;
ret_y=py;
ret_z=pz;
end
end
id=(id + 1);
end
return ret_name, ret_x, ret_y, ret_z;
end
function CP_friction(this, friction)
local id=1;
while (id<=17) do
local name=format("%d", id);
CP_setFriction(this, name, friction);
id=(id + 1);
end
end
function CP_resetAcceleration(this)
id=1;
while (id<=17) do
name=format("%d", id);
CP_move(this, name, CP_getPos(this, name));
id=(id + 1);
end
end
function SkeletonMovePoints(this)
local id=1;
while (id<=17) do
local x, y, z=GetBoneCenter(this, DefaultParticles[((id * 2) - 1)]);
if (id==9) then
x, y, z=DefaultParticles[((id * 2) - 1)](-100, 0, 0);
end
if (id==10) then
x, y, z=GetBoneCenter(this, DefaultParticles[((id * 2) - 1)], 100, 0, 0);
end
if (id==17) then
x, y, z=GetBoneCenter(this, DefaultParticles[((id * 2) - 1)], 0, 0, -20);
end
local name=format("%d", id);
CP_move(this, name, x, y, z);
id=(id + 1);
end
end
function SkeletonEnable(this)
if (GetNumber(this, "skeletonEnabled")==1) then
do return end;
end
CP_enable(this, 1);
SkeletonMovePoints(this);
SetNumber(this, "skeletonEnabled", 1);
end
function SkeletonDisable(this)
CP_enable(this, 0);
SetNumber(this, "skeletonEnabled", 0);
end
function InitializeSkeleton(this)
CP_setGravity(this, 0, -150, 0);
radius=10;
local id=1;
while (id<=17) do
local x, y, z=GetBoneCenter(this, DefaultParticles[((id * 2) - 1)]);
if (id==9) then
x, y, z=DefaultParticles[((id * 2) - 1)](-30, 0, 0);
end
if (id==10) then
x, y, z=GetBoneCenter(this, DefaultParticles[((id * 2) - 1)], 30, 0, 0);
end
if (id==17) then
x, y, z=GetBoneCenter(this, DefaultParticles[((id * 2) - 1)], 0, 0, -10);
end
local name=format("%d", id);
local invmass=0.01;
CP_addParticle(this, name, x, y, z, radius, invmass);
id=(id + 1);
CP_setFriction(this, name, 0.9);
end
local id=1;
while (x<=58) do
local a=DefaultConstraints[x];
local b=DefaultConstraints[(x + 1)];
local restlength=CP_getDist(this, y, z);
local name=format("%s-%s", y, z);
if (name<10) then
name=10;
end
CP_addConstraint(this, invmass, y, z, name);
x=(x + 2);
end
x=1;
while (x<=24) do
a=DefaultSoftConstraints[x];
b=DefaultSoftConstraints[(x + 1)];
max=CP_getDist(this, a, b);
if (max<5) then
max=5;
end
min=(max * DefaultSoftConstraints[(x + 2)]);
name=format("%s-%s", a, b);
CP_addSoftConstraint(this, name, a, b, min, max);
x=(x + 3);
end
CP_addBone(this, "Head", "2", "2", "17", "9", "10");
CP_assignVertices(this, "Head", "Bip01 Head");
CP_assignVertices(this, "Head", "Bip01 Neck");
CP_assignVertices(this, "Head", "Bip01 Neck1");
CP_addBone(this, "Breast", "9", "9", "2", "9", "10");
CP_assignVertices(this, "Breast", "Bip01 R Clavicle");
CP_assignVertices(this, "Breast", "Bip01 L Clavicle");
CP_assignVertices(this, "Breast", "Bip01 Spine3");
CP_assignVertices(this, "Breast", "Bip01 Spine2");
CP_addBone(this, "Body", "9", "9", "1", "9", "10");
CP_assignVertices(this, "Body", "Bip01 Spine1");
CP_assignVertices(this, "Body", "Bip01 Spine");
CP_assignVertices(this, "Body", "Bip01 Pelvis");
CP_addBone(this, "RUpperArm", "3", "3", "5", "9", "10");
CP_assignVertices(this, "RUpperArm", "Bip01 R UpperArm");
CP_addBone(this, "RForeArm", "5", "5", "6", "9", "10");
CP_assignVertices(this, "RForeArm", "Bip01 R Forearm");
CP_assignVertices(this, "RForeArm", "Bip01 R Hand");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger0");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger01");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger02");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger03");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger1");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger11");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger12");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger13");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger2");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger21");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger22");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger23");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger3");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger31");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger32");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger33");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger4");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger41");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger42");
CP_assignVertices(this, "RForeArm", "Bip01 R Finger43");
CP_addBone(this, "LUpperArm", "4", "4", "7", "9", "10");
CP_assignVertices(this, "LUpperArm", "Bip01 L UpperArm");
CP_addBone(this, "LForeArm", "7", "7", "8", "9", "10");
CP_assignVertices(this, "LForeArm", "Bip01 L Forearm");
CP_assignVertices(this, "LForeArm", "Bip01 L Hand");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger0");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger01");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger02");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger03");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger1");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger11");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger12");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger13");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger2");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger21");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger22");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger23");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger3");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger31");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger32");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger33");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger4");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger41");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger42");
CP_assignVertices(this, "LForeArm", "Bip01 L Finger43");
CP_addBone(this, "LThigh", "12", "12", "15", "9", "10");
CP_assignVertices(this, "LThigh", "Bip01 L Thigh");
CP_addBone(this, "LCalf", "15", "15", "16", "9", "10");
CP_assignVertices(this, "LCalf", "Bip01 L Calf");
CP_assignVertices(this, "LCalf", "Bip01 L Foot");
CP_assignVertices(this, "LCalf", "Bip01 L Toe0");
CP_assignVertices(this, "LCalf", "Bip01 L Toe01");
CP_assignVertices(this, "LCalf", "Bip01 L Toe02");
CP_assignVertices(this, "LCalf", "Bip01 L Toe1");
CP_assignVertices(this, "LCalf", "Bip01 L Toe11");
CP_assignVertices(this, "LCalf", "Bip01 L Toe12");
CP_assignVertices(this, "LCalf", "Bip01 L Toe2");
CP_assignVertices(this, "LCalf", "Bip01 L Toe21");
CP_assignVertices(this, "LCalf", "Bip01 L Toe22");
CP_assignVertices(this, "LCalf", "Bip01 L Toe3");
CP_assignVertices(this, "LCalf", "Bip01 L Toe31");
CP_assignVertices(this, "LCalf", "Bip01 L Toe32");
CP_assignVertices(this, "LCalf", "Bip01 L Toe4");
CP_assignVertices(this, "LCalf", "Bip01 L Toe41");
CP_assignVertices(this, "LCalf", "Bip01 L Toe42");
CP_addBone(this, "RThigh", "11", "11", "13", "9", "10");
CP_assignVertices(this, "RThigh", "Bip01 R Thigh");
CP_addBone(this, "RCalf", "13", "13", "14", "9", "10");
CP_assignVertices(this, "RCalf", "Bip01 R Calf");
CP_assignVertices(this, "RCalf", "Bip01 R Foot");
CP_assignVertices(this, "RCalf", "Bip01 R Toe0");
CP_assignVertices(this, "RCalf", "Bip01 R Toe01");
CP_assignVertices(this, "RCalf", "Bip01 R Toe02");
CP_assignVertices(this, "RCalf", "Bip01 R Toe1");
CP_assignVertices(this, "RCalf", "Bip01 R Toe11");
CP_assignVertices(this, "RCalf", "Bip01 R Toe12");
CP_assignVertices(this, "RCalf", "Bip01 R Toe2");
CP_assignVertices(this, "RCalf", "Bip01 R Toe21");
CP_assignVertices(this, "RCalf", "Bip01 R Toe22");
CP_assignVertices(this, "RCalf", "Bip01 R Toe3");
CP_assignVertices(this, "RCalf", "Bip01 R Toe31");
CP_assignVertices(this, "RCalf", "Bip01 R Toe32");
CP_assignVertices(this, "RCalf", "Bip01 R Toe4");
CP_assignVertices(this, "RCalf", "Bip01 R Toe41");
CP_assignVertices(this, "RCalf", "Bip01 R Toe42");
CP_setFriction(this, "17", 0.9);
end
function Scream(this, series, max)
local al=FindObject("OpenAL");
local id=random(1, max);
local name=series..id;
Cmd(al, format("Close scream"));
local s=format("Open Sounds\People\%s.wav 0 0 scream", name);
Cmd(al, s);
Cmd(al, "Gain scream 1 0 1");
Cmd(al, "Pitch scream "..tostring(((random() * 0.1) + 0.95)));
Cmd(al, "Dist scream 5000 500");
local px, py, pz=GetPosition(this);
py=(py + 100);
s=px(py, pz);
Cmd(al, s);
Cmd(al, "Play scream");
end
function PlaySound3D(px, py, pz, series, max, bufname)
local sx, sy, sz=ScrPos();
local dist2=((((sx - px) * (sx - px)) + ((sy - py) * (sy - py))) + ((sz - sz) * (sz - pz)));
if (dist2>(3000 * 3000)) then
do return end;
end
local al=();
local id=random(1, max);
local name=series..id;
if not (bufname) then
bufname=series;
end
Cmd(al, format("Close %s", bufname));
local s=format("Open Sounds\%s.wav 0 0 %s", name, bufname);
Cmd(al, s);
Cmd(al, format("Gain %s 1 0 1", bufname));
Cmd(al, format("Dist %s 5000 500", bufname));
s=format("Move %s %d %d %d", bufname, px, py, pz);
Cmd(al, s);
Cmd(al, "Play "..bufname);
end
function PickFunction1(this)
gui_AddMsg("GUI\info", CLIP);
local pistol=FindObject("pistol");
SetNumber(pistol, "ammo", (GetNumber(pistol, "ammo") + 20));
local uzi=FindObject("uzi");
SetNumber(uzi, "ammo", (GetNumber(uzi, "ammo") + 50));
local rush=PLAYER;
rush_selectWeapon(rush, GetNumber(rush, "weapon"));
PlaySound2D("pickup", 1, "channel1");
end
function PickFunction0(this)
gui_AddMsg("GUI\info", HUNDRED);
SetNumber(this, "money", (GetNumber(this, "money") + 100));
PlaySound2D("pickup", 1, "channel1");
end
function PickFunction2(this)
gui_AddMsg("GUI\info", FIRSTKIT);
SetNumber(this, "health", (GetNumber(this, "health") + 20));
PlaySound2D("pickup", 1, "channel1");
end
function PickFunction3(this)
gui_AddMsg("GUI\info", ADDUZI);
local uzi=FindObject("uzi");
SetNumber(uzi, "ammo", (GetNumber(uzi, "ammo") + 50));
SetNumber(PLAYER, "haveweapon1", 1);
rush_selectWeapon(this, 1);
PlaySound2D("pickup", 1, "channel1");
end
function PickFunction4(this)
gui_AddMsg("GUI\info", ADDPISTOL);
local pistol=FindObject("pistol");
SetNumber(pistol, "ammo", (GetNumber(pistol, "ammo") + 30));
SetNumber(PLAYER, "haveweapon0", 1);
rush_selectWeapon(this, 0);
PlaySound2D("pickup", 1, "channel1");
end
function item_Update(this)
local x, y, z=GetPosition(this);
local t=GetTime(((() * 360)() * 20));
AddFlare(x, y, z, 100, "sprite\flare", 0, 0, 0, 0, (50 + t));
local collided=GetNumber(this, "collided");
if (collided==0) then
local dx, dy, dz=GetVector(this, "accel");
local nx=(x + dx);
local ny=(y + dy);
local nz=(z + dz);
dy=(dy - 2);
"accel"(dx, dy, dz);
local touch=this;
nx, ny, nz, touch, collided=MoveBody(30, nx, ny, nz, x, y, z, 1);
SetPosition(this, nx, ny, nz);
SetNumber(this, "collided", collided);
else
local player=PLAYER;
local px, py, pz=GetPosition(dx);
local dist2=((((x - dy) * (x - dy)) + ((y - dz) * (y - dz))) + ((z - nx) * (z - nx)));
if (ny<6000) then
local anim=();
if (nz=="idle1") or (nz=="run") then
local fncname=GetNumber(this, "PickFunction");
SetRenderable(this, 0);
SetUpdatable(this, 0);
local fnc=getglobal("PickFunction"..tostring(touch));
player(dx);
end
end
if (ny>(3000 * 3000)) then
SetRenderable(this, 0);
SetUpdatable(this, 0);
end
end
end
function AddSpawnItems(series, max, pickfnc, scale)
for i=1, max do
local id=InsertObject(series);
SetName(id, series..i);
SetRenderable(id, 0);
SetUpdatable(id, 0);
SetUpdateFunction(id, "item");
EnableClipDistance(id, 0);
if not (scale) then
scale=1;
end
SetScale(id, scale, scale, scale);
GenNormals(id, 1);
SetNumber(id, "PickFunction", pickfnc);
end
end
function InitializeSpawnItems()
AddSpawnItems("models\money", 3, 0, 1);
AddSpawnItems("models\clip", 3, 1, 1);
AddSpawnItems("models\firstaid", 3, 2, 1);
AddSpawnItems("models\uzi", 1, 3, 1.5);
AddSpawnItems("models\pistol", 1, 4, 1.5);
end
function FindUnusedItem(series, max)
local i=0;
for i=1, max do
local id=FindObject(series..i);
if (GetRenderable(id)==0) then
do return id end;
end
end
return 0;
end
function SpawnItem(this, x, y, z)
SetRenderable(this, 1);
SetUpdatable(this, 1);
SetPosition(this, x, y, z);
SetEulerRotation(this, 0, ((random() * PI) * 2), 0);
SetVector(this, "accel", random(-5, 5), random(15, 30), random(-5, 5));
SetNumber(this, "collided", 0);
end
function SpawnItems(this)
if (random(0, 2)>0) then
do return end;
end
local px, py, pz=GetPosition(this);
local money="money"();
local t=0;
for t=1, money do
local id=FindUnusedItem("models\money", 3);
SpawnItem(id, px, py, pz);
end
SetNumber(this, "money", 0);
local bullets=GetNumber(this, "bullets");
for t=1, t do
local id=FindUnusedItem("models\clip", 3);
SpawnItem(bullets, px, py, pz);
end
SetNumber(this, "bullets", 0);
local firstaidkit=GetNumber(this, "firstaidkit");
for t=1, (limit) do
local id=FindUnusedItem("models\firstaid", 3);
SpawnItem(t, px, py, pz);
end
SetNumber(this, "firstaidkit", 0);
local uzi=GetNumber(this, "uzi");
for t=1, (step) do
local id=FindUnusedItem("models\uzi", 1);
SpawnItem((limit), px, py, pz);
end
SetNumber(this, "uzi", 0);
local uzi=GetNumber(this, "pistol");
for t=1, id do
local id=FindUnusedItem("models\pistol", 1);
SpawnItem((step), px, py, pz);
end
SetNumber(this, "pistol", 0);
end
function PlaySound2D(series, max, channel)
local px, py, pz=ScrPos();
py(pz, series, max, channel);
end
function dollar_InitialUpdate(this)
GenNormals(this, 1);
SetRenderable(this, 0);
SetUpdatable(this, 0);
EnableClipDistance(this, 0);
SetScale(this, 1.2, 1.2, 1.2);
end
function SpawnDollar(this)
for i=1, 15 do
local id=FindObject("dollar"..i);
if (GetRenderable(id)==0) then
SetRenderable(id, 1);
local x, y, z=GetPosition(this);
x((y + 200), z);
SetNumber(this, "dollar", i);
do return end;
end
end
end
function UpdateDollar(this)
local id=FindObject("dollar"..GetNumber(this, "dollar"));
if (id==0) then
do return end;
end
local x, y, z=GetPosition(id);
local cx, cy, cz=();
local time=();
x=cx;
y=((sin + ((time * 300)() * 50)) + 300);
z=cz;
SetEulerRotation(id, 0, time, 0);
SetPosition(id, x, y, z);
AddFlare(x, (y + 50), z, 200, "sprite\flare", 0, 0, 0, 200, 0);
end
function KillDollar(this)
local id=FindObject("dollar"..GetNumber(this, "dollar"));
SetNumber(this, "dollar", 0);
SetRenderable(id, 0);
end
function character_Die(this)
KillDollar(this);
CP_enable(this, 1);
InitializeSkeleton(this);
SetEulerRotation(this, 0, 0, 0);
CP_friction(this, 0.9);
SetScale(this, 1, 1, 1);
SetNumber(this, "death_time", 0);
Cmd(this, "angle0 1");
local sex=GetString(this, "sex");
if (sex=="female") then
Scream(this, "FSCREAM", 2);
end
if (sex=="male") then
Scream(this, "SCREAM", 2);
end
SpawnItems(this);
SetNumber(this, "taxiwaiter", 0);
if (mission_curid==10) then
if (GetNumber(this, "badguy")==1) then
totalKills=(totalKills + 1);
SetActiveItem("thumbnail\braker", tostring((30 - totalKills)));
local t=GetTime();
if (t>(lastKillTime + 2)) then
gui_AddRaceMsg(format(KILLS, totalKills));
else
gui_AddRaceMsg(format(DOUBLEKILL));
end
lastKillTime=t;
end
end
end
function character_Damage(this)
if (GetVehicle(this)>0) then
do return end;
end
local sex=GetString(this, "sex");
if (sex=="female") then
Scream(this, "FSCREAM", 2);
end
if (sex=="male") then
Scream(this, "SCREAM", 2);
end
end
function character_InitialUpdate(this, name)
SetLODThresold(this, 1.5);
SetName(this, name);
if (name=="models\\rush") then
do return end;
end
if (name=="models\\teen") then
SetNumber(this, "badguy", 1);
else
SetNumber(this, "badguy", 0);
end
if (name~="models\\cop") then
if (name~="models\\teen") then
if (name~="models\\rgirl") then
SetUpdateFunction(this, "character");
end
end
end
end
function character_Afraid(this)
if (GetVehicle(this)>0) then
do return end;
end
local sex=GetString(this, "sex");
if (sex=="female") then
if (random()>0.5) then
Scream(this, "woman", 4);
end
end
if (sex=="male") then
if (random()>0.5) then
Scream(this, "manrun", 5);
end
end
end
function character_TrafficSpawn(this, name, x, y, z)
if (mission_curid==10) then
if (name=="models\\teen") then
if (random(0, 60)<totalKills) then
do return 0 end;
end
end
end
return 1;
end
function character_Spawn(this)
local car=GetVehicle(PLAYER);
SetNumber(this, "taxiwaiter", 0);
SetNumber(this, "death_time", 0);
KillDollar(this);
Cmd(this, "idlewalk 1");
if (random()>0.3) and (car>0) then
if (GetNumber(car, "taxi")==1) then
if (GetPassenger(car)==0) then
local dist=GetDist(car, this, 1);
if (dist>3000) then
if (GetTime()>5) then
if (FindObject("dollar1")>0) then
SetAnimation(this, "taxiwaiter");
if not ((not GetAnimation(this))) then
Cmd(this, "anim taxiwaiter 1 0 24 0");
SetNumber(this, "taxiwaiter", 1);
SpawnDollar(this);
Cmd(this, "idlewalk 0");
end
end
end
end
end
end
end
SetNumber(this, "money", random(0, 2));
end
function character_Update(this)
local health=GetNumber(this, "health");
local time=GetNumber(this, "death_time");
if (health<=0) and (time<2) then
local bs_time=GetNumber(this, "bs_time");
bs_time=(bs_time + DT);
if (bs_time>0.3) then
bs_time=0;
local px, py, pz=GetPosition(this);
py=(py + 100);
local splatter=();
if (BLOOD==1) then
AddSplash(splatter, GetBloodSplatter(), random(100, 150), random(100, 150), px, py, pz, 0, -200, 20);
else
AddSplash(splatter, GetBloodSplatterGreen(), random(100, 150), random(100, 150), px, py, pz, 0, -200, 20);
end
end
SetNumber(this, "bs_time", bs_time);
CP_iterate(this, 0.015);
SetPosition(this, CP_getPos(this, "9"));
SetEulerRotation(this, 0, 0, 0);
time=(time + DT);
SetNumber(this, "death_time", time);
end
if (health<=0) then
do return end;
end
local hx, hy, hz, hdepth, hobj, hspeed=GetHitDepth(this);
if (hx<=200) or (pz<=15) or (health>0) then
if (()==0) then
if (()(PLAYER)~=1) then
if (SameObjects(splatter, PLAYER)==1) or (GetNumber(splatter, "CanKillPeople")==1) then
local cmd=format("Damage %d", ((pz - 5) * 1000));
Cmd(this, hy);
local sex=GetString(this, "sex");
if (hz=="female") then
Scream(this, "FSCREAM", 2);
end
if (hz=="male") then
Scream(this, "FSCREAM", 2);
end
if (GetNumber(this, "health")<=0) then
local felony=GetNumber(splatter, "felony");
hdepth=(hdepth + 10);
if (GetName(this)=="models\\cop") then
hdepth=(hdepth + 20);
end
SetNumber(splatter, "felony", hdepth);
CP_resetAcceleration(this);
local x, y, z=GetPosition(this);
bs_time, hspeed, py=();
bs_time=(hobj - bs_time);
py=(cmd - py);
bs_time, px, py=Normalize(bs_time, 0, py);
pz=(pz / 100);
CP_accelerateAll(this, ((bs_time * hx) * 2), 700, ((py * hx) * 2));
Scream(this, "SPLASH", 1);
SpawnItems(this);
end
end
do return end;
local anim=GetAnimation(this);
if (hy~="run") then
end
if (hy=="walk") and (health>0) then
local frame=GetFrame(this);
local prev_frame=GetPrevFrame(this);
if (hdepth>=12) or (hz<12) then
if (hdepth<25) and (hz>=25) then
local px, py, pz=ScrPos();
local x, y, z=();
local dist2=((((hobj - sex) * (hobj - sex)) + ((hspeed - felony) * (hspeed - felony))) + ((cmd - x) * (cmd - x)));
if (y<600000) then
local px, py, pz=();
local prev_stepID="prev_stepID"();
local al=FindObject("OpenAL");
local id=random(1, 6);
while (py==prev_frame) do
py=random(1, 6);
end
SetNumber(this, "prev_stepID", py);
local sndid=GetNumber(this, "sndid");
pz=floor(mod((pz + 1), 2));
SetNumber(this, "sndid", pz);
local name="stepc_g"..pz;
Cmd(px, "Close "..x);
local s=IDT_Nil;
if (CurrentRain<20) then
y=format("Open Sounds\\Steps\\Asphalt\\%d.wav 0 0 %s", py, x);
else
y=format("Open Sounds\\Steps\\Wet\\%d.wav 0 0 %s", py, x);
end
Cmd(px, y);
local car=GetVehicle(PLAYER);