-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsurvival_horde_ee_script.lua
1938 lines (1442 loc) · 83.5 KB
/
survival_horde_ee_script.lua
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
local ScenarioUtils = import('/lua/sim/ScenarioUtilities.lua')
local ScenarioFramework = import('/lua/ScenarioFramework.lua')
local Objectives = import('/lua/ScenarioFramework.lua').Objectives
local SimObjects = import('/lua/SimObjectives.lua')
local OccupiedArmies = {}
local function localImport(fileName)
return import('/maps/survival_horde_ee.v0021/src/' .. fileName)
end
local function entropyLibImport(fileName)
return import('/maps/survival_horde_ee.v0021/vendor/EntropyLib/src/' .. fileName)
end
local options = localImport('Options.lua').newInstance(ScenarioInfo.Options)
--NAME: Survival Horde
--There was supposed to be 5th player on the middle (this script supports 5th player, only 5th spawn is missing) but I didn't bother to create waves for the fifth player.
--There was also supposed to be transport drops (which are working perfectly) but it would've been too difficult for players to deal with because land waves are so strong. Maybe for fifth player if I ever create the fifth player.
--Thanks for the other survival map creators for giving me some ideas! (survival escape, fifth dimension, mycelium)
--LISTING WAYPOINTS FOR UNIT NAVIGATION
local LandCenter = { "PlayerSpawn_1", "PlayerSpawn_2", "PlayerSpawn_3", "PlayerSpawn_4", "PatrolBase_5", "PatrolBase_6", "PatrolBase_7", "PatrolBase_8", "TransportDrop05" }
local AllEnemySpawns = { "Survival_LandSpawn1", "Survival_LandSpawn2", "Survival_LandSpawn3", "Survival_LandSpawn4", "Survival_Spawn1", "Survival_Spawn4" }
local TransportRoute1 = { "TransportPath01", "TransportPath06" } --TransportDrop04
local TransportRoute2 = { "TransportPath01", "TransportPath06", "TransportPath10", "TransportPath11", "TransportPath18" } --TransportDrop04
local TransportRoute3 = { "TransportPath01", "TransportPath06", "TransportPath10", "TransportPath11", "TransportPath18", "TransportPath19" } --TransportDrop05
local TransportRoute4 = { "TransportPath02" } --TransportDrop01
local TransportRoute5 = { "TransportPath03" } --TransportDrop02
local TransportRoute6 = { "TransportPath04" } --TransportDrop06
local TransportRoute7 = { "TransportPath05", "TransportPath07" } --TransportDrop03
local TransportRoute8 = { "TransportPath05", "TransportPath07", "TransportPath17", "TransportPath16" } --TransportDrop03
local TransportRoute9 = { "TransportPath05", "TransportPath07", "TransportPath17", "TransportPath16", "TransportPath23" } --TransportDrop05
--TORPEDO BOMBER ROUTES
local TorpedoRoute01 = { "TorpedoPatrol01", "TorpedoPatrol02", "TorpedoPatrol03", "TorpedoPatrol04", "TorpedoPatrol05", "TorpedoPatrol06", "TorpedoPatrol07", "TorpedoPatrol08", "TorpedoPatrol09", "TorpedoPatrol10", "TorpedoPatrol11" }
local TorpedoRoute02 = { "TorpedoPatrol08", "TorpedoPatrol07", "TorpedoPatrol06", "TorpedoPatrol05", "TorpedoPatrol04", "TorpedoPatrol03", "TorpedoPatrol02", "TorpedoPatrol01", "TorpedoPatrol11", "TorpedoPatrol10", "TorpedoPatrol09" }
local TorpedoRoute03 = { "TorpedoPatrol12", "TorpedoPatrol13", "TorpedoPatrol14", "TorpedoPatrol15", "TorpedoPatrol16", "TorpedoPatrol17", "TorpedoPatrol18", "TorpedoPatrol19", "TorpedoPatrol20", "TorpedoPatrol21", "TorpedoPatrol22", "TorpedoPatrol23", "TorpedoPatrol24" }
local TorpedoRoute04 = { "TorpedoPatrol19", "TorpedoPatrol18", "TorpedoPatrol17", "TorpedoPatrol16", "TorpedoPatrol15", "TorpedoPatrol14", "TorpedoPatrol13", "TorpedoPatrol12", "TorpedoPatrol24", "TorpedoPatrol23", "TorpedoPatrol22", "TorpedoPatrol21", "TorpedoPatrol20" }
local TorpedoRoute05 = { "TorpedoPatrol25", "TorpedoPatrol26", "TorpedoPatrol27", "TorpedoPatrol28", "TorpedoPatrol29", "TorpedoPatrol30", "TorpedoPatrol31", "TorpedoPatrol32", "TorpedoPatrol33", "TorpedoPatrol34", "TorpedoPatrol35", "TorpedoPatrol36" }
local TorpedoRoute06 = { "TorpedoPatrol32", "TorpedoPatrol31", "TorpedoPatrol30", "TorpedoPatrol29", "TorpedoPatrol28", "TorpedoPatrol27", "TorpedoPatrol26", "TorpedoPatrol25", "TorpedoPatrol36", "TorpedoPatrol35", "TorpedoPatrol34", "TorpedoPatrol33" }
local TorpedoRoute07 = { "TorpedoPatrol37", "TorpedoPatrol38", "TorpedoPatrol39", "TorpedoPatrol40", "TorpedoPatrol41", "TorpedoPatrol42", "TorpedoPatrol43", "TorpedoPatrol44", "TorpedoPatrol45", "TorpedoPatrol46", "TorpedoPatrol47" }
local TorpedoRoute08 = { "TorpedoPatrol44", "TorpedoPatrol43", "TorpedoPatrol42", "TorpedoPatrol41", "TorpedoPatrol40", "TorpedoPatrol39", "TorpedoPatrol38", "TorpedoPatrol37", "TorpedoPatrol47", "TorpedoPatrol46", "TorpedoPatrol45" }
local TorpedoRoute09 = { "TorpedoPatrol48", "TorpedoPatrol49", "TorpedoPatrol50", "TorpedoPatrol51", "TorpedoPatrol52", "TorpedoPatrol53", "TorpedoPatrol54", "TorpedoPatrol55", "TorpedoPatrol56" }
local TorpedoRoute10 = { "TorpedoPatrol54", "TorpedoPatrol53", "TorpedoPatrol52", "TorpedoPatrol51", "TorpedoPatrol50", "TorpedoPatrol49", "TorpedoPatrol48", "TorpedoPatrol56", "TorpedoPatrol55" }
local AllTorpedoRoutes = { TorpedoRoute01, TorpedoRoute02, TorpedoRoute03, TorpedoRoute04, TorpedoRoute05, TorpedoRoute06, TorpedoRoute07, TorpedoRoute08, TorpedoRoute09, TorpedoRoute10 }
--BOMBER BASE ROUTES
local BomberBaseRoute01 = { "BomberBasePath01", "BomberBasePath02", "BomberBasePath03", "BomberBasePath04", "BomberBasePath05", "BomberBasePath06", "BomberBasePath07" }
local BomberBaseRoute02 = { "BomberBasePath06", "BomberBasePath05", "BomberBasePath04", "BomberBasePath03", "BomberBasePath02", "BomberBasePath01", "BomberBasePath08" }
local BomberBaseRoute03 = { "BomberBasePath09", "BomberBasePath10", "BomberBasePath11", "BomberBasePath12", "BomberBasePath13", "BomberBasePath14", "BomberBasePath15" }
local BomberBaseRoute04 = { "BomberBasePath14", "BomberBasePath13", "BomberBasePath12", "BomberBasePath11", "BomberBasePath10", "BomberBasePath09", "BomberBasePath16" }
local BomberBaseRoute05 = { "BomberBasePath17", "BomberBasePath02", "BomberBasePath10", "BomberBasePath18", "BomberBasePath19" }
local BomberBaseRoute06 = { "BomberBasePath18", "BomberBasePath10", "BomberBasePath02", "BomberBasePath17", "BomberBasePath21" }
local BomberBaseRoute07 = { "BomberBasePath22", "BomberBasePath23", "BomberBasePath03", "BomberBasePath24", "BomberBasePath11", "BomberBasePath25", "BomberBasePath26", "BomberBasePath27" }
local BomberBaseRoute08 = { "BomberBasePath26", "BomberBasePath25", "BomberBasePath11", "BomberBasePath24", "BomberBasePath03", "BomberBasePath23", "BomberBasePath22", "BomberBasePath29" }
local BomberBaseRoute09 = { "BomberBasePath30", "BomberBasePath31", "BomberBasePath32", "BomberBasePath33", "BomberBasePath34", "BomberBasePath35", "BomberBasePath36", "BomberBasePath37", "BomberBasePath38" }
local BomberBaseRoute10 = { "BomberBasePath37", "BomberBasePath36", "BomberBasePath35", "BomberBasePath34", "BomberBasePath33", "BomberBasePath32", "BomberBasePath31", "BomberBasePath30", "BomberBasePath40" }
local BomberBaseRoute11 = { "BomberBasePath41", "BomberBasePath42", "BomberBasePath43", "BomberBasePath44", "BomberBasePath34", "BomberBasePath45", "BomberBasePath46", "BomberBasePath47", "BomberBasePath48" }
local BomberBaseRoute12 = { "BomberBasePath47", "BomberBasePath46", "BomberBasePath45", "BomberBasePath34", "BomberBasePath44", "BomberBasePath43", "BomberBasePath42", "BomberBasePath41", "BomberBasePath50" }
local BomberBaseRoute13 = { "BomberBasePath51", "BomberBasePath03", "BomberBasePath52", "BomberBasePath53", "BomberBasePath54", "BomberBasePath55", "BomberBasePath56", "BomberBasePath57" }
local BomberBaseRoute14 = { "BomberBasePath56", "BomberBasePath55", "BomberBasePath54", "BomberBasePath53", "BomberBasePath52", "BomberBasePath03", "BomberBasePath51", "BomberBasePath59" }
local BomberBaseRoute15 = { "BomberBasePath60", "BomberBasePath11", "BomberBasePath61", "BomberBasePath53", "BomberBasePath62", "BomberBasePath63", "BomberBasePath64", "BomberBasePath65" }
local BomberBaseRoute16 = { "BomberBasePath64", "BomberBasePath63", "BomberBasePath62", "BomberBasePath53", "BomberBasePath61", "BomberBasePath11", "BomberBasePath60", "BomberBasePath67" }
local BomberBaseRoute17 = { "BomberBasePath68", "BomberBasePath02", "BomberBasePath69", "BomberBasePath32", "BomberBasePath70", "BomberBasePath71", "BomberBasePath72", "BomberBasePath73" }
local BomberBaseRoute18 = { "BomberBasePath72", "BomberBasePath71", "BomberBasePath70", "BomberBasePath69", "BomberBasePath02", "BomberBasePath68", "BomberBasePath74" }
local BomberBaseRoute19 = { "BomberBasePath75", "BomberBasePath10", "BomberBasePath76", "BomberBasePath43", "BomberBasePath77", "BomberBasePath78", "BomberBasePath79", "BomberBasePath80" }
local BomberBaseRoute20 = { "BomberBasePath79", "BomberBasePath78", "BomberBasePath77", "BomberBasePath43", "BomberBasePath76", "BomberBasePath10", "BomberBasePath75", "BomberBasePath81" }
local BomberBaseRoute21 = { "BomberBasePath82", "BomberBasePath02", "BomberBasePath24", "BomberBasePath44", "BomberBasePath83", "BomberBasePath84", "BomberBasePath85", "BomberBasePath86" }
local BomberBaseRoute22 = { "BomberBasePath85", "BomberBasePath84", "BomberBasePath83", "BomberBasePath44", "BomberBasePath24", "BomberBasePath02", "BomberBasePath82", "BomberBasePath87" }
local BomberBaseRoute23 = { "BomberBasePath88", "BomberBasePath10", "BomberBasePath24", "BomberBasePath33", "BomberBasePath89", "BomberBasePath90", "BomberBasePath91", "BomberBasePath92" }
local BomberBaseRoute24 = { "BomberBasePath91", "BomberBasePath90", "BomberBasePath89", "BomberBasePath33", "BomberBasePath24", "BomberBasePath10", "BomberBasePath88", "BomberBasePath93" }
local BomberBaseRoute25 = { "BomberBasePath94", "BomberBasePath03", "BomberBasePath52", "BomberBasePath53", "BomberBasePath95", "BomberBasePath96", "BomberBasePath97", "BomberBasePath98", "BomberBasePath99" }
local BomberBaseRoute26 = { "BomberBasePath98", "BomberBasePath97", "BomberBasePath96", "BomberBasePath95", "BomberBasePath53", "BomberBasePath52", "BomberBasePath03", "BomberBasePath94", "BomberBasePath101" }
local BomberBaseRoute27 = { "BomberBasePath102", "BomberBasePath11", "BomberBasePath61", "BomberBasePath53", "BomberBasePath103", "BomberBasePath104", "BomberBasePath105", "BomberBasePath106", "BomberBasePath107" }
local BomberBaseRoute28 = { "BomberBasePath106", "BomberBasePath105", "BomberBasePath104", "BomberBasePath103", "BomberBasePath53", "BomberBasePath61", "BomberBasePath11", "BomberBasePath102", "BomberBasePath109" }
local AllBomberBaseRoutes = { BomberBaseRoute01, BomberBaseRoute02, BomberBaseRoute03, BomberBaseRoute04, BomberBaseRoute05, BomberBaseRoute06, BomberBaseRoute07, BomberBaseRoute08, BomberBaseRoute09, BomberBaseRoute10, BomberBaseRoute11, BomberBaseRoute12, BomberBaseRoute13, BomberBaseRoute14, BomberBaseRoute15, BomberBaseRoute16, BomberBaseRoute17, BomberBaseRoute18, BomberBaseRoute19, BomberBaseRoute20, BomberBaseRoute21, BomberBaseRoute22, BomberBaseRoute23, BomberBaseRoute24, BomberBaseRoute25, BomberBaseRoute26, BomberBaseRoute27, BomberBaseRoute28 }
--BOMBER ROUTES
local BomberRoute01 = { "BomberPath01", "BomberPath02", "BomberPath03", "BomberPath04", "BomberPath05", "BomberPath06", "BomberPath07", "BomberPath08", "BomberPath09", "BomberPath10", "BomberPath11" }
local BomberRoute02 = { "BomberPath08", "BomberPath07", "BomberPath06", "BomberPath05", "BomberPath04", "BomberPath03", "BomberPath02", "BomberPath01", "BomberPath11", "BomberPath10", "BomberPath09" }
local BomberRoute03 = { "BomberPath12", "BomberPath13", "BomberPath14", "BomberPath15", "BomberPath16", "BomberPath17", "BomberPath18", "BomberPath19", "BomberPath20", "BomberPath21", "BomberPath22" }
local BomberRoute04 = { "BomberPath19", "BomberPath18", "BomberPath17", "BomberPath16", "BomberPath15", "BomberPath14", "BomberPath13", "BomberPath12", "BomberPath22", "BomberPath21", "BomberPath20" }
local BomberRoute05 = { "BomberPath23", "BomberPath24", "BomberPath25", "BomberPath26", "BomberPath27", "BomberPath28", "BomberPath29", "BomberPath30" }
local BomberRoute06 = { "BomberPath28", "BomberPath27", "BomberPath26", "BomberPath25", "BomberPath24", "BomberPath23", "BomberPath30", "BomberPath29" }
local BomberRoute07 = { "BomberPath31", "BomberPath32", "BomberPath33", "BomberPath34", "BomberPath35", "BomberPath36", "BomberPath37", "BomberPath38" }
local BomberRoute08 = { "BomberPath36", "BomberPath35", "BomberPath34", "BomberPath33", "BomberPath32", "BomberPath31", "BomberPath38", "BomberPath37" }
local BomberRoute09 = { "BomberPath39", "BomberPath40", "BomberPath41", "BomberPath42", "BomberPath43", "BomberPath44", "BomberPath45", "BomberPath46", "BomberPath47" }
local BomberRoute10 = { "BomberPath45", "BomberPath44", "BomberPath43", "BomberPath42", "BomberPath41", "BomberPath40", "BomberPath39", "BomberPath47", "BomberPath46" }
local BomberRoute11 = { "BomberPath48", "BomberPath49", "BomberPath50", "BomberPath51", "BomberPath52", "BomberPath53", "BomberPath54", "BomberPath55", "BomberPath56" }
local BomberRoute12 = { "BomberPath54", "BomberPath53", "BomberPath52", "BomberPath51", "BomberPath50", "BomberPath49", "BomberPath48", "BomberPath56", "BomberPath55" }
local BomberRoute13 = { "BomberPath59", "BomberPath60", "BomberPath61", "BomberPath62", "BomberPath63", "BomberPath57", "BomberPath58" }
local BomberRoute14 = { "BomberPath62", "BomberPath61", "BomberPath60", "BomberPath59", "BomberPath58", "BomberPath57", "BomberPath63" }
local AllBomberRoutes = { BomberRoute01, BomberRoute02, BomberRoute03, BomberRoute04, BomberRoute05, BomberRoute06, BomberRoute07, BomberRoute08, BomberRoute09, BomberRoute10, BomberRoute11, BomberRoute12, BomberRoute13, BomberRoute14 }
--NAMES
local SpecialNames = { "Ripper", "Judas", "Hellbringer", "Trix", "Bulldog", "Doomer", "Punisher", "Ludvig", "Odyssey", "Little Furball", "Stompy", "Flamer", "Inferno", "The Barbarian", "Barbarossa" }
local SpecialNamesID = 1
local sACUnames = { "Jackson", "Anders", "Leo", "Max", "Adrik", "Alexei", "Iona", "Ali", "Felix", "Jade", "Anna", "Ellie", "Jacob", "Jill", "Rick", "Adrian", "Geoff", "Peter", "Adam", "Jack", "Thomas", "Neon" }
local sACUnameID = 1
--OTHER
local DontStartNukeObjective = 0
local GameHasEnded = 0
local cdrUnitList = {}
local cdrUnitCount = 0
local DeathDialogueNumber = 1
local DeathDialogue = { 1, 2, 3, 4, 5 }
local WaveOrders = {}
local WaveTable = {}
local WaveDelay = { 0, 60, 120, 180 }
local EnableLane1 = 0
local EnableLane2 = 0
local EnableLane3 = 0
local EnableLane4 = 0
local EnableLane5 = 0
local IgnoredLanesList = {}
local BaseRaidingTargets = {}
local ValidTransportDrops = {}
function ShuffleList(list)
local SpawnList = list
for i = 1, table.getn(SpawnList) do
local RandomIndex = Random(1, table.getn(SpawnList))
SpawnList[i] = SpawnList[RandomIndex]
SpawnList[RandomIndex] = SpawnList[i]
end
return SpawnList
end
DeathDialogue = ShuffleList(DeathDialogue)
ShuffleList(WaveDelay)
ShuffleList(sACUnames)
ShuffleList(SpecialNames)
function ScenarioUtils.CommanderWarpDelay(cdrUnit, delay) --Silly way to disable Warp in effect.
local army = cdrUnit:GetArmy()
local aiBrain = GetArmyBrain(army)
if (aiBrain:GetFactionIndex() == 1) then
cdrUnit:ShowBone(0, true)
cdrUnit:HideBone('Right_Upgrade', true)
cdrUnit:HideBone('Left_Upgrade', true)
cdrUnit:HideBone('Back_Upgrade_B01', true)
cdrUnit:SetOrientation({ 0, 1, 0, 0 }, true)
elseif (aiBrain:GetFactionIndex() == 2) then
cdrUnit:ShowBone(0, true)
cdrUnit:HideBone('Back_Upgrade', true)
cdrUnit:HideBone('Right_Upgrade', true)
cdrUnit:HideBone('Left_Upgrade', true)
cdrUnit:SetOrientation({ 0, 1, 0, 0 }, true)
elseif (aiBrain:GetFactionIndex() == 3) then
cdrUnit:ShowBone(0, true)
cdrUnit:HideBone('Back_Upgrade', true)
cdrUnit:HideBone('Right_Upgrade', true)
cdrUnit:HideBone('Back_Upgrade', true)
cdrUnit:SetOrientation({ 0, 1, 0, 0 }, true)
elseif (aiBrain:GetFactionIndex() == 4) then
cdrUnit:ShowBone(0, true)
cdrUnit:HideBone('Back_Upgrade', true)
cdrUnit:HideBone('Right_Upgrade', true)
cdrUnit:HideBone('Left_Upgrade', true)
cdrUnit:SetOrientation({ 0, 1, 0, 0 }, true)
else
WaitSeconds(delay)
cdrUnit:PlayCommanderWarpInEffect()
end
end
function ScenarioUtils.CreateResources()
local markers = ScenarioUtils.GetMarkers()
local ChangeResourcePosition = false
for i, army in ListArmies() do
--LOG(army)
if (army == "ARMY_5") then
ChangeResourcePosition = true
end
end
if (ChangeResourcePosition) then
-- create the resource
CreateResourceDeposit("Hydrocarbon", 251.5, 22.49, 340.5, 3.00)
-- create the resource graphic on the map
CreatePropHPR("/env/common/props/hydrocarbonDeposit01_prop.bp", 251.5, 22.49, 340.5, Random(0, 6.2832), 0, 0)
-- create the resource icon on the map
CreateSplat({ 251.5, 22.49, 340.5 }, -- Position
0, -- Heading (rotation)
"/env/common/splats/hydrocarbon_marker.dds", -- Texture name for albedo
6, 6, -- SizeX/Z
200, -- LOD
0, -- Duration (0 == does not expire)
-1, -- army (-1 == not owned by any single army)
0
)
-- create the resource
CreateResourceDeposit("Mass", 247.5 + 1.00, 22.48, 364.5 + 1.00, 1.00)
CreatePropHPR("/env/common/props/massDeposit01_prop.bp", 247.5, 22.48, 364.5, Random(0, 360), 0, 0)
CreateResourceDeposit("Mass", 247.5 + 1.00, 22.48, 364.5 - 1.00, 1.00)
CreateResourceDeposit("Mass", 247.5 - 1.00, 22.48, 364.5 + 1.00, 1.00)
CreateResourceDeposit("Mass", 247.5 - 1.00, 22.48, 364.5 - 1.00, 1.00)
CreateSplat({ 247.5, 22.48, 364.5 }, -- Position
0, -- Heading (rotation)
"/env/common/splats/mass_marker.dds", -- Texture name for albedo
4, 4, -- SizeX/Z
100, -- LOD
0, -- Duration (0 == does not expire)
-1, -- army (-1 == not owned by any single army)
0
)
end
for i, tblData in pairs(markers) do
local spawnresource = false
local posx = 0
local posz = 0
local NewResourcePosition = {}
local NewResourceSize = 0.00
if (tblData.resource) then
for i, army in ListArmies() do
if (army == "ARMY_1" and tblData.army1resource) then
spawnresource = true
elseif (army == "ARMY_2" and tblData.army2resource) then
spawnresource = true
elseif (army == "ARMY_3" and tblData.army3resource) then
spawnresource = true
elseif (army == "ARMY_4" and tblData.army4resource) then
spawnresource = true
elseif (army == "ARMY_5" and tblData.army5resource) then
spawnresource = true
end
end
end
if (tblData.resource and tblData.Hydrocarbon4 == true and ChangeResourcePosition) then
NewResourcePosition = { tblData.position[1] + 3.00, tblData.position[2], tblData.position[3] - 3.00 }
elseif (tblData.resource and tblData.Hydrocarbon3 == true and ChangeResourcePosition) then
NewResourcePosition = { tblData.position[1] - 3.00, tblData.position[2], tblData.position[3] + 3.00 }
elseif (tblData.resource and tblData.Hydrocarbon2 == true and ChangeResourcePosition) then
NewResourcePosition = { tblData.position[1] + 3.00, tblData.position[2], tblData.position[3] + 3.00 }
elseif (tblData.resource and tblData.Hydrocarbon1 == true and ChangeResourcePosition) then
NewResourcePosition = { tblData.position[1] - 3.00, tblData.position[2], tblData.position[3] - 3.00 }
elseif (tblData.resource and tblData.Mass23 == true and ChangeResourcePosition) then
posx = -14.00
posz = -2.00
NewResourcePosition = { tblData.position[1] + posx, tblData.position[2], tblData.position[3] + posz }
elseif (tblData.resource and tblData.Mass22 == true and ChangeResourcePosition) then
posx = 5.50
posz = 0.00
NewResourcePosition = { tblData.position[1] + posx, tblData.position[2], tblData.position[3] + posz }
else
NewResourcePosition = tblData.position
end
if (spawnresource and not tblData.BigMass) then
-- check type of resource and set parameters
local bp, albedo, sx, sz, lod
if (tblData.type == "Mass") then
albedo = "/env/common/splats/mass_marker.dds"
bp = "/env/common/props/massDeposit01_prop.bp"
sx = 2
sz = 2
lod = 100
else
albedo = "/env/common/splats/hydrocarbon_marker.dds"
bp = "/env/common/props/hydrocarbonDeposit01_prop.bp"
sx = 6
sz = 6
lod = 200
end
-- create the resource
CreateResourceDeposit(tblData.type, NewResourcePosition[1], NewResourcePosition[2], NewResourcePosition[3], tblData.size)
-- create the resource graphic on the map
CreatePropHPR(bp, NewResourcePosition[1], NewResourcePosition[2], NewResourcePosition[3], Random(0, 6.2832), 0, 0)
-- create the resource icon on the map
CreateSplat(NewResourcePosition, -- Position
0, -- Heading (rotation)
albedo, -- Texture name for albedo
sx, sz, -- SizeX/Z
lod, -- LOD
0, -- Duration (0 == does not expire)
-1, -- army (-1 == not owned by any single army)
0 -- ???
)
elseif (spawnresource and tblData.BigMass) then
local bp, albedo, sx, sz, lod
local variation = 0
if (tblData.type == "Mass") then
albedo = "/env/common/splats/mass_marker.dds"
bp = "/env/common/props/massDeposit01_prop.bp"
sx = 4
sz = 4
lod = 100
variation = 1.00
else
albedo = "/env/common/splats/hydrocarbon_marker.dds"
bp = "/env/common/props/hydrocarbonDeposit01_prop.bp"
sx = 12
sz = 12
lod = 200
variation = 3.00
end
CreateResourceDeposit(tblData.type, tblData.position[1] + variation + posx, tblData.position[2], tblData.position[3] + variation + posz, tblData.size)
CreatePropHPR(bp, tblData.position[1] + posx, tblData.position[2], tblData.position[3] + posz, Random(0, 360), 0, 0)
CreateResourceDeposit(tblData.type, tblData.position[1] + posx + variation, tblData.position[2], tblData.position[3] + posz - variation, tblData.size)
CreateResourceDeposit(tblData.type, tblData.position[1] + posx - variation, tblData.position[2], tblData.position[3] + posz + variation, tblData.size)
CreateResourceDeposit(tblData.type, tblData.position[1] + posx - variation, tblData.position[2], tblData.position[3] + posz - variation, tblData.size)
CreateSplat(NewResourcePosition, -- Position
0, -- Heading (rotation)
albedo, -- Texture name for albedo
sx, sz, -- SizeX/Z
lod, -- LOD
0, -- Duration (0 == does not expire)
-1, -- army (-1 == not owned by any single army)
0 -- ???
)
end
end
end
local function ShuffleListPartially(list, startingID, endingID, IgnoreList) --Shuffles list, expect list IDs that are on IgnoreList
local SpawnList = {}
SpawnList = list
local DoNothing = 0
if (endingID > table.getn(SpawnList)) then
return SpawnList
else
for i = startingID, endingID do
if (IgnoreList ~= nil) then
for k = 1, table.getn(IgnoreList) do
if (i == IgnoreList[k]) then
DoNothing = 1
end
end
end
if (DoNothing == 0) then
local RandomIndex = Random(i, endingID)
if (IgnoreList ~= nil) then
for j = 1, table.getn(IgnoreList) do
if (RandomIndex == IgnoreList[j]) then
RandomIndex = Random(i, endingID)
j = 1
end
end
end
local str1 = SpawnList[i]
local str2 = SpawnList[RandomIndex]
SpawnList[i] = str2
SpawnList[RandomIndex] = str1
end
DoNothing = 0
end
return SpawnList
end
end
local CheckFocusArmy = function()
if (GetFocusArmy() < 1) then
SimObjects.GetFocusArmy = function() -- <<<<< Fix to spectating not working. GetFocusArmy must never be < 1
local aiBrain = GetArmyBrain(OccupiedArmies[1])
return (aiBrain:GetArmyIndex())
end
end
end
StartMission1 = function()
local HowManyMustSurvive = 0
local Desc = ""
if options.allAcusNeedToSurvive() then
HowManyMustSurvive = cdrUnitCount
Desc = "Defend against incoming attacks. All ACUs must survive."
else
HowManyMustSurvive = 1
Desc = "Defend against incoming attacks. At least one ACU must survive."
end
ScenarioInfo.M1P1 = Objectives.Protect('primary',
'incomplete',
"Hold The Line",
Desc,
{
Units = cdrUnitList,
Timer = nil,
NumRequired = HowManyMustSurvive,
MarkUnits = false,
})
ScenarioInfo.M1P1:AddResultCallback(function(result)
if (result == false) then
ForkThread(OnPlayerDefeat)
end
end)
end
CreateWaves = function()
WaveTable = localImport('WaveTable.lua').getWaveTable(
EnableLane1,
EnableLane2,
EnableLane3,
EnableLane4,
EnableLane5
)
end
CreateWaveTableOrders = function()
local ValidGunshipTargetsA = table.copy(BaseRaidingTargets)
ShuffleList(ValidGunshipTargetsA)
WaveOrders = localImport('WaveOrders.lua').getWaveTable(
WaveDelay, -- TODO: move to WaveOrders.lua
ShuffleList,
ValidGunshipTargetsA
)
end
local unitCreator = entropyLibImport('UnitCreator.lua').newUnitCreator()
local function setupHealthMultiplier()
if options.getHealthMultiplier() ~= 1 then
unitCreator.onUnitCreated(function(unit, unitInfo)
if unitInfo.isSurvivalSpawned then
unit:SetVeterancy(5)
unit:SetMaxHealth(unit:GetMaxHealth() * options.getHealthMultiplier())
unit:SetHealth(unit, unit:GetMaxHealth())
end
end)
end
end
local function setupDamageMultiplier()
local multiplier = options.getDamageMultiplier()
if multiplier ~= 1 then
local buffUnitDamage = entropyLibImport('UnitBuff.lua').buffDamage
unitCreator.onUnitCreated(function(unit, unitInfo)
if unitInfo.isSurvivalSpawned then
buffUnitDamage(unit, multiplier)
end
end)
end
end
local function createSurvivalUnit(blueprint, x, z, y)
local unit = unitCreator.create({
blueprintName = blueprint,
armyName = "ARMY_SURVIVAL_ENEMY",
x = x,
z = z,
y = y,
isSurvivalSpawned = true
})
if EntityCategoryContains(categories.AIR - categories.EXPERIMENTAL, unit) then
unit:SetFuelUseTime(9999)
end
return unit
end
function OnPopulate()
ScenarioUtils.InitializeArmies()
setupHealthMultiplier()
setupDamageMultiplier()
local init = function()
local EnemyCommander = createSurvivalUnit('URL0001', 10, 13.5, -10)
EnemyCommander:SetDoNotTarget(true)
EnemyCommander:SetCanBeKilled(false)
EnemyCommander:SetProductionPerSecondEnergy(90000)
EnemyCommander:SetConsumptionPerSecondEnergy(0)
EnemyCommander:SetProductionPerSecondMass(9999)
ScenarioFramework.SetPlayableArea('AREA_1', false)
ScenarioInfo.MissionNumber = 1
SetArmyColor('ARMY_SURVIVAL_ENEMY', 225, 70, 0)
ScenarioInfo.Options.Victory = 'sandbox'
SetIgnoreArmyUnitCap('ARMY_SURVIVAL_ENEMY', true)
------------------------------------------------------------------------------------------ When there's less than 4 players, spawn additional commanders on empty slots-------------------------------------------------------------------------------
local UnoccupiedArmies = {}
local AllArmies = { "ARMY_1", "ARMY_2", "ARMY_3", "ARMY_4", "ARMY_5" }
for i, army in AllArmies do
local IsListed = 0
for k, occarmy in ListArmies() do
if (occarmy == army) then
table.insert(OccupiedArmies, army)
IsListed = 1
if (occarmy == "ARMY_1") then
EnableLane1 = 1
table.insert(BaseRaidingTargets, "PlayerSpawn_1")
table.insert(ValidTransportDrops, "TransportDrop04")
table.insert(ValidTransportDrops, "TransportDrop01")
elseif (occarmy == "ARMY_3") then
EnableLane2 = 1
table.insert(BaseRaidingTargets, "PlayerSpawn_2")
table.insert(ValidTransportDrops, "TransportDrop04")
table.insert(ValidTransportDrops, "TransportDrop01")
table.insert(ValidTransportDrops, "TransportDrop02")
elseif (occarmy == "ARMY_4") then
EnableLane3 = 1
table.insert(BaseRaidingTargets, "PlayerSpawn_3")
table.insert(ValidTransportDrops, "TransportDrop06")
table.insert(ValidTransportDrops, "TransportDrop03")
table.insert(ValidTransportDrops, "TransportDrop02")
elseif (occarmy == "ARMY_2") then
EnableLane4 = 1
table.insert(BaseRaidingTargets, "PlayerSpawn_4")
table.insert(ValidTransportDrops, "TransportDrop06")
table.insert(ValidTransportDrops, "TransportDrop03")
elseif (occarmy == "ARMY_5" and table.getn(ListArmies()) > 2) then
EnableLane5 = 1
table.insert(BaseRaidingTargets, "PatrolBase_5")
table.insert(ValidTransportDrops, "TransportDrop05")
if ((EnableLane1 == 1 and EnableLane2 == 1) or (EnableLane3 == 1 and EnableLane4 == 1)) then
table.insert(ValidTransportDrops, "TransportDrop05")
--LOG("Second TransportDrop Activated.")
--table.insert(ValidTransportDrops, "TransportDrop05")
end
elseif (occarmy == "ARMY_5" and table.getn(ListArmies()) <= 2) then
EnableLane5 = 1
--LOG("Lane 5 Enabled. Only ARMY_5 present")
table.insert(BaseRaidingTargets, "PatrolBase_5")
table.insert(ValidTransportDrops, "TransportDrop01")
table.insert(ValidTransportDrops, "TransportDrop02")
table.insert(ValidTransportDrops, "TransportDrop03")
table.insert(ValidTransportDrops, "TransportDrop04")
table.insert(ValidTransportDrops, "TransportDrop05")
end
end
end
if (IsListed == 0) then
table.insert(UnoccupiedArmies, army)
end
end
local brain = GetArmyBrain(OccupiedArmies[1]) --Fixes the coop script someone changed.
SimObjects.playerArmy = brain:GetArmyIndex()
if (EnableLane1 == 1 or EnableLane2 == 1) then
table.insert(BaseRaidingTargets, "PatrolBase_7")
end
if (EnableLane3 == 1 or EnableLane4 == 1) then
table.insert(BaseRaidingTargets, "PatrolBase_7")
end
table.insert(BaseRaidingTargets, "PatrolBase_6")
----------------------------- Spawn Destroyer Boss to random, occupied lane
if (EnableLane1 == 0) then
table.insert(IgnoredLanesList, 161)
table.insert(IgnoredLanesList, 162)
table.insert(IgnoredLanesList, 172)
end
if (EnableLane2 == 0) then
table.insert(IgnoredLanesList, 163)
table.insert(IgnoredLanesList, 164)
end
if (EnableLane3 == 0) then
table.insert(IgnoredLanesList, 166)
table.insert(IgnoredLanesList, 167)
end
if (EnableLane4 == 0) then
table.insert(IgnoredLanesList, 173)
table.insert(IgnoredLanesList, 174)
table.insert(IgnoredLanesList, 168)
end
if (EnableLane5 == 0) then
table.insert(IgnoredLanesList, 169)
table.insert(IgnoredLanesList, 170)
table.insert(IgnoredLanesList, 171)
end
if (EnableLane2 == 0 and EnableLane3 == 0) then
table.insert(IgnoredLanesList, 165)
end
---------------------------------------------------------------------------
if (EnableLane1 == 0 and EnableLane2 == 0 and EnableLane3 == 0 and EnableLane4 == 0 and EnableLane5 == 1) then
EnableLane5 = 0
EnableLane3 = 1
end
end
init()
CreateWaves()
CreateWaveTableOrders()
if (EnableLane1 == 1) then
WaveTable[161] = { 161, 'urs0201', 1 + EnableLane5 }
elseif (EnableLane2 == 1) then
WaveTable[163] = { 163, 'urs0201', 1 + EnableLane5 }
elseif (EnableLane3 == 1) then
WaveTable[166] = { 166, 'urs0201', 1 + EnableLane5 }
elseif (EnableLane4 == 1) then
WaveTable[173] = { 173, 'urs0201', 1 + EnableLane5 }
elseif (EnableLane5 == 1) then
WaveTable[169] = { 169, 'urs0201', 1 + EnableLane5 }
end
ShuffleListPartially(WaveTable, 383, 384)
ShuffleListPartially(WaveTable, 385, 386)
ShuffleListPartially(WaveTable, 387, 388)
ShuffleListPartially(WaveTable, 389, 390)
ShuffleListPartially(WaveTable, 276, 277)
ShuffleListPartially(WaveTable, 278, 279)
ShuffleListPartially(WaveTable, 280, 281)
ShuffleListPartially(WaveTable, 282, 283)
ShuffleListPartially(WaveTable, 401, 402)
ShuffleListPartially(WaveTable, 403, 404)
ShuffleListPartially(WaveTable, 405, 406)
ShuffleListPartially(WaveTable, 407, 408)
ShuffleListPartially(WaveTable, 409, 410)
ShuffleListPartially(WaveTable, 411, 412)
ShuffleListPartially(WaveTable, 413, 414)
ShuffleListPartially(WaveTable, 415, 416)
ShuffleListPartially(WaveTable, 417, 418)
ShuffleListPartially(WaveTable, 419, 420)
ShuffleListPartially(WaveTable, 421, 422)
ShuffleListPartially(WaveTable, 423, 424)
ShuffleListPartially(WaveTable, 425, 426)
ShuffleListPartially(WaveTable, 427, 428)
ShuffleListPartially(WaveTable, 429, 430)
ShuffleListPartially(WaveTable, 431, 432)
ShuffleListPartially(WaveTable, 433, 434)
ShuffleListPartially(WaveTable, 435, 436)
ShuffleListPartially(WaveTable, 437, 438)
ShuffleListPartially(WaveTable, 439, 440)
ShuffleListPartially(WaveTable, 441, 442)
ShuffleListPartially(WaveTable, 443, 444)
ShuffleListPartially(WaveTable, 445, 446)
ShuffleListPartially(WaveTable, 447, 448)
ShuffleListPartially(WaveTable, 449, 450)
ShuffleListPartially(WaveTable, 451, 452)
ShuffleListPartially(WaveTable, 453, 454)
ShuffleListPartially(WaveTable, 455, 456)
ShuffleListPartially(WaveTable, 457, 458)
ShuffleListPartially(WaveTable, 459, 460)
ShuffleListPartially(WaveTable, 461, 462)
ShuffleListPartially(WaveTable, 463, 464)
ShuffleListPartially(WaveTable, 465, 466)
ShuffleListPartially(WaveTable, 467, 468)
ShuffleListPartially(WaveTable, 469, 470)
ShuffleListPartially(WaveTable, 471, 472)
ShuffleListPartially(WaveTable, 473, 474)
ShuffleListPartially(WaveTable, 475, 476)
ShuffleListPartially(WaveTable, 477, 478)
ShuffleListPartially(WaveTable, 479, 480)
ShuffleListPartially(WaveTable, 481, 482)
ShuffleListPartially(WaveTable, 483, 484)
ShuffleListPartially(WaveTable, 485, 486)
ShuffleListPartially(WaveTable, 487, 488)
ShuffleListPartially(WaveTable, 489, 490)
ShuffleListPartially(WaveTable, 491, 492)
ShuffleListPartially(WaveTable, 493, 494)
ShuffleListPartially(WaveTable, 495, 496)
ShuffleListPartially(WaveTable, 497, 498)
ShuffleListPartially(WaveTable, 499, 500)
ShuffleListPartially(WaveTable, 501, 502)
ShuffleListPartially(WaveTable, 503, 504)
ShuffleListPartially(WaveTable, 505, 506)
ShuffleListPartially(WaveTable, 507, 508)
ShuffleListPartially(WaveTable, 509, 510)
ShuffleListPartially(WaveTable, 511, 512)
ShuffleListPartially(WaveTable, 513, 514)
ShuffleListPartially(WaveTable, 515, 516)
ShuffleListPartially(WaveTable, 517, 518)
ShuffleListPartially(WaveTable, 519, 520)
ShuffleListPartially(WaveTable, 521, 522)
ShuffleListPartially(WaveTable, 523, 524)
ShuffleListPartially(WaveTable, 525, 526)
ShuffleListPartially(WaveTable, 527, 528)
ShuffleListPartially(WaveTable, 161, 174, IgnoredLanesList)
CheckFocusArmy()
for i, army in ListArmies() do -------------------------------------------------------------------------------- Set player alliances and army options
if (army == "ARMY_1" or army == "ARMY_2" or army == "ARMY_3" or army == "ARMY_4" or army == "ARMY_5") then
local coms = GetArmyBrain(army):GetListOfUnits(categories.COMMAND, false, false)
for i, com in coms do
table.insert(cdrUnitList, com)
end
ScenarioFramework.AddRestriction(army, categories.WALL) -- don't allow them to build walls
for x, armyX in ListArmies() do
-- if human army
if (armyX == "ARMY_1" or armyX == "ARMY_2" or armyX == "ARMY_3" or armyX == "ARMY_4" or armyX == "Army_5") then
SetAlliance(army, armyX, 'Ally')
end
end
SetAlliance(army, "ARMY_SURVIVAL_ENEMY", 'Enemy')
SetAlliedVictory(army, true)
end
end
cdrUnitCount = table.getn(cdrUnitList)
Sync.CampaignMode = true -- Enables campaign UI. Note that spectator mode doesn't work with campaign mode enabled unless you know how to fix it.
StartMission1()
end
function OnStart(self)
ForkThread(Survival_Tick)
end
StartMission2 = function()
ScenarioInfo.M1P2 = Objectives.Timer('primary',
'incomplete',
"Survive Untill Recalled",
"Survive until HQ can recall your ACU.",
{
Timer = 600,
ExpireResult = 'complete',
})
ScenarioInfo.M1P2:AddResultCallback(function(result)
if (result) then
--LOG("Timer ran out. Victory here.")
OnPlayerVictory()
end
end)
end
local function IssueStrategicMissile(UnitList, TargetList) --Issue nuke launch
LOG("====================================================================== Launching nuke |||||||||||||")
local target = 1
IssueClearCommands(UnitList)
for k, unit in UnitList do
if (unit:BeenDestroyed() == false) then
if (unit:GetUnitId() == 'urs0304') then
local POS = TargetList[target]:GetPosition()
unit:GiveNukeSiloAmmo(1)
IssueNuke({ unit }, POS)
if (target < table.getn(TargetList)) then
target = target + 1
else
target = 1
end
end
end
end
end
StartSecondaryMission1 = function()
ForkThread(DialogueDelay)
local UnitList = GetArmyBrain("ARMY_SURVIVAL_ENEMY"):GetListOfUnits(categories.NUKESUB, false, false)
if (table.getn(UnitList) > 0) then
ScenarioInfo.M1S1 = Objectives.KillOrCapture(
'secondary',
'incomplete',
"Destroy Missile Submarines",
"Destroy Strategic Missile Submarines before they can build and launch a nuke. Nukes will launch at 35 minute mark.",
{
Units = UnitList,
NumRequired = table.getn(UnitList),
MarkUnits = false,
ShowProgress = true,
}
)
ScenarioInfo.M1S1:AddResultCallback(function(result)
if (result == false) then
UnitList = GetArmyBrain("ARMY_SURVIVAL_ENEMY"):GetListOfUnits(categories.NUKESUB, false, false)
local NukeTargetUnits = {}
local PotentialNukeTargetUnits = {}
for x, army in ListArmies() do
if (army == "ARMY_1" or army == "ARMY_2" or army == "ARMY_3" or army == "ARMY_4" or army == "ARMY_5") then
PotentialNukeTargetUnits = GetArmyBrain(army):GetListOfUnits(categories.TECH3 - categories.MOBILE - categories.INDIRECTFIRE - categories.DIRECTFIRE - categories.SHIELD - categories.SILO, false, false) --Target t3 pgens, t3 mexes, t3 factories.
for k, unit in PotentialNukeTargetUnits do
table.insert(NukeTargetUnits, unit)
end
end
end
if (table.getn(NukeTargetUnits) == 0) then
for x, army in ListArmies() do
if (army == "ARMY_1" or army == "ARMY_2" or army == "ARMY_3" or army == "ARMY_4" or army == "ARMY_5") then
PotentialNukeTargetUnits = GetArmyBrain(army):GetListOfUnits(categories.COMMAND, false, false) --If no other targets found, target commanders
for k, unit in PotentialNukeTargetUnits do
table.insert(NukeTargetUnits, unit)
end
end
end
end
if (table.getn(NukeTargetUnits) > 0) then
NukeTargetUnits = ShuffleList(NukeTargetUnits)
IssueStrategicMissile(UnitList, NukeTargetUnits)
end
end
end)
else
DontStartNukeObjective = 1
end
end
DialogueDelay = function()
WaitSeconds(6.0)
ScenarioFramework.Dialogue(import('/maps/X1CA_001/X1CA_001_strings.lua').X01_M01_240, nil, true)
end
OnPlayerVictory = function()
if (GameHasEnded == 0) then
GameHasEnded = 1
ScenarioInfo.M1P1:ManualResult(true)
local TeleportDelay = 0
for k, army in ListArmies() do
if (army == "ARMY_1" or army == "ARMY_2" or army == "ARMY_3" or army == "ARMY_4" or army == "ARMY_5") then
local coms = GetArmyBrain(army):GetListOfUnits(categories.COMMAND, false, false)
for i, com in coms do
ForkThread(FakeCommanderTeleport, com, TeleportDelay)
TeleportDelay = TeleportDelay + 1.5
end
end
end
WaitSeconds(TeleportDelay + 3.0)
IssueClearCommands(GetArmyBrain("ARMY_SURVIVAL_ENEMY"):GetListOfUnits(categories.ALLUNITS, false, false))
ScenarioFramework.Dialogue(import('/maps/X1CA_004/X1CA_004_strings.lua').X04_M03_270, nil, true) --"You made it!"
ScenarioFramework.Dialogue(import('/maps/X1CA_001/X1CA_001_strings.lua').TAUNT33, nil, true) --Sera Taunt4
WaitSeconds(4.0)
for k, army in ListArmies() do
if (army == "ARMY_1" or army == "ARMY_2" or army == "ARMY_3" or army == "ARMY_4" or army == "ARMY_5") then
GetArmyBrain(army):OnVictory()
end
end
WaitSeconds(10.0)
EndGame()
end
end
function FakeCommanderTeleport(com, delay)
com:SetDoNotTarget(true)
com:SetCanBeKilled(false)