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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
|
global function GamemodeFD_Init
global function RateSpawnpoints_FD
global function startHarvester
global function GetTargetNameForID
global function DisableTitanSelection
global function DisableTitanSelectionForPlayer
global function EnableTitanSelection
global function EnableTitanSelectionForPlayer
struct player_struct_fd{
bool diedThisRound
int scoreThisRound
int totalMVPs
int mortarUnitsKilled
int moneySpend
int coresUsed
float longestTitanLife //not implemented yet
int turretsRepaired //not implemented yet
int moneyShared
float timeNearHarvester //dont know how to track
float longestLife
int heals //dont know what to track
int titanKills
float damageDealt
int harvesterHeals
float lastRespawn
}
global HarvesterStruct& fd_harvester
global vector shopPosition
global vector shopAngles = <0,0,0>
global table<string,array<vector> > routes
global array<entity> routeNodes
global array<entity> spawnedNPCs
struct {
array<entity> aiSpawnpoints
array<entity> smokePoints
array<float> harvesterDamageSource
bool havesterWasDamaged
bool harvesterShieldDown
float harvesterDamageTaken
table<entity,player_struct_fd> players
entity harvester_info
}file
void function GamemodeFD_Init()
{
PrecacheModel( MODEL_ATTRITION_BANK )
PrecacheModel( $"models/humans/grunts/imc_grunt_shield_captain.mdl" )
PrecacheParticleSystem($"P_smokescreen_FD")
RegisterSignal( "SniperSwitchedEnemy" ) // for use in SniperTitanThink behavior.
RegisterSignal("FD_ReachedHarvester")
RegisterSignal("OnFailedToPath")
SetRoundBased(true)
SetShouldUseRoundWinningKillReplay(false)
Riff_ForceBoostAvailability( eBoostAvailability.Disabled )
PlayerEarnMeter_SetEnabled(false)
SetShouldUsePickLoadoutScreen( true )
//general Callbacks
AddCallback_EntitiesDidLoad(LoadEntities)
AddCallback_GameStateEnter(eGameState.Prematch,FD_createHarvester)
AddCallback_GameStateEnter( eGameState.Playing,startMainGameLoop)
AddCallback_OnRoundEndCleanup(FD_NPCCleanup)
AddCallback_OnClientConnected(GamemodeFD_InitPlayer)
//Damage Callbacks
AddDamageByCallback("player",FD_DamageByPlayerCallback)
AddDamageCallback( "player", DamageScaleByDifficulty )
AddDamageCallback( "npc_titan", DamageScaleByDifficulty )
AddDamageCallback( "npc_turret_sentry", DamageScaleByDifficulty )
AddDamageCallback( "npc_turret_sentry",RevivableTurret_DamageCallback)
//Spawn Callbacks
AddSpawnCallback( "npc_titan", HealthScaleByDifficulty )
AddSpawnCallback( "npc_super_spectre", HealthScaleByDifficulty )
AddSpawnCallback( "player", FD_PlayerRespawnCallback )
AddSpawnCallback("npc_turret_sentry", AddTurretSentry )
//death Callbacks
AddCallback_OnNPCKilled(OnNpcDeath)
AddCallback_OnPlayerKilled(GamemodeFD_OnPlayerKilled)
//Command Callbacks
AddClientCommandCallback("FD_ToggleReady",ClientCommandCallbackToggleReady)
AddClientCommandCallback("FD_UseHarvesterShieldBoost",useShieldBoost)
//shop Callback
SetBoostPurchaseCallback(FD_BoostPurchaseCallback)
SetTeamReserveInteractCallback(FD_TeamReserveDepositOrWithdrawCallback)
//earn meter
ScoreEvent_SetupEarnMeterValuesForMixedModes()
}
void function FD_BoostPurchaseCallback(entity player,BoostStoreData data)
{
file.players[player].moneySpend += data.cost
}
void function FD_PlayerRespawnCallback(entity player)
{
if(player in file.players)
file.players[player].lastRespawn = Time()
Highlight_SetFriendlyHighlight( player, "sp_friendly_hero" )
}
void function FD_TeamReserveDepositOrWithdrawCallback(entity player, string action,int amount)
{
switch(action)
{
case"deposit":
file.players[player].moneyShared += amount
break
case"withdraw":
file.players[player].moneyShared -= amount
break
}
}
void function GamemodeFD_OnPlayerKilled(entity victim, entity attacker, var damageInfo)
{
file.players[victim].longestLife = Time() - file.players[victim].lastRespawn
file.players[victim].diedThisRound = true
array<entity> militiaplayers = GetPlayerArrayOfTeam( TEAM_MILITIA )
int deaths = 0
foreach (entity player in militiaplayers)
if (!IsAlive(player))
deaths++
foreach( entity player in GetPlayerArray() )
{
if (player == victim || player.GetTeam() != TEAM_MILITIA)
continue
if (deaths == 1) // only one pilot died
PlayFactionDialogueToPlayer( "fd_singlePilotDown", player )
else if (deaths > 1 && deaths < militiaplayers.len() - 1) // multiple pilots died but at least one alive
PlayFactionDialogueToPlayer( "fd_multiPilotDown", player )
else if (deaths == militiaplayers.len() - 1) // ur shit out of luck ur the only survivor
PlayFactionDialogueToPlayer( "fd_onlyPlayerIsAlive", player )
}
}
void function FD_UsedCoreCallback(entity titan,entity weapon)
{
if(!(titan in file.players))
{
return
}
file.players[titan].coresUsed += 1
}
void function GamemodeFD_InitPlayer(entity player)
{
player_struct_fd data
data.diedThisRound = false
file.players[player] <- data
thread SetTurretSettings_threaded(player)
if(GetGlobalNetInt("FD_currentWave")>1)
PlayerEarnMeter_AddEarnedAndOwned(player,1.0,1.0)
if ( GetGlobalNetInt("FD_currentWave") != 0 )
DisableTitanSelectionForPlayer( player ) // this might need moving to when they exit the titan selection UI when we do that
else
EnableTitanSelectionForPlayer( player )
if ( GetGlobalNetInt("FD_currentWave") != 0 )
DisableTitanSelectionForPlayer( player ) // this might need moving to when they exit the titan selection UI when we do that
else
EnableTitanSelectionForPlayer( player )
}
void function SetTurretSettings_threaded(entity player)
{ //has to be delayed because PlayerConnect callbacks get called in wrong order
WaitFrame()
DeployableTurret_SetAISettingsForPlayer_AP(player,"npc_turret_sentry_burn_card_ap_fd")
DeployableTurret_SetAISettingsForPlayer_AT(player,"npc_turret_sentry_burn_card_at_fd")
}
void function OnNpcDeath( entity victim, entity attacker, var damageInfo )
{
if(victim.IsTitan()&&attacker in file.players)
file.players[attacker].titanKills++
int victimTypeID = FD_GetAITypeID_ByString(victim.GetTargetName())
if(victimTypeID == eFD_AITypeIDs.TITAN_MORTAR||victimTypeID == eFD_AITypeIDs.SPECTRE_MORTAR)
if(attacker in file.players)
file.players[attacker].mortarUnitsKilled++
int findIndex = spawnedNPCs.find( victim )
if ( findIndex != -1 )
{
spawnedNPCs.remove( findIndex )
string netIndex = GetAiNetIdFromTargetName(victim.GetTargetName())
if(netIndex != "")
SetGlobalNetInt(netIndex,GetGlobalNetInt(netIndex)-1)
SetGlobalNetInt("FD_AICount_Current",GetGlobalNetInt("FD_AICount_Current")-1)
}
if ( victim.GetOwner() == attacker || !attacker.IsPlayer() || attacker == victim || victim.GetBossPlayer() == attacker || victim.GetClassName() == "npc_turret_sentry" )
return
int playerScore = 0
int money = 0
int scriptDamageType = DamageInfo_GetCustomDamageType( damageInfo )
int damageSourceId = DamageInfo_GetDamageSourceIdentifier( damageInfo )
if ( victim.IsNPC() )
{
string eventName = FD_GetScoreEventName( victim.GetClassName() )
playerScore = ScoreEvent_GetPointValue( GetScoreEvent( eventName ) )
switch (victim.GetClassName())
{
case "npc_soldier":
money = 5
break
case "npc_drone":
case "npc_spectre":
money = 10
break
case "npc_stalker":
money = 15
break
case "npc_super_spectre":
money = 20
break
default:
money = 0 // titans seem to total up to 50 money undoomed health
}
foreach(player in GetPlayerArray())
Remote_CallFunction_NonReplay( player, "ServerCallback_OnTitanKilled", attacker.GetEncodedEHandle(), victim.GetEncodedEHandle(), scriptDamageType, damageSourceId )
}
if (money != 0)
AddMoneyToPlayer( attacker , money )
attacker.AddToPlayerGameStat( PGS_ASSAULT_SCORE, playerScore ) // seems to be how combat score is counted
file.players[attacker].scoreThisRound += playerScore
table<int, bool> alreadyAssisted
foreach( DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory )
{
if ( !IsValid( attackerInfo.attacker ) || !attackerInfo.attacker.IsPlayer() || attackerInfo.attacker == victim )
continue
bool exists = attackerInfo.attacker.GetEncodedEHandle() in alreadyAssisted ? true : false
if( attackerInfo.attacker != attacker && !exists )
{
alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true
attackerInfo.attacker.AddToPlayerGameStat( PGS_DEFENSE_SCORE, playerScore ) // i assume this is how support score gets added
}
}
}
void function RateSpawnpoints_FD(int _0, array<entity> _1, int _2, entity _3){}
bool function useShieldBoost(entity player,array<string> args)
{
if((GetGlobalNetTime("FD_harvesterInvulTime")<Time())&&(player.GetPlayerNetInt("numHarvesterShieldBoost")>0))
{
fd_harvester.harvester.SetShieldHealth(fd_harvester.harvester.GetShieldHealthMax())
SetGlobalNetTime("FD_harvesterInvulTime",Time()+5)
MessageToTeam(TEAM_MILITIA,eEventNotifications.FD_PlayerHealedHarvester, null, player)
player.SetPlayerNetInt( "numHarvesterShieldBoost", player.GetPlayerNetInt( "numHarvesterShieldBoost" ) - 1 )
file.players[player].harvesterHeals += 1
}
return true
}
void function startMainGameLoop()
{
thread mainGameLoop()
}
void function mainGameLoop()
{
startHarvester()
bool showShop = false
for(int i = GetGlobalNetInt("FD_currentWave");i<waveEvents.len();i++)
{
if(!runWave(i,showShop))
break
if(i==0)
{
PlayerEarnMeter_SetEnabled(true)
showShop = true
foreach(entity player in GetPlayerArray())
{
PlayerEarnMeter_AddEarnedAndOwned(player,1.0,1.0)
}
DisableTitanSelection()
}
else if (i + 1 == waveEvents.len() )
{
EnableTitanSelection()
}
}
}
array<int> function getHighestEnemyAmountsForWave(int waveIndex)
{
table<int,int> npcs
npcs[eFD_AITypeIDs.TITAN]<-0
npcs[eFD_AITypeIDs.TITAN_NUKE]<-0
npcs[eFD_AITypeIDs.TITAN_ARC]<-0
npcs[eFD_AITypeIDs.TITAN_MORTAR]<-0
npcs[eFD_AITypeIDs.GRUNT]<-0
npcs[eFD_AITypeIDs.SPECTRE]<-0
npcs[eFD_AITypeIDs.SPECTRE_MORTAR]<-0
npcs[eFD_AITypeIDs.STALKER]<-0
npcs[eFD_AITypeIDs.REAPER]<-0
npcs[eFD_AITypeIDs.TICK]<-0
npcs[eFD_AITypeIDs.DRONE]<-0
npcs[eFD_AITypeIDs.DRONE_CLOAK]<-0
// npcs[eFD_AITypeIDs.RONIN]<-0
// npcs[eFD_AITypeIDs.NORTHSTAR]<-0
// npcs[eFD_AITypeIDs.SCORCH]<-0
// npcs[eFD_AITypeIDs.LEGION]<-0
// npcs[eFD_AITypeIDs.TONE]<-0
// npcs[eFD_AITypeIDs.ION]<-0
// npcs[eFD_AITypeIDs.MONARCH]<-0
// npcs[eFD_AITypeIDs.TITAN_SNIPER]<-0
foreach(WaveEvent e in waveEvents[waveIndex])
{
if(e.spawnEvent.spawnAmount==0)
continue
switch(e.spawnEvent.spawnType)
{
case(eFD_AITypeIDs.TITAN):
case(eFD_AITypeIDs.RONIN):
case(eFD_AITypeIDs.NORTHSTAR):
case(eFD_AITypeIDs.SCORCH):
case(eFD_AITypeIDs.TONE):
case(eFD_AITypeIDs.ION):
case(eFD_AITypeIDs.MONARCH):
case(eFD_AITypeIDs.LEGION):
case(eFD_AITypeIDs.TITAN_SNIPER):
npcs[eFD_AITypeIDs.TITAN]+=e.spawnEvent.spawnAmount
break
default:
npcs[e.spawnEvent.spawnType]+=e.spawnEvent.spawnAmount
}
}
array<int> ret = [-1,-1,-1,-1,-1,-1,-1,-1,-1]
foreach(int key,int value in npcs)
{
if(value==0)
continue
int lowestArrayIndex = 0
bool keyIsSet = false
foreach(index,int arrayValue in ret)
{
if(arrayValue==-1)
{
ret[index] = key
keyIsSet = true
break
}
if(npcs[ret[lowestArrayIndex]]>npcs[ret[index]])
lowestArrayIndex = index
}
if((!keyIsSet)&&(npcs[ret[lowestArrayIndex]]<value))
ret[lowestArrayIndex] = key
}
foreach(int val in ret){
printt("ArrayVal",val)
}
return ret
}
void function SetEnemyAmountNetVars(int waveIndex)
{
int total = 0
table<int,int> npcs
npcs[eFD_AITypeIDs.TITAN]<-0
npcs[eFD_AITypeIDs.TITAN_NUKE]<-0
npcs[eFD_AITypeIDs.TITAN_ARC]<-0
npcs[eFD_AITypeIDs.TITAN_MORTAR]<-0
npcs[eFD_AITypeIDs.GRUNT]<-0
npcs[eFD_AITypeIDs.SPECTRE]<-0
npcs[eFD_AITypeIDs.SPECTRE_MORTAR]<-0
npcs[eFD_AITypeIDs.STALKER]<-0
npcs[eFD_AITypeIDs.REAPER]<-0
npcs[eFD_AITypeIDs.TICK]<-0
npcs[eFD_AITypeIDs.DRONE]<-0
npcs[eFD_AITypeIDs.DRONE_CLOAK]<-0
// npcs[eFD_AITypeIDs.RONIN]<-0
// npcs[eFD_AITypeIDs.NORTHSTAR]<-0
// npcs[eFD_AITypeIDs.SCORCH]<-0
// npcs[eFD_AITypeIDs.LEGION]<-0
// npcs[eFD_AITypeIDs.TONE]<-0
// npcs[eFD_AITypeIDs.ION]<-0
// npcs[eFD_AITypeIDs.MONARCH]<-0
// npcs[eFD_AITypeIDs.TITAN_SNIPER]<-0
foreach(WaveEvent e in waveEvents[waveIndex])
{
if(e.spawnEvent.spawnAmount==0)
continue
switch(e.spawnEvent.spawnType)
{
case(eFD_AITypeIDs.TITAN):
case(eFD_AITypeIDs.RONIN):
case(eFD_AITypeIDs.NORTHSTAR):
case(eFD_AITypeIDs.SCORCH):
case(eFD_AITypeIDs.TONE):
case(eFD_AITypeIDs.ION):
case(eFD_AITypeIDs.MONARCH):
case(eFD_AITypeIDs.LEGION):
case(eFD_AITypeIDs.TITAN_SNIPER):
npcs[eFD_AITypeIDs.TITAN]+=e.spawnEvent.spawnAmount
break
default:
npcs[e.spawnEvent.spawnType]+=e.spawnEvent.spawnAmount
}
total+= e.spawnEvent.spawnAmount
}
SetGlobalNetInt("FD_AICount_Titan",npcs[eFD_AITypeIDs.TITAN])
SetGlobalNetInt("FD_AICount_Titan_Nuke",npcs[eFD_AITypeIDs.TITAN_NUKE])
SetGlobalNetInt("FD_AICount_Titan_Mortar",npcs[eFD_AITypeIDs.TITAN_MORTAR])
SetGlobalNetInt("FD_AICount_Titan_Arc",npcs[eFD_AITypeIDs.TITAN_ARC])
SetGlobalNetInt("FD_AICount_Grunt",npcs[eFD_AITypeIDs.GRUNT])
SetGlobalNetInt("FD_AICount_Spectre",npcs[eFD_AITypeIDs.SPECTRE])
SetGlobalNetInt("FD_AICount_Spectre_Mortar",npcs[eFD_AITypeIDs.SPECTRE_MORTAR])
SetGlobalNetInt("FD_AICount_Stalker",npcs[eFD_AITypeIDs.STALKER])
SetGlobalNetInt("FD_AICount_Reaper",npcs[eFD_AITypeIDs.REAPER])
SetGlobalNetInt("FD_AICount_Ticks",npcs[eFD_AITypeIDs.TICK])
SetGlobalNetInt("FD_AICount_Drone",npcs[eFD_AITypeIDs.DRONE])
SetGlobalNetInt("FD_AICount_Drone_Cloak",npcs[eFD_AITypeIDs.DRONE_CLOAK])
SetGlobalNetInt("FD_AICount_Current",total)
SetGlobalNetInt("FD_AICount_Total",total)
}
bool function runWave(int waveIndex,bool shouldDoBuyTime)
{
SetGlobalNetInt("FD_currentWave",waveIndex)
file.havesterWasDamaged = false
file.harvesterShieldDown = false
SetEnemyAmountNetVars(waveIndex)
for(int i = 0; i<20;i++)//Number of npc type ids
{
file.harvesterDamageSource.append(0.0)
}
foreach(entity player in GetPlayerArray())
{
file.players[player].diedThisRound = false
file.players[player].scoreThisRound = 0
}
array<int> enemys = getHighestEnemyAmountsForWave(waveIndex)
foreach(entity player in GetPlayerArray())
{
Remote_CallFunction_NonReplay(player,"ServerCallback_FD_AnnouncePreParty",enemys[0],enemys[1],enemys[2],enemys[3],enemys[4],enemys[5],enemys[6],enemys[7],enemys[8])
}
if(shouldDoBuyTime)
{
SetGlobalNetInt("FD_waveState",WAVE_STATE_BREAK)
OpenBoostStores()
foreach(entity player in GetPlayerArray())
Remote_CallFunction_NonReplay(player,"ServerCallback_FD_NotifyStoreOpen")
while(Time()<GetGlobalNetTime("FD_nextWaveStartTime"))
{
if(allPlayersReady())
SetGlobalNetTime("FD_nextWaveStartTime",Time())
WaitFrame()
}
CloseBoostStores()
MessageToTeam(TEAM_MILITIA,eEventNotifications.FD_StoreClosing)
}
//SetGlobalNetTime("FD_nextWaveStartTime",Time()+10)
wait 10
SetGlobalNetInt("FD_waveState",WAVE_STATE_INCOMING)
foreach(entity player in GetPlayerArray())
{
Remote_CallFunction_NonReplay(player,"ServerCallback_FD_ClearPreParty")
player.SetPlayerNetBool("FD_readyForNextWave",false)
}
SetGlobalNetBool("FD_waveActive",true)
MessageToTeam(TEAM_MILITIA,eEventNotifications.FD_AnnounceWaveStart)
SetGlobalNetInt("FD_waveState",WAVE_STATE_BREAK)
//main wave loop
thread SetWaveStateReady()
executeWave()
SetGlobalNetInt("FD_waveState",WAVE_STATE_COMPLETE)
if(!IsAlive(fd_harvester.harvester))
{
float totalDamage = 0.0
array<float> highestDamage = [0.0,0.0,0.0]
array<int> highestDamageSource = [-1,-1,-1]
foreach(index,float damage in file.harvesterDamageSource)
{
totalDamage += damage
if(highestDamage[0]<damage)
{
highestDamage[2] = highestDamage[1]
highestDamageSource[2] = highestDamageSource[1]
highestDamage[1] = highestDamage[0]
highestDamageSource[1] = highestDamageSource[0]
highestDamageSource[0] = index
highestDamage[0] = damage
}
else if(highestDamage[1]<damage)
{
highestDamage[2] = highestDamage[1]
highestDamageSource[2] = highestDamageSource[1]
highestDamage[1] = damage
highestDamageSource[1] = index
}
else if(highestDamage[2]<damage)
{
highestDamage[2] = damage
highestDamageSource[2] = index
}
}
foreach(entity player in GetPlayerArray())
{
Remote_CallFunction_NonReplay(player,"ServerCallback_FD_DisplayHarvesterKiller",GetGlobalNetInt("FD_restartsRemaining"),getHintForTypeId(highestDamageSource[0]),highestDamageSource[0],highestDamage[0]/totalDamage,highestDamageSource[1],highestDamage[1]/totalDamage,highestDamageSource[2],highestDamage[2]/totalDamage)
}
if(GetGlobalNetInt("FD_restartsRemaining")>0)
FD_DecrementRestarts()
else
SetRoundBased(false)
SetWinner(TEAM_IMC)//restart round
spawnedNPCs = [] // reset npcs count
restetWaveEvents()
foreach(player in GetPlayerArray())
PlayerEarnMeter_AddEarnedAndOwned(player,1.0,1.0)
return false
}
wait 2
//wave end
SetGlobalNetBool("FD_waveActive",false)
MessageToTeam(TEAM_MILITIA,eEventNotifications.FD_AnnounceWaveEnd)
if ( isFinalWave() && IsAlive( fd_harvester.harvester ) )
{
//Game won code
MessageToTeam(TEAM_MILITIA,eEventNotifications.FD_AnnounceWaveEnd)
foreach(entity player in GetPlayerArray())
{
AddPlayerScore(player,"FDTeamWave")
}
wait 1
int highestScore = 0;
entity highestScore_player = GetPlayerArray()[0]
foreach(entity player in GetPlayerArray())
{
if(!file.players[player].diedThisRound)
AddPlayerScore(player,"FDDidntDie")
if(highestScore<file.players[player].scoreThisRound)
{
highestScore = file.players[player].scoreThisRound
highestScore_player = player
}
}
file.players[highestScore_player].totalMVPs += 1
AddPlayerScore(highestScore_player,"FDWaveMVP")
wait 1
foreach(entity player in GetPlayerArray())
if(!file.havesterWasDamaged)
AddPlayerScore(player,"FDTeamFlawlessWave")
SetRoundBased(false)
SetWinner(TEAM_MILITIA)
PlayFactionDialogueToTeam( "fd_matchVictory", TEAM_MILITIA )
return true
}
if(!file.havesterWasDamaged)
{
PlayFactionDialogueToTeam( "fd_waveRecapPerfect", TEAM_MILITIA )
wait 5
}
else
{
float damagepercent = ( ( file.harvesterDamageTaken / fd_harvester.harvester.GetMaxHealth().tofloat() ) * 100 )
float healthpercent = ( ( fd_harvester.harvester.GetHealth().tofloat() / fd_harvester.harvester.GetMaxHealth() ) * 100 )
if (damagepercent < 5) // if less than 5% damage taken
PlayFactionDialogueToTeam( "fd_waveRecapNearPerfect", TEAM_MILITIA )
else if ( healthpercent < 15 ) // if less than 15% health remains and more than 5% damage taken
PlayFactionDialogueToTeam( "fd_waveRecapLowHealth", TEAM_MILITIA )
wait 5
}
if ( isSecondWave() )
{
// supposed to add dialogues like "GOOD WORK TEAM" then "YOUR TITAN IS READY"
// done ^
PlayFactionDialogueToTeam( "fd_titanReadyNag" , TEAM_MILITIA )
wait 5
}
//Player scoring
MessageToTeam(TEAM_MILITIA,eEventNotifications.FD_NotifyWaveBonusIncoming)
wait 2
foreach(entity player in GetPlayerArray())
{
if (isSecondWave())
PlayFactionDialogueToPlayer( "fd_wavePayoutFirst", player )
else
PlayFactionDialogueToPlayer( "fd_wavePayoutAddtnl", player )
AddPlayerScore(player,"FDTeamWave")
AddMoneyToPlayer(player,GetCurrentPlaylistVarInt("fd_money_per_round",600))
// this function is called "Set" but in reality it is "Add"
SetJoinInProgressBonus( GetCurrentPlaylistVarInt("fd_money_per_round",600) )
EmitSoundOnEntityOnlyToPlayer(player,player,"HUD_MP_BountyHunt_BankBonusPts_Deposit_Start_1P")
}
wait 1
int highestScore = 0;
entity highestScore_player = GetPlayerArray()[0]
foreach(entity player in GetPlayerArray())
{
if(!file.players[player].diedThisRound)
{
AddPlayerScore(player,"FDDidntDie")
player.AddToPlayerGameStat( PGS_ASSAULT_SCORE, FD_SCORE_DIDNT_DIE )
}
AddMoneyToPlayer(player,100)
EmitSoundOnEntityOnlyToPlayer(player,player,"HUD_MP_BountyHunt_BankBonusPts_Deposit_Start_1P")
if(highestScore<file.players[player].scoreThisRound)
{
highestScore = file.players[player].scoreThisRound
highestScore_player = player
}
}
wait 1
file.players[highestScore_player].totalMVPs += 1
AddPlayerScore(highestScore_player,"FDWaveMVP")
AddMoneyToPlayer(highestScore_player,100)
highestScore_player.AddToPlayerGameStat( PGS_ASSAULT_SCORE, FD_SCORE_MVP )
EmitSoundOnEntityOnlyToPlayer(highestScore_player,highestScore_player,"HUD_MP_BountyHunt_BankBonusPts_Deposit_Start_1P")
foreach(entity player in GetPlayerArray())
{
Remote_CallFunction_NonReplay(player,"ServerCallback_FD_NotifyMVP",highestScore_player.GetEncodedEHandle())
}
wait 1
foreach(entity player in GetPlayerArray())
{
if(!file.havesterWasDamaged)
{
AddPlayerScore(player,"FDTeamFlawlessWave")
AddMoneyToPlayer(player,100)
player.AddToPlayerGameStat( PGS_ASSAULT_SCORE, FD_SCORE_TEAM_FLAWLESS_WAVE )
EmitSoundOnEntityOnlyToPlayer(player,player,"HUD_MP_BountyHunt_BankBonusPts_Deposit_Start_1P")
}
}
wait 1
if(waveIndex<waveEvents.len())
SetGlobalNetTime("FD_nextWaveStartTime",Time()+75)
return true
}
void function SetWaveStateReady(){
wait 5
SetGlobalNetInt("FD_waveState",WAVE_STATE_IN_PROGRESS)
}
void function gameWonMedals(){
table<string,entity> medals
//most mvps
}
void function OnHarvesterDamaged(entity harvester, var damageInfo)
{
if ( !IsValid( harvester ) )
return
if( fd_harvester.harvester != harvester )
return
if ( GetGlobalNetTime( "FD_harvesterInvulTime" ) > Time() )
{
harvester.SetShieldHealth( harvester.GetShieldHealthMax() )
return
}
int damageSourceID = DamageInfo_GetDamageSourceIdentifier( damageInfo )
entity attacker = DamageInfo_GetAttacker( damageInfo )
float damageAmount = DamageInfo_GetDamage( damageInfo )
if ( !damageSourceID && !damageAmount && !attacker )
return
fd_harvester.lastDamage = Time()
damageAmount = (damageAmount * GetCurrentPlaylistVarFloat("fd_player_damage_scalar",1.0))
float shieldPercent = ( (harvester.GetShieldHealth().tofloat() / harvester.GetShieldHealthMax()) * 100 )
if ( shieldPercent < 100 && !file.harvesterShieldDown)
PlayFactionDialogueToTeam( "fd_baseShieldTakingDmg", TEAM_MILITIA )
if ( shieldPercent < 35 && !file.harvesterShieldDown) // idk i made this up
PlayFactionDialogueToTeam( "fd_baseShieldLow", TEAM_MILITIA )
if ( harvester.GetShieldHealth() == 0 )
{
if( !file.harvesterShieldDown )
{
PlayFactionDialogueToTeam( "fd_baseShieldDown", TEAM_MILITIA )
file.harvesterShieldDown = true // prevent shield dialogues from repeating
}
file.harvesterDamageTaken = file.harvesterDamageTaken + damageAmount // track damage for wave recaps
float newHealth = harvester.GetHealth() - damageAmount
float oldhealthpercent = ( ( harvester.GetHealth().tofloat() / harvester.GetMaxHealth() ) * 100 )
float healthpercent = ( ( newHealth / harvester.GetMaxHealth() ) * 100 )
if (healthpercent <= 75 && oldhealthpercent > 75) // we don't want the dialogue to keep saying "Harvester is below 75% health" everytime they take additional damage
PlayFactionDialogueToTeam( "fd_baseHealth75", TEAM_MILITIA )
if (healthpercent <= 50 && oldhealthpercent > 50)
PlayFactionDialogueToTeam( "fd_baseHealth50", TEAM_MILITIA )
if (healthpercent <= 25 && oldhealthpercent > 25)
PlayFactionDialogueToTeam( "fd_baseHealth25", TEAM_MILITIA )
if (healthpercent <= 10)
PlayFactionDialogueToTeam( "fd_baseLowHealth", TEAM_MILITIA )
if( newHealth <= 0 )
{
EmitSoundAtPosition(TEAM_UNASSIGNED,fd_harvester.harvester.GetOrigin(),"coop_generator_destroyed")
newHealth = 0
PlayFactionDialogueToTeam( "fd_baseDeath", TEAM_MILITIA )
fd_harvester.rings.Anim_Stop()
}
harvester.SetHealth( newHealth )
file.havesterWasDamaged = true
}
if ( DamageInfo_GetDamageSourceIdentifier( damageInfo ) == eDamageSourceId.mp_titancore_laser_cannon )
DamageInfo_SetDamage( damageInfo, DamageInfo_GetDamage( damageInfo )/10 ) // laser core shreds super well for some reason
if ( attacker.IsPlayer() )
attacker.NotifyDidDamage( harvester, DamageInfo_GetHitBox( damageInfo ), DamageInfo_GetDamagePosition( damageInfo ), DamageInfo_GetCustomDamageType( damageInfo ), DamageInfo_GetDamage( damageInfo ), DamageInfo_GetDamageFlags( damageInfo ), DamageInfo_GetHitGroup( damageInfo ), DamageInfo_GetWeapon( damageInfo ), DamageInfo_GetDistFromAttackOrigin( damageInfo ) )
}
void function FD_NPCCleanup()
{
foreach ( entity npc in GetEntArrayByClass_Expensive("C_AI_BaseNPC") )
if ( IsValid( npc ) )
npc.Destroy()
}
void function HarvesterThink()
{
entity harvester = fd_harvester.harvester
EmitSoundOnEntity( harvester,"coop_generator_startup" )
float lastTime = Time()
wait 4
int lastShieldHealth = harvester.GetShieldHealth()
generateBeamFX( fd_harvester )
generateShieldFX( fd_harvester )
EmitSoundOnEntity( harvester, "coop_generator_ambient_healthy" )
bool isRegening = false // stops the regenning sound to keep stacking on top of each other
while ( IsAlive( harvester ) )
{
float currentTime = Time()
float deltaTime = currentTime -lastTime
if ( IsValid( fd_harvester.particleShield ) )
{
vector shieldColor = GetShieldTriLerpColor(1.0-(harvester.GetShieldHealth().tofloat()/harvester.GetShieldHealthMax().tofloat()))
EffectSetControlPointVector( fd_harvester.particleShield, 1, shieldColor )
}
if( IsValid( fd_harvester.particleBeam ) )
{
vector beamColor = GetShieldTriLerpColor( 1.0 - (harvester.GetHealth().tofloat() / harvester.GetMaxHealth().tofloat() ) )
EffectSetControlPointVector( fd_harvester.particleBeam, 1, beamColor )
}
if ( fd_harvester.harvester.GetShieldHealth() == 0 )
if( IsValid( fd_harvester.particleShield ) )
fd_harvester.particleShield.Destroy()
if ( ( ( currentTime-fd_harvester.lastDamage) >= GENERATOR_SHIELD_REGEN_DELAY ) && ( harvester.GetShieldHealth() < harvester.GetShieldHealthMax() ) )
{
if( !IsValid(fd_harvester.particleShield) )
generateShieldFX(fd_harvester)
//printt((currentTime-fd_harvester.lastDamage))
if(harvester.GetShieldHealth()==0)
EmitSoundOnEntity(harvester,"coop_generator_shieldrecharge_start")
if (!isRegening)
{
EmitSoundOnEntity( harvester,"coop_generator_shieldrecharge_resume" )
file.harvesterShieldDown = false
if (GetGlobalNetBool("FD_waveActive"))
PlayFactionDialogueToTeam( "fd_baseShieldRecharging", TEAM_MILITIA )
else
PlayFactionDialogueToTeam( "fd_baseShieldRechargingShort", TEAM_MILITIA )
isRegening = true
}
float newShieldHealth = ( harvester.GetShieldHealthMax() / GENERATOR_SHIELD_REGEN_TIME * deltaTime ) + harvester.GetShieldHealth()
if ( newShieldHealth >= harvester.GetShieldHealthMax() )
{
StopSoundOnEntity(harvester,"coop_generator_shieldrecharge_resume")
harvester.SetShieldHealth(harvester.GetShieldHealthMax())
EmitSoundOnEntity(harvester,"coop_generator_shieldrecharge_end")
if (GetGlobalNetBool("FD_waveActive"))
PlayFactionDialogueToTeam( "fd_baseShieldUp", TEAM_MILITIA )
isRegening = false
}
else
{
harvester.SetShieldHealth(newShieldHealth)
}
} else if ( ( ( currentTime-fd_harvester.lastDamage) < GENERATOR_SHIELD_REGEN_DELAY ) && ( harvester.GetShieldHealth() < harvester.GetShieldHealthMax() ) )
isRegening = false
if ( ( lastShieldHealth > 0 ) && ( harvester.GetShieldHealth() == 0 ) )
EmitSoundOnEntity(harvester,"coop_generator_shielddown")
lastShieldHealth = harvester.GetShieldHealth()
lastTime = currentTime
WaitFrame()
}
}
void function startHarvester()
{
thread HarvesterThink()
thread HarvesterAlarm()
}
void function HarvesterAlarm()
{
while(IsAlive(fd_harvester.harvester))
{
if(fd_harvester.harvester.GetShieldHealth()==0)
{
wait EmitSoundOnEntity(fd_harvester.harvester,"coop_generator_underattack_alarm")
}
else
{
WaitFrame()
}
}
}
void function initNetVars()
{
SetGlobalNetInt("FD_totalWaves",waveEvents.len())
SetGlobalNetInt("burn_turretLimit",2)
if(!FD_HasRestarted())
{
bool showShop = false
SetGlobalNetInt("FD_currentWave",0)
if(FD_IsDifficultyLevelOrHigher(eFDDifficultyLevel.INSANE))
FD_SetNumAllowedRestarts(0)
else
FD_SetNumAllowedRestarts(2)
}
}
void function FD_DamageByPlayerCallback(entity victim,var damageInfo)
{
entity player = DamageInfo_GetAttacker(damageInfo)
if(!(player in file.players))
return
float damage = DamageInfo_GetDamage(damageInfo)
file.players[player].damageDealt += damage
file.players[player].scoreThisRound += damage.tointeger() //TODO NOT HOW SCORE WORKS
if(victim.IsTitan())
{
//TODO Money and score for titan damage
}
}
void function DamageScaleByDifficulty( entity ent, var damageInfo )
{
entity attacker = DamageInfo_GetAttacker( damageInfo )
if ( !attacker )
return
if ( ent.GetTeam() != TEAM_MILITIA )
return
int damageSourceID = DamageInfo_GetDamageSourceIdentifier( damageInfo )
float damageAmount = DamageInfo_GetDamage( damageInfo )
if ( !damageSourceID && !damageAmount )
return
if ( attacker.IsPlayer() && attacker.GetTeam() == TEAM_IMC ) // in case we ever want a PvP in Frontier Defense, don't scale their damage
return
if ( attacker == ent ) // dont scale self damage
return
DamageInfo_SetDamage( damageInfo, (damageAmount * GetCurrentPlaylistVarFloat("fd_player_damage_scalar",1.0)) )
}
void function HealthScaleByDifficulty( entity ent )
{
if ( ent.GetTeam() != TEAM_IMC )
return
if (ent.IsTitan()&& IsValid(GetPetTitanOwner( ent ) ) ) // in case we ever want pvp in FD
return
if ( ent.IsTitan() )
ent.SetMaxHealth( ent.GetMaxHealth() + GetCurrentPlaylistVarInt("fd_titan_health_adjust",0) )
else
ent.SetMaxHealth( ent.GetMaxHealth() + GetCurrentPlaylistVarInt("fd_reaper_health_adjust",0) )
if(GetCurrentPlaylistVarInt("fd_pro_titan_shields",0)&&ent.IsTitan()){
entity soul = ent.GetTitanSoul()
if(IsValid(soul)){
soul.SetShieldHealthMax(2500)
soul.SetShieldHealth(2500)
}
}
}
void function FD_createHarvester()
{
fd_harvester = SpawnHarvester(file.harvester_info.GetOrigin(),file.harvester_info.GetAngles(),GetCurrentPlaylistVarInt("fd_harvester_health",25000),GetCurrentPlaylistVarInt("fd_harvester_shield",6000),TEAM_MILITIA)
fd_harvester.harvester.Minimap_SetAlignUpright( true )
fd_harvester.harvester.Minimap_AlwaysShow( TEAM_IMC, null )
fd_harvester.harvester.Minimap_AlwaysShow( TEAM_MILITIA, null )
fd_harvester.harvester.Minimap_SetHeightTracking( true )
fd_harvester.harvester.Minimap_SetZOrder( MINIMAP_Z_OBJECT )
fd_harvester.harvester.Minimap_SetCustomState( eMinimapObject_prop_script.FD_HARVESTER )
AddEntityCallback_OnDamaged( fd_harvester.harvester, OnHarvesterDamaged )
}
bool function isFinalWave()
{
return ((GetGlobalNetInt("FD_currentWave")+1)==GetGlobalNetInt("FD_totalWaves"))
}
bool function isSecondWave()
{
return ((GetGlobalNetInt("FD_currentWave")+1)==1)
}
void function LoadEntities()
{
CreateBoostStoreLocation(TEAM_MILITIA,shopPosition,shopAngles)
foreach ( entity info_target in GetEntArrayByClass_Expensive("info_target") )
{
if ( GameModeRemove( info_target ) )
continue
if(info_target.HasKey("editorclass")){
switch(info_target.kv.editorclass){
case"info_fd_harvester":
file.harvester_info = info_target
break
case"info_fd_mode_model":
entity prop = CreatePropDynamic( info_target.GetModelName(), info_target.GetOrigin(), info_target.GetAngles(), 6 )
break
case"info_fd_ai_position":
AddStationaryAIPosition(info_target.GetOrigin(),int(info_target.kv.aiType))
break
case"info_fd_route_node":
routeNodes.append(info_target)
break
case"info_fd_smoke_screen":
file.smokePoints.append(info_target)
break
}
}
}
ValidateAndFinalizePendingStationaryPositions()
initNetVars()
SetTeam(GetTeamEnt(TEAM_IMC),TEAM_IMC)
}
bool function allPlayersReady()
{
foreach(entity player in GetPlayerArray())
{
if(!player.GetPlayerNetBool("FD_readyForNextWave"))
return false
}
return true
}
void function CheckLastPlayerReady()
{
int readyplayers = 0
entity notready
foreach(entity player in GetPlayerArray())
{
if(player.GetPlayerNetBool("FD_readyForNextWave"))
readyplayers++
else
notready = player // keep a track of this player
}
if (readyplayers == GetPlayerArray().len() - 1)
PlayFactionDialogueToPlayer( "fd_playerNeedsToReadyUp", notready ) // ready up i swear there's one player like this in every match i've played
}
bool function ClientCommandCallbackToggleReady( entity player, array<string> args )
{
if(args[0]=="true")
player.SetPlayerNetBool("FD_readyForNextWave",true)
if(args[0]=="false")
player.SetPlayerNetBool("FD_readyForNextWave",false)
CheckLastPlayerReady()
return true
}
int function getHintForTypeId(int typeId)
{
//this is maybe a bit of an naive aproch
switch(typeId)
{
case eFD_AITypeIDs.TITAN_NUKE:
return (348 +RandomIntRangeInclusive(0,1))
case eFD_AITypeIDs.TITAN_ARC:
return (350 +RandomIntRangeInclusive(0,1))
case eFD_AITypeIDs.TITAN_MORTAR:
return (352 +RandomIntRangeInclusive(0,1))
case eFD_AITypeIDs.GRUNT:
return 354
case eFD_AITypeIDs.SPECTRE:
return 355
case eFD_AITypeIDs.SPECTRE_MORTAR:
return (356 +RandomIntRangeInclusive(0,1))
case eFD_AITypeIDs.STALKER:
if(RandomIntRangeInclusive(0,1)==0)
return 358
else
return 361
case eFD_AITypeIDs.REAPER:
return (359 +RandomIntRangeInclusive(0,1))
case eFD_AITypeIDs.DRONE:
return 362
case eFD_AITypeIDs.TITAN_SNIPER:
return (371 +RandomIntRangeInclusive(0,2))
default:
return (363+RandomIntRangeInclusive(0,7))
}
unreachable
}
string function GetTargetNameForID(int typeId)
{
switch(typeId)
{
case eFD_AITypeIDs.TITAN_NUKE:
return "npc_titan_nuke"
case eFD_AITypeIDs.LEGION:
return "npc_titan_ogre_minigun"
case eFD_AITypeIDs.TITAN_ARC:
return "empTitan"
case eFD_AITypeIDs.RONIN:
return "npc_titan_stryder_leadwall"
case eFD_AITypeIDs.TITAN_MORTAR:
return "npc_titan_mortar"
case eFD_AITypeIDs.TONE:
return "npc_titan_atlas_tracker"
case eFD_AITypeIDs.TITAN_SNIPER:
return "npc_titan_sniper"
case eFD_AITypeIDs.NORTHSTAR:
return "npc_titan_stryder_sniper"
case eFD_AITypeIDs.ION:
return "npc_titan_atlas_stickybomb"
case eFD_AITypeIDs.SCORCH:
return "npc_titan_ogre_meteor"
case eFD_AITypeIDs.MONARCH:
return "npc_titan_atlas_vanguard"
case eFD_AITypeIDs.GRUNT:
return "grunt"
case eFD_AITypeIDs.SPECTRE:
return "spectre"
case eFD_AITypeIDs.SPECTRE_MORTAR:
return "mortar_spectre"
case eFD_AITypeIDs.STALKER:
return "stalker"
case eFD_AITypeIDs.REAPER:
return "reaper"
case eFD_AITypeIDs.TICK:
return "tick"
case eFD_AITypeIDs.DRONE:
return "drone"
case eFD_AITypeIDs.DRONE_CLOAK:
return "Cloak Drone" // have to be like this for some reason in cl_gamemode_fd
default:
return "titan"
}
unreachable
}
string function GetAiNetIdFromTargetName(string targetName)
{
switch ( targetName )
{
case "titan":
case "sniperTitan":
case "npc_titan_ogre_meteor_boss_fd":
case "npc_titan_ogre_meteor":
case "npc_titan_ogre_minigun_boss_fd":
case "npc_titan_ogre_minigun":
case "npc_titan_atlas_stickybomb_boss_fd":
case "npc_titan_atlas_stickybomb":
case "npc_titan_atlas_tracker_boss_fd":
case "npc_titan_atlas_tracker":
case "npc_titan_stryder_leadwall_boss_fd":
case "npc_titan_stryder_leadwall":
case "npc_titan_stryder_sniper_boss_fd":
case "npc_titan_stryder_sniper":
case "npc_titan_sniper":
case "npc_titan_sniper_tone":
case "npc_titan_atlas_vanguard_boss_fd":
case "npc_titan_atlas_vanguard":
return "FD_AICount_Titan"
case "empTitan":
case "npc_titan_arc":
return "FD_AICount_Titan_Arc"
case "mortarTitan":
case "npc_titan_mortar":
return "FD_AICount_Titan_Mortar"
case "nukeTitan":
case "npc_titan_nuke":
return "FD_AICount_Titan_Nuke"
case "npc_soldier":
case "grunt":
return "FD_AICount_Grunt"
case "spectre":
return "FD_AICount_Spectre"
case "mortar_spectre":
return "FD_AICount_Spectre_Mortar"
case "npc_stalker":
case "stalker":
return "FD_AICount_Stalker"
case "npc_super_spectre":
case "reaper":
return "FD_AICount_Reaper"
case "npc_drone":
case "drone":
return "FD_AICount_Drone"
case "cloakedDrone":
case "Cloaked Drone":
return "FD_AICount_Drone_Cloak"
case "tick":
return "FD_AICount_Ticks"
}
printt("unknown target name ",targetName)
return ""
}
void function AddTurretSentry(entity turret)
{
turret.Minimap_AlwaysShow( TEAM_IMC, null )
turret.Minimap_AlwaysShow( TEAM_MILITIA, null )
turret.Minimap_SetHeightTracking( true )
turret.Minimap_SetCustomState( eMinimapObject_npc.FD_TURRET )
}
void function DisableTitanSelection( )
{
foreach ( entity player in GetPlayerArray() )
{
DisableTitanSelectionForPlayer( player )
}
}
void function EnableTitanSelection( )
{
foreach ( entity player in GetPlayerArray() )
{
EnableTitanSelectionForPlayer( player )
}
}
void function EnableTitanSelectionForPlayer( entity player )
{
int enumCount = PersistenceGetEnumCount( "titanClasses" )
for ( int i = 0; i < enumCount; i++ )
{
string enumName = PersistenceGetEnumItemNameForIndex( "titanClasses", i )
if ( enumName != "" )
player.SetPersistentVar( "titanClassLockState[" + enumName + "]", TITAN_CLASS_LOCK_STATE_AVAILABLE )
}
}
void function DisableTitanSelectionForPlayer( entity player )
{
int enumCount = PersistenceGetEnumCount( "titanClasses" )
for ( int i = 0; i < enumCount; i++ )
{
string enumName = PersistenceGetEnumItemNameForIndex( "titanClasses", i )
string selectedEnumName = PersistenceGetEnumItemNameForIndex( "titanClasses", player.GetPersistentVarAsInt("activeTitanLoadoutIndex") )
if ( enumName != "" && enumName != selectedEnumName )
player.SetPersistentVar( "titanClassLockState[" + enumName + "]", TITAN_CLASS_LOCK_STATE_LOCKED )
}
}
|