-
Notifications
You must be signed in to change notification settings - Fork 2
/
scenario_60_captureFlag.lua
executable file
·9297 lines (9182 loc) · 386 KB
/
scenario_60_captureFlag.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
-- Name: Capture the Flag
-- Description: Capture opposing team's "flag" before they capture yours
---
--- The region consists of two halves divided by a line of nebulae and/or markers. The first 5 minutes (configurable) each side decides where to place their flag. The ships closest to the referee station determine the team's flag location during the initial phase. Crossing to the other side during this phase will result in ship destruction. The weapons officer will mark the flag coordinates when the ship reaches the flag location. After the flag hide timer expires, an artifact will be placed at the location representing the team's flag. If no place has been marked, the ship's current location will be used. If the location is outside the game boundaries, the flag will be placed at the nearest in bounds location
---
--- Once the flags are placed, the hunt is on. Ships may cross the border in search of the other team's flag, but while they are in the other team's territory they may be tagged by an opponent ship within 0.75U. Being tagged sends you back to your own region with damage to your warp/jump drive. Each flag must be scanned before it can be retrived. Retrieval occurs by getting within 1U of the flag. Being tagged while in posession of the flag drops the flag at the location of the tag event. Cross back to your side with the flag to claim victory
---
--- Current version designed for post pandemic event, but the pandemic lasted longer than anticipated. Event was held 23Jan2021 with 14 player ships participating. Enjoy this scenario in your own multiple player ship event.
-- Author: Xansta & Kilted-Klingon
-- Type: Player ship vs. player ship, teams up to 16 ships per side
-- Variation[Easy]: Easy enemies, told which opposing team ship picked up flag
-- Variation[Hard]: Hard enemies, told nothing when opposing team picks up flag
-- Variation[Small]: Smaller region: 50U, told when opposing team picks up flag
-- Variation[Large]: Larger region: 200U, told when opposing team picks up flag
-- Variation[Easy Small]: Easy enemies, smaller region: 50U, told which opposing team ship picked up flag
-- Variation[Easy Large]: Easy enemies, larger region: 200U, told which opposing team ship picked up flag
-- Variation[Hard Small]: Hard enemies, smaller region: 50U, told nothing when opposing team picks up flag
-- Variation[Hard Large]: Hard enemies, larger region: 200U, told nothing when opposing team picks up flag
require("utils.lua")
function init()
scenario_version = "1.31.4"
print(string.format(" ----- Scenario: Capture the Flag ----- Version %s -----",scenario_version))
print(_VERSION)
------------------------
-- Global variables --
------------------------
-- Variables that may be modified before game start to adjust game play
--[[
--If you insert a custom ship_name here, be sure to remove it from the pool of random names
preset_players = {}
--1st ship spawned: Maverick
table.insert(preset_players,
{
xo = "Starry", --1st choice
ship_name = "Phoenix",
faction = "Human Navy",
ship_pref_1 = "Maverick", --pref 2
ship_pref_2 = "Nautilus", --pref 1
ship_pref_3 = "Player Cruiser",
}
)
table.insert(preset_players,
{
xo = "Aldric", --3rd choice
faction = "Kraylor",
ship_name = "Durance",
ship_pref_1 = "Maverick", --pref 2
ship_pref_2 = "Atlantis", --pref 1
ship_pref_3 = "Crucible",
ship_pref_4 = "Piranha",
ship_pref_5 = "Player Cruiser",
ship_pref_6 = "Player Missile Cr.",
}
)
--2nd ship spawned: Atlantis
table.insert(preset_players,
{
xo = "Larry",
ship_name = "Mondo",
faction = "Human Navy",
}
)
table.insert(preset_players,
{
xo = "Epeac", --2nd choice
faction = "Kraylor",
ship_name = "Dauntless",
ship_pref_1 = "Atlantis",
ship_pref_2 = "Maverick",
ship_pref_3 = "Crucible",
}
)
--3rd ship spawned: Phobos M3P
table.insert(preset_players,
{
xo = "Lupus", --5th choice
faction = "Human Navy",
ship_name = "Harbinger",
ship_pref_1 = "PhobosM3P", --Lupus prefers warp
ship_pref_4 = "Atlantis", --Theta pref 1
ship_pref_2 = "Crucible",
ship_pref_3 = "Maverick",
}
)
table.insert(preset_players,
{
xo = "Daid",
faction = "Kraylor",
ship_name = "UltiShiptastic",
}
)
--4th ship spawned: Crucible
table.insert(preset_players,
{
xo = "Mo",
ship_name = "Shotgun",
faction = "Human Navy",
}
)
table.insert(preset_players,
{
xo = "Theta", --4th choice
faction = "Kraylor",
ship_name = "Prokop",
ship_pref_1 = "Crucible", --pref 2
ship_pref_2 = "Atlantis", --pref 1
ship_pref_3 = "Maverick",
ship_pref_4 = "Phobos M3P",
}
)
--5th ship spawned: Flavia P.Falcon
table.insert(preset_players,
{
xo = "Curly",
ship_name = "Jayhawk",
faction = "Human Navy",
}
)
table.insert(preset_players,
{
xo = "AJ",
ship_name = "Roc",
faction = "Kraylor",
}
)
--6th ship spawned: Repulse
table.insert(preset_players,
{
xo = "Shemp",
ship_name = "Lizard",
faction = "Human Navy",
}
)
table.insert(preset_players,
{
xo = "Hemmond",
faction = "Kraylor",
ship_name = "Sentinel",
}
)
--7th ship spawned: Player Missile Cr.
table.insert(preset_players,
{
xo = "Ted",
ship_name = "Cremator",
faction = "Human Navy",
}
)
table.insert(preset_players,
{
xo = "Hermann",
ship_name = "Charger",
faction = "Kraylor",
}
)
--]]
diagnostic = false -- See GM button. A boolean for printing debug data to the console during development; turn to "false" during game play
timeDivision = "paused"
gameTimeLimit = 45*60 -- See GM button. Time limit for game; this is measured in real time seconds (example: 45*60 = 45 minutes)
hideFlagTime = 300 -- See GM button. Time given to hide flag; this is measured in real time seconds; (300 secs or 5 mins is the normal setting; 60 for certain tests)
maxGameTime = gameTimeLimit -- See GM Button.
-- intial player placement locations; note that these locations are intended to be generally consistent and independent of the environment option chosen
--player side Hum Kra Hum Kra Hum Kra Hum Kra Hum Kra Hum Kra Hum Kra Hum Kra Hum Kra Hum Kra Hum Kra Hum Kra Hum Kra Hum Kra Hum Kra Hum Kra
--player index 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
playerStartX = {-1000, 1000, -1000, 1000, -1000, 1000, -2000, 2000, -2000, 2000, -2000, 2000, -3000, 3000, -1000, 1000, -1000, 1000, -2000, 2000, -2000, 2000, -3000, 3000, -3000, 3000, -3000, 3000, -3000, 3000, -4000, 4000}
playerStartY = { 0, 0, -1000, 1000, 1000, -1000, 0, 0, 1000, -1000, -1000, 1000, 0, 0, -2000, 2000, 2000, -2000, -2000, 2000, 2000, -2000, -1000, 1000, 1000, -1000, -2000, 2000, 2000, -2000, 0, 0}
player_tag_relocate_x = {-1000, 1000, -1000, 1000, -1000, 1000, -2000, 2000, -2000, 2000, -2000, 2000, -3000, 3000, -1000, 1000, -1000, 1000, -2000, 2000, -2000, 2000, -3000, 3000, -3000, 3000, -3000, 3000, -3000, 3000, -4000, 4000} --may override in terrain section
player_tag_relocate_y = { 0, 0, -1000, 1000, 1000, -1000, 0, 0, 1000, -1000, -1000, 1000, 0, 0, -2000, 2000, 2000, -2000, -2000, 2000, 2000, -2000, -1000, 1000, 1000, -1000, -2000, 2000, 2000, -2000, 0, 0}
player_start_heading = { 270, 90, 270, 90, 270, 90, 270, 90, 270, 90, 270, 90, 270, 90, 270, 90, 270, 90, 270, 90, 270, 90, 270, 90, 270, 90, 270, 90, 270, 90, 270, 90} --set both heading and rotation to avoid initial rotation upon game start
player_start_rotation = { 180, 0, 180, 0, 180, 0, 180, 0, 180, 0, 180, 0, 180, 0, 180, 0, 180, 0, 180, 0, 180, 0, 180, 0, 180, 0, 180, 0, 180, 0, 180, 0} --rotation points 90 degrees counter-clockwise of heading
player_wing_names = {
[2] = {
"Alpha","Red",
},
[4] = {
"Alpha", "Red",
"Bravo", "Blue",
},
[6] = {
"Alpha", "Red",
"Bravo", "Blue",
"Charlie", "Green",
},
[8] = {
"Alpha 1", "Red 1",
"Alpha 2", "Red 2",
"Bravo 1", "Blue 1",
"Bravo 2", "Blue 2",
},
[10] = {
"Alpha 1", "Red 1",
"Alpha 2", "Red 2",
"Bravo 1", "Blue 1",
"Bravo 2", "Blue 2",
"Charlie", "Green",
},
[12] = {
"Alpha 1", "Red 1",
"Alpha 2", "Red 2",
"Bravo 1", "Blue 1",
"Bravo 2", "Blue 2",
"Charlie 1", "Green 1",
"Charlie 2", "Green 2",
},
[14] = {
"Alpha 1", "Red 1",
"Alpha 2", "Red 2",
"Alpha 3", "Red 3",
"Bravo 1", "Blue 1",
"Bravo 2", "Blue 2",
"Charlie 1", "Green 1",
"Charlie 2", "Green 2",
},
[16] = {
"Alpha 1", "Red 1",
"Alpha 2", "Red 2",
"Alpha 3", "Red 3",
"Bravo 1", "Blue 1",
"Bravo 2", "Blue 2",
"Bravo 3", "Blue 3",
"Charlie 1", "Green 1",
"Charlie 2", "Green 2",
},
[18] = {
"Alpha 1", "Red 1",
"Alpha 2", "Red 2",
"Alpha 3", "Red 3",
"Bravo 1", "Blue 1",
"Bravo 2", "Blue 2",
"Bravo 3", "Blue 3",
"Charlie 1", "Green 1",
"Charlie 2", "Green 2",
"Charlie 3", "Green 3",
},
[20] = {
"Alpha 1", "Red 1",
"Alpha 2", "Red 2",
"Alpha 3", "Red 3",
"Bravo 1", "Blue 1",
"Bravo 2", "Blue 2",
"Bravo 3", "Blue 3",
"Charlie 1", "Green 1",
"Charlie 2", "Green 2",
"Delta 1", "Yellow 1",
"Delta 2", "Yellow 2",
},
[22] = {
"Alpha 1", "Red 1",
"Alpha 2", "Red 2",
"Alpha 3", "Red 3",
"Bravo 1", "Blue 1",
"Bravo 2", "Blue 2",
"Bravo 3", "Blue 3",
"Charlie 1", "Green 1",
"Charlie 2", "Green 2",
"Charlie 3", "Green 3",
"Delta 1", "Yellow 1",
"Delta 2", "Yellow 2",
},
[24] = {
"Alpha 1", "Red 1",
"Alpha 2", "Red 2",
"Alpha 3", "Red 3",
"Bravo 1", "Blue 1",
"Bravo 2", "Blue 2",
"Bravo 3", "Blue 3",
"Charlie 1", "Green 1",
"Charlie 2", "Green 2",
"Charlie 3", "Green 3",
"Delta 1", "Yellow 1",
"Delta 2", "Yellow 2",
"Delta 3", "Yellow 3",
},
[26] = {
"Alpha 1", "Red 1",
"Alpha 2", "Red 2",
"Alpha 3", "Red 3",
"Alpha 4", "Red 4",
"Bravo 1", "Blue 1",
"Bravo 2", "Blue 2",
"Bravo 3", "Blue 3",
"Charlie 1", "Green 1",
"Charlie 2", "Green 2",
"Charlie 3", "Green 3",
"Delta 1", "Yellow 1",
"Delta 2", "Yellow 2",
"Delta 3", "Yellow 3",
},
[28] = {
"Alpha 1", "Red 1",
"Alpha 2", "Red 2",
"Alpha 3", "Red 3",
"Alpha 4", "Red 4",
"Bravo 1", "Blue 1",
"Bravo 2", "Blue 2",
"Bravo 3", "Blue 3",
"Bravo 4", "Blue 4",
"Charlie 1", "Green 1",
"Charlie 2", "Green 2",
"Charlie 3", "Green 3",
"Delta 1", "Yellow 1",
"Delta 2", "Yellow 2",
"Delta 3", "Yellow 3",
},
[30] = {
"Alpha 1", "Red 1",
"Alpha 2", "Red 2",
"Alpha 3", "Red 3",
"Alpha 4", "Red 4",
"Bravo 1", "Blue 1",
"Bravo 2", "Blue 2",
"Bravo 3", "Blue 3",
"Bravo 4", "Blue 4",
"Charlie 1", "Green 1",
"Charlie 2", "Green 2",
"Charlie 3", "Green 3",
"Charlie 4", "Green 4",
"Delta 1", "Yellow 1",
"Delta 2", "Yellow 2",
"Delta 3", "Yellow 3",
},
[32] = {
"Alpha 1", "Red 1",
"Alpha 2", "Red 2",
"Alpha 3", "Red 3",
"Alpha 4", "Red 4",
"Bravo 1", "Blue 1",
"Bravo 2", "Blue 2",
"Bravo 3", "Blue 3",
"Bravo 4", "Blue 4",
"Charlie 1", "Green 1",
"Charlie 2", "Green 2",
"Charlie 3", "Green 3",
"Charlie 4", "Green 4",
"Delta 1", "Yellow 1",
"Delta 2", "Yellow 2",
"Delta 3", "Yellow 3",
"Delta 4", "Yellow 4",
},
}
wingSquadronNames = false -- See GM button. Set to true to name ships alpha/bravo/charlie vs. red/blue/green etc.; set to false to use randomized names from a list
player_ship_stats = {
["MP52 Hornet"] = { strength = 7, cargo = 3, distance = 100, long_range_radar = 18000, short_range_radar = 4000, probes = 10, },
["Piranha"] = { strength = 16, cargo = 8, distance = 200, long_range_radar = 25000, short_range_radar = 6000, probes = 15, },
["Flavia P.Falcon"] = { strength = 13, cargo = 15, distance = 200, long_range_radar = 40000, short_range_radar = 5000, probes = 27 , },
["Phobos M3P"] = { strength = 19, cargo = 10, distance = 200, long_range_radar = 25000, short_range_radar = 5000, probes = 15, },
["Atlantis"] = { strength = 52, cargo = 6, distance = 400, long_range_radar = 30000, short_range_radar = 5000, probes = 25, },
["Player Cruiser"] = { strength = 40, cargo = 6, distance = 400, long_range_radar = 30000, short_range_radar = 5000, probes = 22, },
["Player Missile Cr."] = { strength = 45, cargo = 8, distance = 200, long_range_radar = 35000, short_range_radar = 6000, probes = 26, },
["Player Fighter"] = { strength = 7, cargo = 3, distance = 100, long_range_radar = 15000, short_range_radar = 4500, probes = 11, },
["Benedict"] = { strength = 10, cargo = 9, distance = 400, long_range_radar = 30000, short_range_radar = 5000, probes = 20, },
["Kiriya"] = { strength = 10, cargo = 9, distance = 400, long_range_radar = 35000, short_range_radar = 5000, probes = 20, },
["Striker"] = { strength = 8, cargo = 4, distance = 200, long_range_radar = 35000, short_range_radar = 5000, probes = 17, },
["ZX-Lindworm"] = { strength = 8, cargo = 3, distance = 100, long_range_radar = 18000, short_range_radar = 5500, probes = 12, },
["Repulse"] = { strength = 14, cargo = 12, distance = 200, long_range_radar = 38000, short_range_radar = 5000, probes = 35, },
["Ender"] = { strength = 100, cargo = 20, distance = 2000,long_range_radar = 45000, short_range_radar = 7000, probes = 24, },
["Nautilus"] = { strength = 12, cargo = 7, distance = 200, long_range_radar = 22000, short_range_radar = 4000, probes = 23, },
["Hathcock"] = { strength = 30, cargo = 6, distance = 200, long_range_radar = 35000, short_range_radar = 6000, probes = 20, },
["Maverick"] = { strength = 45, cargo = 5, distance = 200, long_range_radar = 20000, short_range_radar = 4000, probes = 18, },
["Crucible"] = { strength = 45, cargo = 5, distance = 200, long_range_radar = 20000, short_range_radar = 6000, probes = 20, },
}
tagDamage = 1.25 -- See GM button. Amount to subtract from jump/warp drive when tagged. Full health = 1
tag_distance = 750 -- See GM button. How far away to be considered tagged and returned to other side
hard_flag_reveal = true -- See GM button. On hard difficulty, will a flag pick up be revealed on main screen or not
side_destroyed_ends_game = true -- See GM button. If one side completely destroyed, will game end immediately or not (if not, set game time remaining to 60 seconds)
autoEnemies = false -- See GM button. Boolean default value for whether or not marauders spawn
interWave = 600 -- See GM button. Number of seconds between marauding enemy spawn waves, if that option is chosen
dynamicTerrain = nil -- this is a placeholder variable that needs to be set to a function call in the terrain setup function; see below
-- Choose the environment terrain! Uncomment the terrain type you wish to use and comment out the other(s).
-- !! Be sure the setup function sets the value of 'dynamicTerrain' to the function that takes terrain action
--terrainType = emptyTerrain -- for easy/testing purposes
--terrainType = defaultTerrain
--terrainType = justPassingBy
terrainType = randomSymmetric
terrain_type_name = "Symmetric"
terrain_choices = {
["Empty"] = emptyTerrain,
["Default"] = defaultTerrain,
["Passing"] = justPassingBy,
["Symmetric"] = randomSymmetric,
["Rabbit"] = downTheRabbitHole
}
-- Drone related global variables
dronesAreAllowed = true -- See GM button. The base boolean to turn on/off drone usage within the scenarios
uniform_drone_carrying_capacity = 50 -- See GM button. This is the max number of drones that can be carried by a playership; for the initial implementations, all player ships will have equal capacity
drone_name_type = "squad-num of size" -- See GM button. Valid values are "default" (use EE), "squad-num/size" (K), "short" (X preferred), "squad-num of size" (X alternate)
drone_modified_from_template = true -- See GM button. Boolean governing whether drone properties will be modified from their original template values
drone_hull_strength = 25 -- See GM button. Original: 30 drones do not have shields and only have their hull strength for defense; reasonable values should be from 25-75; obviously the higher the stronger
drone_impulse_speed = 120 -- See GM button. Original: 120 drones only have impulse engines, and usually tend to be faster because they are lighter and no living pilots required; reasonable values should be from 100-150
drone_beam_range = 700 -- See Gm button. Original: 600 the distance at which the drone can hit its target; reasonable values should be from 500-1000
drone_beam_damage = 8 -- See Gm button. Original: 6 drones have a single forward facing beam weapon; this sets the damage done by the beam; reasonable values should be from 5-10
drone_beam_cycle_time = 5 -- See Gm button. Original: 4 this is the number of seconds it takes for the beam weapon to recharge and to be able to fire again; reasonable values should be from 3-8
drone_flag_check_interval = 5 -- See GM button. How many seconds between each drone flag detection cycle
drone_message_reset_count = 8 -- See GM button. How many flag check intervals to wait before sending another message about a possible flag being detected
drone_formation_spacing = 5000 -- See GM button. How far apart drones travel when in formation (1000 = 1 unit)
drone_scan_range_for_flags = 7500 -- See GM button. How far away drones can "see" potential flags. Standard sensor range (aka sensor bubble) is 5 units (5000)
revisedPlayerShipProbeCount = 20 -- See GM button. The standard count of 8 just is not quite enough for this game, so we need to have an easy way to modify; all player ships will have this amount at game start
control_code_stem = { --All control codes must use capital letters or they will not work.
"ALWAYS",
"ASTRO",
"BLACK",
"BLANK",
"BLUE",
"BRIGHT",
"BROWN",
"CHAIN",
"CHURCH",
"CORNER",
"DARK",
"DOORWAY",
"DOUBLE",
"DULL",
"ELBOW",
"EMPTY",
"EPSILON",
"FAST",
"FLOWER",
"FLY",
"FROZEN",
"GIG",
"GREEN",
"GLOW",
"HAND",
"HAMMER",
"INK",
"INTEL",
"JOUST",
"JUMP",
"KEY",
"KINDLE",
"LAP",
"LETTER",
"LIST",
"MORNING",
"NEXT",
"OPEN",
"ORANGE",
"OUTSIDE",
"PURPLE",
"QUARTER",
"QUIET",
"RED",
"SHINE",
"SIGMA",
"STAR",
"STREET",
"TOKEN",
"THIRSTY",
"UNDER",
"VANISH",
"WHITE",
"WRENCH",
"YELLOW",
}
-- Variables and structures that *!MUST NOT!* be modified; these are necessary for managing game play
p1FlagDrop = false
p2FlagDrop = false
plotH = healthCheck
healthCheckTimer = 5
healthCheckTimerInterval = 5
plotW = marauderWaves
waveTimer = interWave
terrain_objects = {}
humanStationList = {}
kraylorStationList = {}
neutralStationList = {}
stationList = {}
human_player_names = {}
kraylor_player_names = {}
all_squad_count = 0
human_flags = {}
kraylor_flags = {}
-- 'stationZebra' is placed at position 0,0 and is present for all environment setups
stationZebra = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation):setPosition(0,0):setCallSign("Zebra"):setDescription("Referee")
table.insert(stationList,stationZebra)
-- the following tables are used for enemy marauding ships; the tables help plot arrival points for the marauding ships
-- square grid deployment
fleetPosDelta1x = {0,1,0,-1, 0,1,-1, 1,-1,2,0,-2, 0,2,-2, 2,-2,2, 2,-2,-2,1,-1, 1,-1}
fleetPosDelta1y = {0,0,1, 0,-1,1,-1,-1, 1,0,2, 0,-2,2,-2,-2, 2,1,-1, 1,-1,2, 2,-2,-2}
-- rough hexagonal deployment
fleetPosDelta2x = {0,2,-2,1,-1, 1, 1,4,-4,0, 0,2,-2,-2, 2,3,-3, 3,-3,6,-6,1,-1, 1,-1,3,-3, 3,-3,4,-4, 4,-4,5,-5, 5,-5}
fleetPosDelta2y = {0,0, 0,1, 1,-1,-1,0, 0,2,-2,2,-2, 2,-2,1,-1,-1, 1,0, 0,3, 3,-3,-3,3,-3,-3, 3,2,-2,-2, 2,1,-1,-1, 1}
missile_types = {'Homing', 'Nuke', 'Mine', 'EMP', 'HVLI'} -- am not sure why this has to be set but it was included so keeping it for now
-- the following are part of Xansta's larger overall bartering/crafting setup
goods = {} --overall tracking of goods;
tradeFood = {} --stations that will trade food for other goods;
tradeLuxury = {} --stations that will trade luxury for other goods;
tradeMedicine = {} --stations that will trade medicine for other goods;
-- convenience table for accessing drones
droneFleets = {}
boundary_beam_string = {
"beam_blue.png",
"beam_purple.png",
"beam_green.png"
}
boundary_marker = "buoys"
-- Initialization checklist by function
setVariations()
initializeDroneButtonFunctionTables()
setGMButtons()
setupTailoredShipAttributes() -- part of Xansta's larger overall script core for randomized stations and NPC ships
setupBarteringGoods() -- part of Xansta's larger overall bartering/crafting setup
setupPlacementRandomizationFunctions()
terrainType() -- sets up the environment terrain according to the choice above
plotTeamDemarcationLine()
plotFlagPlacementBoundaries()
storage = getScriptStorage()
storage.gatherStats = gatherStats
-- Print initialization items to console
wfv = "end of init"
print(" Initial Configuration:")
print(" Flag hiding time limit: " .. hideFlagTime/60 .. " minutes")
print(" Game Time Limit: " .. gameTimeLimit/60 .. " minutes")
-- print(" Terrain type: " .. tostring(terrainType))
print(" Scan probes allocated per ship: " .. revisedPlayerShipProbeCount)
print(" Are drones allowed? " .. tostring(dronesAreAllowed))
print(" (Uniform) Drone carrying capacity for player ships: " .. uniform_drone_carrying_capacity)
print(" Drone scanning range for flags/decoys: " .. drone_scan_range_for_flags)
print(" ")
print("----- All of the above initial configuration settings may be adjusted by GM button. ")
print("----- So don't count on these values to remain accurate")
end
------------------
-- GM Buttons --
------------------
function setGMButtons()
mainGMButtons = mainGMButtonsDuringPause
mainGMButtons()
end
function mainGMButtonsDuringPause()
clearGMFunctions()
addGMFunction(string.format("Version %s",scenario_version),function()
local version_message = string.format("Scenario version %s\n LUA version %s",scenario_version,_VERSION)
addGMMessage(version_message)
print(version_message)
end)
local button_label = "Turn on Diagnostic"
if diagnostic then
button_label = "Turn off Diagnostic"
end
addGMFunction(button_label,function()
if diagnostic then
diagnostic = false
else
diagnostic = true
end
mainGMButtons()
end)
addGMFunction(string.format("+Terrain: %s",terrain_type_name),setTerrain)
addGMFunction("+Player Config",playerConfig)
button_label = "Enable Auto-Enemies"
if autoEnemies then
button_label = "Disable Auto-Enemies"
end
addGMFunction(button_label,function()
if autoEnemies then
autoEnemies = false
else
autoEnemies = true
end
mainGMButtons()
end)
if autoEnemies then
addGMFunction(string.format("+Times G%i H%i E%i",gameTimeLimit/60,hideFlagTime/60,interWave/60),setGameTimeLimit)
else
addGMFunction(string.format("+Times G%i H%i",gameTimeLimit/60,hideFlagTime/60),setGameTimeLimit)
end
addGMFunction(string.format("Level: %s ->Next",difficulty_text),function()
if difficulty_text == "normal" then
difficulty_text = "hard"
difficulty = 2
flagScanDepth = math.random(1,3) --number of times to scan
flagScanComplexity = math.random(3,4) --number of bars in scan
elseif difficulty_text == "hard" then
difficulty_text = "easy"
difficulty = .5
flagScanDepth = 1 --number of times to scan
flagScanComplexity = math.random(1,2) --number of bars in scan
elseif difficulty_text == "easy" then
difficulty_text = "normal"
difficulty = 1
flagScanDepth = math.random(2,3) --number of times to scan
flagScanComplexity = 2 --number of bars in scan
end
mainGMButtons()
end)
if difficulty > 1 then
button_label = "Show Pick Up Off"
if hard_flag_reveal then
button_label = "Show Pick Up On"
end
addGMFunction(button_label,function()
if hard_flag_reveal then
hard_flag_reveal = false
else
hard_flag_reveal = true
end
mainGMButtons()
end)
end
button_label = "Destroy = end off"
if side_destroyed_ends_game then
button_label = "Destroy = end on"
end
addGMFunction(button_label,function()
if side_destroyed_ends_game then
side_destroyed_ends_game = false
else
side_destroyed_ends_game = true
end
mainGMButtons()
end)
addGMFunction(string.format("Marker: %s ->Next",boundary_marker),function()
if boundary_marker == "stars" then
boundary_marker = "buoys"
elseif boundary_marker == "buoys" then
boundary_marker = "none"
elseif boundary_marker == "none" then
boundary_marker = "stars"
end
plotTeamDemarcationLine()
plotFlagPlacementBoundaries()
mainGMButtons()
end)
addGMFunction("Player Prefs",function()
local out_message = "Remaining player preferences:"
print(out_message)
for i=1,#preset_players do
local item = preset_players[i]
local out = string.format("XO:%s",item.xo)
print(out)
out_message = out_message .. "\n" .. out
if item.faction ~= nil then
out = string.format(" Faction:%s",item.faction)
print(out)
out_message = out_message .. "\n" .. out
end
if item.ship_name ~= nil then
out = string.format(" Ship name:%s",item.ship_name)
print(out)
out_message = out_message .. "\n" .. out
end
if item.ship_pref_1 ~= nil then
out = string.format(" Ship preference 1:%s",item.ship_pref_1)
print(out)
out_message = out_message .. "\n" .. out
end
if item.ship_pref_2 ~= nil then
out = string.format(" Ship preference 2:%s",item.ship_pref_2)
print(out)
out_message = out_message .. "\n" .. out
end
if item.ship_pref_3 ~= nil then
out = string.format(" Ship preference 3:%s",item.ship_pref_3)
print(out)
out_message = out_message .. "\n" .. out
end
if item.ship_pref_4 ~= nil then
out = string.format(" Ship preference 4:%s",item.ship_pref_4)
print(out)
out_message = out_message .. "\n" .. out
end
if item.ship_pref_5 ~= nil then
out = string.format(" Ship preference 5:%s",item.ship_pref_5)
print(out)
out_message = out_message .. "\n" .. out
end
if item.ship_pref_6 ~= nil then
out = string.format(" Ship preference 6:%s",item.ship_pref_6)
print(out)
out_message = out_message .. "\n" .. out
end
end
addGMMessage(out_message)
end)
end
function setTerrain()
clearGMFunctions()
addGMFunction("-from Terrain",mainGMButtons)
addGMFunction(string.format("Size: %s -> Next",terrain_size),function()
if terrain_size == "medium" then
terrain_size = "large"
boundary = 200000
elseif terrain_size == "large" then
terrain_size = "small"
boundary = 50000
elseif terrain_size == "small" then
terrain_size = "medium"
boundary = 100000
end
if terrain_objects ~= nil and #terrain_objects > 0 then
for _, obj in pairs(terrain_objects) do
obj:destroy()
end
terrain_objects = {}
end
stationList = {}
humanStationList = {}
kraylorStationList = {}
neutralStationList = {}
setupPlacementRandomizationFunctions()
terrainType()
setTerrain()
plotFlagPlacementBoundaries()
end)
for name, terrain in pairs(terrain_choices) do
local button_name = name
if button_name == terrain_type_name then
button_name = button_name .. "*"
end
addGMFunction(button_name,function()
if terrain_objects ~= nil and #terrain_objects > 0 then
for _, obj in pairs(terrain_objects) do
obj:destroy()
end
terrain_objects = {}
end
terrain_type_name = name
terrainType = terrain
stationList = {}
humanStationList = {}
kraylorStationList = {}
neutralStationList = {}
setupPlacementRandomizationFunctions()
terrainType()
setTerrain()
end)
end
end
function plotTeamDemarcationLine()
if boundary_items == nil then
boundary_items = {}
else
if #boundary_items > 0 then
for _, item in ipairs(boundary_items) do
item:destroy()
end
boundary_items = {}
end
end
if boundary_marker == "stars" then
local demarcation_x_position = 0
local demarcation_y_position = 2500
local star = nil
for index=1,40 do
star = Planet():setPosition(demarcation_x_position, demarcation_y_position)
:setPlanetRadius(150)
:setDistanceFromMovementPlane(0)
:setPlanetSurfaceTexture("planets/star-1.png")
--:setPlanetAtmosphereTexture("planets/star-1.png")
:setPlanetAtmosphereColor(1.0,1.0,1.0)
:setAxialRotationTime(100)
table.insert(boundary_items,star)
demarcation_y_position = demarcation_y_position * -1
star = Planet():setPosition(demarcation_x_position, demarcation_y_position)
:setPlanetRadius(150)
:setDistanceFromMovementPlane(0)
:setPlanetSurfaceTexture("planets/star-1.png")
--:setPlanetAtmosphereTexture("planets/star-1.png")
:setPlanetAtmosphereColor(1.0,1.0,1.0)
:setAxialRotationTime(100)
table.insert(boundary_items,star)
demarcation_y_position = demarcation_y_position * -1
demarcation_y_position = demarcation_y_position + 5000
end
demarcation_y_position = 5000
for index=1,40 do
star = Planet():setPosition(demarcation_x_position, demarcation_y_position)
:setPlanetRadius(150)
:setDistanceFromMovementPlane(0)
:setPlanetSurfaceTexture("planets/planet-2.png")
:setPlanetAtmosphereColor(0.5,0,0)
:setAxialRotationTime(100)
table.insert(boundary_items,star)
demarcation_y_position = demarcation_y_position * -1
star = Planet():setPosition(demarcation_x_position, demarcation_y_position)
:setPlanetRadius(150)
:setDistanceFromMovementPlane(0)
:setPlanetSurfaceTexture("planets/planet-2.png")
:setPlanetAtmosphereColor(1.0,0,0)
:setAxialRotationTime(100)
table.insert(boundary_items,star)
demarcation_y_position = demarcation_y_position * -1
demarcation_y_position = demarcation_y_position + 5000
end
elseif boundary_marker == "buoys" then
buoy_beam_interval = 2
buoy_beam_timer = buoy_beam_interval
buoy_beam_count = 0
for i=1,80 do
table.insert(boundary_items,Artifact():allowPickup(false):setPosition(0,i*2500):setModel("SensorBuoyMKIII"):setRotation(90):setSpin(100):setCallSign("Marker Buoy"):setDescriptions("Territory boundary marker","A buoy placed on the line marking the boundary between Human and Kraylor territory"):setScanningParameters(1,1):setRadarSignatureInfo(.5,1,0))
table.insert(boundary_items,Artifact():allowPickup(false):setPosition(0,i*-2500):setModel("SensorBuoyMKIII"):setRotation(90):setSpin(100):setCallSign("Marker Buoy"):setDescriptions("Territory boundary marker","A buoy placed on the line marking the boundary between Human and Kraylor territory"):setScanningParameters(1,1):setRadarSignatureInfo(0,.5,1))
end
end
end
function plotFlagPlacementBoundaries()
if flag_area_boundary_items == nil then
flag_area_boundary_items = {}
else
if #flag_area_boundary_items > 0 then
for _, item in ipairs(flag_area_boundary_items) do
item:destroy()
end
flag_area_boundary_items = {}
end
end
if boundary_marker == "stars" or boundary_marker == "buoys" then
local index = 0
repeat
local temp_marker = nil
if index == 0 then
temp_marker = createBoundaryMarker(index,boundary/2) --middle of southern edge
table.insert(flag_area_boundary_items,temp_marker)
temp_marker = createBoundaryMarker(index,-boundary/2) --middle of northern edge
table.insert(flag_area_boundary_items,temp_marker)
temp_marker = createBoundaryMarker(boundary,index) --middle of eastern edge
table.insert(flag_area_boundary_items,temp_marker)
temp_marker = createBoundaryMarker(-boundary,index) --middle of western edge
table.insert(flag_area_boundary_items,temp_marker)
elseif index == boundary then
temp_marker = createBoundaryMarker(index,boundary/2) --southeast corner
table.insert(flag_area_boundary_items,temp_marker)
temp_marker = createBoundaryMarker(-index,-boundary/2) --northwest corner
table.insert(flag_area_boundary_items,temp_marker)
temp_marker = createBoundaryMarker(index,-boundary/2) --northeast corner
table.insert(flag_area_boundary_items,temp_marker)
temp_marker = createBoundaryMarker(-index,boundary/2) --southwest corner
table.insert(flag_area_boundary_items,temp_marker)
else
temp_marker = createBoundaryMarker(index,boundary/2) --eastern part of southern line
table.insert(flag_area_boundary_items,temp_marker)
temp_marker = createBoundaryMarker(-index,-boundary/2) --western part of northern line
table.insert(flag_area_boundary_items,temp_marker)
temp_marker = createBoundaryMarker(index,-boundary/2) --eastern part of northern line
table.insert(flag_area_boundary_items,temp_marker)
temp_marker = createBoundaryMarker(-index,boundary/2) --western part of southern line
table.insert(flag_area_boundary_items,temp_marker)
if index < boundary/2 then
temp_marker = createBoundaryMarker(boundary,index) --southern part of eastern line
table.insert(flag_area_boundary_items,temp_marker)
temp_marker = createBoundaryMarker(boundary,-index) --northern part of eastern line
table.insert(flag_area_boundary_items,temp_marker)
temp_marker = createBoundaryMarker(-boundary,-index)--northern part of western line
table.insert(flag_area_boundary_items,temp_marker)
temp_marker = createBoundaryMarker(-boundary,index) --southern part of western line
table.insert(flag_area_boundary_items,temp_marker)
end
end
index = index + 2500
until(index >= boundary)
end
end
function createBoundaryMarker(position_x, position_y)
local temp_marker = nil
if boundary_marker == "stars" then
temp_marker = Planet():setPosition(position_x, position_y)
:setPlanetRadius(200)
:setDistanceFromMovementPlane(0)
:setPlanetSurfaceTexture("planets/star-1.png")
:setPlanetAtmosphereColor(1.0,1.0,1.0)
elseif boundary_marker == "buoys" then
temp_marker = Artifact():allowPickup(false):setPosition(position_x,position_y):setModel("SensorBuoyMKIII"):setRotation(90):setSpin(50):setDescriptions("Flag hiding territory boundary marker","A temporary buoy placed on the edge of the territory where a flag or decoy may be hidden"):setScanningParameters(1,1):setRadarSignatureInfo(.3,.5,0)
end
return temp_marker
end
function playerConfig()
clearGMFunctions()
addGMFunction("-from Player Config",mainGMButtons)
addGMFunction("Show control codes",showControlCodes)
addGMFunction("Show Kraylor codes",showKraylorCodes)
addGMFunction("Show Human codes",showHumanCodes)
local button_label = "Wing Names Off"
if wingSquadronNames then
button_label = "Wing Names On"
end
addGMFunction(button_label,function()
if wingSquadronNames then
local p = getPlayerShip(-1)
if p ~= nil then
addGMMessage("Cannot disable wing names now that player ships have been spawned.\nClose the server and restart if you *really* don't want the wing names")
else
wingSquadronNames = false
end
else
wingSquadronNames = true
end
playerConfig()
end)
addGMFunction(string.format("+Tags %.2f, %.1fU",tagDamage,tag_distance/1000),setTagValues)
button_label = "+Drones Off"
if dronesAreAllowed then
button_label = "+Drones On"
end
addGMFunction(button_label,configureDrones)
--[[
local p = getPlayerShip(-1)
if p == nil then
addGMFunction(string.format("+Probes %i",revisedPlayerShipProbeCount),setPlayerProbes)
end
--]]
end
function setGameTimeLimit()
clearGMFunctions()
addGMFunction("-Main from times",mainGMButtons)
addGMFunction(string.format("Game %i Add 5 -> %i",gameTimeLimit/60,gameTimeLimit/60 + 5),function()
gameTimeLimit = gameTimeLimit + 300
maxGameTime = gameTimeLimit
setGameTimeLimit()
end)
if gameTimeLimit > (hideFlagTime + 300) then
addGMFunction(string.format("Game %i Del 5 -> %i",gameTimeLimit/60,gameTimeLimit/60 - 5),function()
gameTimeLimit = gameTimeLimit - 300
maxGameTime = gameTimeLimit
setGameTimeLimit()
end)
end
if hideFlagTime < (gameTimeLimit - 300) then
addGMFunction(string.format("Hide Flag %i Add 5 -> %i",hideFlagTime/60,hideFlagTime/60 + 5),function()
hideFlagTime = hideFlagTime + 300
setGameTimeLimit()
end)
end
if hideFlagTime > 300 then
addGMFunction(string.format("Hide Flag %i Del 5 -> %i",hideFlagTime/60,hideFlagTime/60 - 5),function()
hideFlagTime = hideFlagTime - 300
setGameTimeLimit()
end)
elseif hideFlagTime > 60 then
addGMFunction(string.format("Hide Flag %i Del 4 -> %i",hideFlagTime/60,hideFlagTime/60 - 4),function()
hideFlagTime = hideFlagTime - 240
setGameTimeLimit()
end)
end
if autoEnemies then
if interWave < 1200 then
addGMFunction(string.format("Enemy %i Add 1 -> %i",interWave/60,(interWave + 60)/60),function()
interWave = interWave + 60
setGameTimeLimit()
end)
end
if interWave > 120 then
addGMFunction(string.format("Enemy %i Del 1 -> %i",interWave/60,(interWave - 60)/60),function()
interWave = interWave - 60
setGameTimeLimit()
end)
end
end
end
function setTagValues()
clearGMFunctions()
addGMFunction("-Main from Tag",mainGMButtons)
addGMFunction("-Player Config",playerConfig)
addGMFunction(string.format("+Tag distance %.1fU",tag_distance/1000),setTagDistance)
addGMFunction(string.format("+Tag damage %.2f",tagDamage),setTagDamage)
end
function configureDrones()
clearGMFunctions()
addGMFunction("-From Drones",playerConfig)
local button_label = "Drones Off"
if dronesAreAllowed then
button_label = "Drones On"
end
addGMFunction(button_label,function()
if dronesAreAllowed then
dronesAreAllowed = false
else
dronesAreAllowed = true
end
configureDrones()
end)
if dronesAreAllowed then
addGMFunction(string.format("+Capacity %i",uniform_drone_carrying_capacity),setDroneCarryingCapacity)
addGMFunction(string.format("Name %s",drone_name_type),function()
if drone_name_type == "squad-num of size" then
drone_name_type = "default"
elseif drone_name_type == "default" then
drone_name_type = "squad-num/size"
elseif drone_name_type == "squad-num/size" then
drone_name_type = "short"
elseif drone_name_type == "short" then
drone_name_type = "squad-num of size"
end
configureDrones()
end)
addGMFunction(string.format("+Flag I%i M%i",drone_flag_check_interval,drone_message_reset_count),setDroneFlagValues)
addGMFunction(string.format("+Distance F%.1fU S%.1fU",drone_formation_spacing/1000,drone_scan_range_for_flags/1000),setDroneDistances)
button_label = "Template Mod Off"
if drone_modified_from_template then
button_label = "Template Mod On"
end