forked from SMUnlimited/AMAI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blizzard.j
10811 lines (9034 loc) · 460 KB
/
blizzard.j
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
//===========================================================================
// 1.33 Blizzard.j ( define Jass2 functions that need to be in every map script )
//===========================================================================
globals
//-----------------------------------------------------------------------
// Constants
//
// Misc constants
constant real bj_PI = 3.14159
constant real bj_E = 2.71828
constant real bj_CELLWIDTH = 128.0
constant real bj_CLIFFHEIGHT = 128.0
constant real bj_UNIT_FACING = 270.0
constant real bj_RADTODEG = 180.0/bj_PI
constant real bj_DEGTORAD = bj_PI/180.0
constant real bj_TEXT_DELAY_QUEST = 20.00
constant real bj_TEXT_DELAY_QUESTUPDATE = 20.00
constant real bj_TEXT_DELAY_QUESTDONE = 20.00
constant real bj_TEXT_DELAY_QUESTFAILED = 20.00
constant real bj_TEXT_DELAY_QUESTREQUIREMENT = 20.00
constant real bj_TEXT_DELAY_MISSIONFAILED = 20.00
constant real bj_TEXT_DELAY_ALWAYSHINT = 12.00
constant real bj_TEXT_DELAY_HINT = 12.00
constant real bj_TEXT_DELAY_SECRET = 10.00
constant real bj_TEXT_DELAY_UNITACQUIRED = 15.00
constant real bj_TEXT_DELAY_UNITAVAILABLE = 10.00
constant real bj_TEXT_DELAY_ITEMACQUIRED = 10.00
constant real bj_TEXT_DELAY_WARNING = 12.00
constant real bj_QUEUE_DELAY_QUEST = 5.00
constant real bj_QUEUE_DELAY_HINT = 5.00
constant real bj_QUEUE_DELAY_SECRET = 3.00
constant real bj_HANDICAP_EASY = 60.00
constant real bj_HANDICAP_NORMAL = 90.00
constant real bj_HANDICAPDAMAGE_EASY = 50.00
constant real bj_HANDICAPDAMAGE_NORMAL = 90.00
constant real bj_HANDICAPREVIVE_NOTHARD = 50.00
constant real bj_GAME_STARTED_THRESHOLD = 0.01
constant real bj_WAIT_FOR_COND_MIN_INTERVAL = 0.10
constant real bj_POLLED_WAIT_INTERVAL = 0.10
constant real bj_POLLED_WAIT_SKIP_THRESHOLD = 2.00
// Game constants
constant integer bj_MAX_INVENTORY = 6
constant integer bj_MAX_PLAYERS = GetBJMaxPlayers()
constant integer bj_PLAYER_NEUTRAL_VICTIM = GetBJPlayerNeutralVictim()
constant integer bj_PLAYER_NEUTRAL_EXTRA = GetBJPlayerNeutralExtra()
constant integer bj_MAX_PLAYER_SLOTS = GetBJMaxPlayerSlots()
constant integer bj_MAX_SKELETONS = 25
constant integer bj_MAX_STOCK_ITEM_SLOTS = 11
constant integer bj_MAX_STOCK_UNIT_SLOTS = 11
constant integer bj_MAX_ITEM_LEVEL = 10
// Auto Save constants
constant integer bj_MAX_CHECKPOINTS = 5
// Ideally these would be looked up from Units/MiscData.txt,
// but there is currently no script functionality exposed to do that
constant real bj_TOD_DAWN = 6.00
constant real bj_TOD_DUSK = 18.00
// Melee game settings:
// - Starting Time of Day (TOD)
// - Starting Gold
// - Starting Lumber
// - Starting Hero Tokens (free heroes)
// - Max heroes allowed per player
// - Max heroes allowed per hero type
// - Distance from start loc to search for nearby mines
//
constant real bj_MELEE_STARTING_TOD = 8.00
constant integer bj_MELEE_STARTING_GOLD_V0 = 750
constant integer bj_MELEE_STARTING_GOLD_V1 = 500
constant integer bj_MELEE_STARTING_LUMBER_V0 = 200
constant integer bj_MELEE_STARTING_LUMBER_V1 = 150
constant integer bj_MELEE_STARTING_HERO_TOKENS = 1
constant integer bj_MELEE_HERO_LIMIT = 3
constant integer bj_MELEE_HERO_TYPE_LIMIT = 1
constant real bj_MELEE_MINE_SEARCH_RADIUS = 2000
constant real bj_MELEE_CLEAR_UNITS_RADIUS = 1500
constant real bj_MELEE_CRIPPLE_TIMEOUT = 120.00
constant real bj_MELEE_CRIPPLE_MSG_DURATION = 20.00
constant integer bj_MELEE_MAX_TWINKED_HEROES_V0 = 3
constant integer bj_MELEE_MAX_TWINKED_HEROES_V1 = 1
// Delay between a creep's death and the time it may drop an item.
constant real bj_CREEP_ITEM_DELAY = 0.50
// Timing settings for Marketplace inventories.
constant real bj_STOCK_RESTOCK_INITIAL_DELAY = 120
constant real bj_STOCK_RESTOCK_INTERVAL = 30
constant integer bj_STOCK_MAX_ITERATIONS = 20
// Max events registered by a single "dest dies in region" event.
constant integer bj_MAX_DEST_IN_REGION_EVENTS = 64
// Camera settings
constant integer bj_CAMERA_MIN_FARZ = 100
constant integer bj_CAMERA_DEFAULT_DISTANCE = 1650
constant integer bj_CAMERA_DEFAULT_FARZ = 5000
constant integer bj_CAMERA_DEFAULT_AOA = 304
constant integer bj_CAMERA_DEFAULT_FOV = 70
constant integer bj_CAMERA_DEFAULT_ROLL = 0
constant integer bj_CAMERA_DEFAULT_ROTATION = 90
// Rescue
constant real bj_RESCUE_PING_TIME = 2.00
// Transmission behavior settings
constant real bj_NOTHING_SOUND_DURATION = 5.00
constant real bj_TRANSMISSION_PING_TIME = 1.00
constant integer bj_TRANSMISSION_IND_RED = 255
constant integer bj_TRANSMISSION_IND_BLUE = 255
constant integer bj_TRANSMISSION_IND_GREEN = 255
constant integer bj_TRANSMISSION_IND_ALPHA = 255
constant real bj_TRANSMISSION_PORT_HANGTIME = 1.50
// Cinematic mode settings
constant real bj_CINEMODE_INTERFACEFADE = 0.50
constant gamespeed bj_CINEMODE_GAMESPEED = MAP_SPEED_NORMAL
// Cinematic mode volume levels
constant real bj_CINEMODE_VOLUME_UNITMOVEMENT = 0.40
constant real bj_CINEMODE_VOLUME_UNITSOUNDS = 0.00
constant real bj_CINEMODE_VOLUME_COMBAT = 0.40
constant real bj_CINEMODE_VOLUME_SPELLS = 0.40
constant real bj_CINEMODE_VOLUME_UI = 0.00
constant real bj_CINEMODE_VOLUME_MUSIC = 0.55
constant real bj_CINEMODE_VOLUME_AMBIENTSOUNDS = 1.00
constant real bj_CINEMODE_VOLUME_FIRE = 0.60
// Speech mode volume levels
constant real bj_SPEECH_VOLUME_UNITMOVEMENT = 0.25
constant real bj_SPEECH_VOLUME_UNITSOUNDS = 0.00
constant real bj_SPEECH_VOLUME_COMBAT = 0.25
constant real bj_SPEECH_VOLUME_SPELLS = 0.25
constant real bj_SPEECH_VOLUME_UI = 0.00
constant real bj_SPEECH_VOLUME_MUSIC = 0.55
constant real bj_SPEECH_VOLUME_AMBIENTSOUNDS = 1.00
constant real bj_SPEECH_VOLUME_FIRE = 0.60
// Smart pan settings
constant real bj_SMARTPAN_TRESHOLD_PAN = 500
constant real bj_SMARTPAN_TRESHOLD_SNAP = 3500
// QueuedTriggerExecute settings
constant integer bj_MAX_QUEUED_TRIGGERS = 100
constant real bj_QUEUED_TRIGGER_TIMEOUT = 180.00
// Campaign indexing constants
constant integer bj_CAMPAIGN_INDEX_T = 0
constant integer bj_CAMPAIGN_INDEX_H = 1
constant integer bj_CAMPAIGN_INDEX_U = 2
constant integer bj_CAMPAIGN_INDEX_O = 3
constant integer bj_CAMPAIGN_INDEX_N = 4
constant integer bj_CAMPAIGN_INDEX_XN = 5
constant integer bj_CAMPAIGN_INDEX_XH = 6
constant integer bj_CAMPAIGN_INDEX_XU = 7
constant integer bj_CAMPAIGN_INDEX_XO = 8
// Campaign offset constants (for mission indexing)
constant integer bj_CAMPAIGN_OFFSET_T = 0
constant integer bj_CAMPAIGN_OFFSET_H = 1
constant integer bj_CAMPAIGN_OFFSET_U = 2
constant integer bj_CAMPAIGN_OFFSET_O = 3
constant integer bj_CAMPAIGN_OFFSET_N = 4
constant integer bj_CAMPAIGN_OFFSET_XN = 5
constant integer bj_CAMPAIGN_OFFSET_XH = 6
constant integer bj_CAMPAIGN_OFFSET_XU = 7
constant integer bj_CAMPAIGN_OFFSET_XO = 8
// Mission indexing constants
// Tutorial
constant integer bj_MISSION_INDEX_T00 = bj_CAMPAIGN_OFFSET_T * 1000 + 0
constant integer bj_MISSION_INDEX_T01 = bj_CAMPAIGN_OFFSET_T * 1000 + 1
constant integer bj_MISSION_INDEX_T02 = bj_CAMPAIGN_OFFSET_T * 1000 + 2
constant integer bj_MISSION_INDEX_T03 = bj_CAMPAIGN_OFFSET_T * 1000 + 3
constant integer bj_MISSION_INDEX_T04 = bj_CAMPAIGN_OFFSET_T * 1000 + 4
// Human
constant integer bj_MISSION_INDEX_H00 = bj_CAMPAIGN_OFFSET_H * 1000 + 0
constant integer bj_MISSION_INDEX_H01 = bj_CAMPAIGN_OFFSET_H * 1000 + 1
constant integer bj_MISSION_INDEX_H02 = bj_CAMPAIGN_OFFSET_H * 1000 + 2
constant integer bj_MISSION_INDEX_H03 = bj_CAMPAIGN_OFFSET_H * 1000 + 3
constant integer bj_MISSION_INDEX_H04 = bj_CAMPAIGN_OFFSET_H * 1000 + 4
constant integer bj_MISSION_INDEX_H05 = bj_CAMPAIGN_OFFSET_H * 1000 + 5
constant integer bj_MISSION_INDEX_H06 = bj_CAMPAIGN_OFFSET_H * 1000 + 6
constant integer bj_MISSION_INDEX_H07 = bj_CAMPAIGN_OFFSET_H * 1000 + 7
constant integer bj_MISSION_INDEX_H08 = bj_CAMPAIGN_OFFSET_H * 1000 + 8
constant integer bj_MISSION_INDEX_H09 = bj_CAMPAIGN_OFFSET_H * 1000 + 9
constant integer bj_MISSION_INDEX_H10 = bj_CAMPAIGN_OFFSET_H * 1000 + 10
constant integer bj_MISSION_INDEX_H11 = bj_CAMPAIGN_OFFSET_H * 1000 + 11
// Undead
constant integer bj_MISSION_INDEX_U00 = bj_CAMPAIGN_OFFSET_U * 1000 + 0
constant integer bj_MISSION_INDEX_U01 = bj_CAMPAIGN_OFFSET_U * 1000 + 1
constant integer bj_MISSION_INDEX_U02 = bj_CAMPAIGN_OFFSET_U * 1000 + 2
constant integer bj_MISSION_INDEX_U03 = bj_CAMPAIGN_OFFSET_U * 1000 + 3
constant integer bj_MISSION_INDEX_U05 = bj_CAMPAIGN_OFFSET_U * 1000 + 4
constant integer bj_MISSION_INDEX_U07 = bj_CAMPAIGN_OFFSET_U * 1000 + 5
constant integer bj_MISSION_INDEX_U08 = bj_CAMPAIGN_OFFSET_U * 1000 + 6
constant integer bj_MISSION_INDEX_U09 = bj_CAMPAIGN_OFFSET_U * 1000 + 7
constant integer bj_MISSION_INDEX_U10 = bj_CAMPAIGN_OFFSET_U * 1000 + 8
constant integer bj_MISSION_INDEX_U11 = bj_CAMPAIGN_OFFSET_U * 1000 + 9
// Orc
constant integer bj_MISSION_INDEX_O00 = bj_CAMPAIGN_OFFSET_O * 1000 + 0
constant integer bj_MISSION_INDEX_O01 = bj_CAMPAIGN_OFFSET_O * 1000 + 1
constant integer bj_MISSION_INDEX_O02 = bj_CAMPAIGN_OFFSET_O * 1000 + 2
constant integer bj_MISSION_INDEX_O03 = bj_CAMPAIGN_OFFSET_O * 1000 + 3
constant integer bj_MISSION_INDEX_O04 = bj_CAMPAIGN_OFFSET_O * 1000 + 4
constant integer bj_MISSION_INDEX_O05 = bj_CAMPAIGN_OFFSET_O * 1000 + 5
constant integer bj_MISSION_INDEX_O06 = bj_CAMPAIGN_OFFSET_O * 1000 + 6
constant integer bj_MISSION_INDEX_O07 = bj_CAMPAIGN_OFFSET_O * 1000 + 7
constant integer bj_MISSION_INDEX_O08 = bj_CAMPAIGN_OFFSET_O * 1000 + 8
constant integer bj_MISSION_INDEX_O09 = bj_CAMPAIGN_OFFSET_O * 1000 + 9
constant integer bj_MISSION_INDEX_O10 = bj_CAMPAIGN_OFFSET_O * 1000 + 10
// Night Elf
constant integer bj_MISSION_INDEX_N00 = bj_CAMPAIGN_OFFSET_N * 1000 + 0
constant integer bj_MISSION_INDEX_N01 = bj_CAMPAIGN_OFFSET_N * 1000 + 1
constant integer bj_MISSION_INDEX_N02 = bj_CAMPAIGN_OFFSET_N * 1000 + 2
constant integer bj_MISSION_INDEX_N03 = bj_CAMPAIGN_OFFSET_N * 1000 + 3
constant integer bj_MISSION_INDEX_N04 = bj_CAMPAIGN_OFFSET_N * 1000 + 4
constant integer bj_MISSION_INDEX_N05 = bj_CAMPAIGN_OFFSET_N * 1000 + 5
constant integer bj_MISSION_INDEX_N06 = bj_CAMPAIGN_OFFSET_N * 1000 + 6
constant integer bj_MISSION_INDEX_N07 = bj_CAMPAIGN_OFFSET_N * 1000 + 7
constant integer bj_MISSION_INDEX_N08 = bj_CAMPAIGN_OFFSET_N * 1000 + 8
constant integer bj_MISSION_INDEX_N09 = bj_CAMPAIGN_OFFSET_N * 1000 + 9
// Expansion Night Elf
constant integer bj_MISSION_INDEX_XN00 = bj_CAMPAIGN_OFFSET_XN * 1000 + 0
constant integer bj_MISSION_INDEX_XN01 = bj_CAMPAIGN_OFFSET_XN * 1000 + 1
constant integer bj_MISSION_INDEX_XN02 = bj_CAMPAIGN_OFFSET_XN * 1000 + 2
constant integer bj_MISSION_INDEX_XN03 = bj_CAMPAIGN_OFFSET_XN * 1000 + 3
constant integer bj_MISSION_INDEX_XN04 = bj_CAMPAIGN_OFFSET_XN * 1000 + 4
constant integer bj_MISSION_INDEX_XN05 = bj_CAMPAIGN_OFFSET_XN * 1000 + 5
constant integer bj_MISSION_INDEX_XN06 = bj_CAMPAIGN_OFFSET_XN * 1000 + 6
constant integer bj_MISSION_INDEX_XN07 = bj_CAMPAIGN_OFFSET_XN * 1000 + 7
constant integer bj_MISSION_INDEX_XN08 = bj_CAMPAIGN_OFFSET_XN * 1000 + 8
constant integer bj_MISSION_INDEX_XN09 = bj_CAMPAIGN_OFFSET_XN * 1000 + 9
constant integer bj_MISSION_INDEX_XN10 = bj_CAMPAIGN_OFFSET_XN * 1000 + 10
// Expansion Human
constant integer bj_MISSION_INDEX_XH00 = bj_CAMPAIGN_OFFSET_XH * 1000 + 0
constant integer bj_MISSION_INDEX_XH01 = bj_CAMPAIGN_OFFSET_XH * 1000 + 1
constant integer bj_MISSION_INDEX_XH02 = bj_CAMPAIGN_OFFSET_XH * 1000 + 2
constant integer bj_MISSION_INDEX_XH03 = bj_CAMPAIGN_OFFSET_XH * 1000 + 3
constant integer bj_MISSION_INDEX_XH04 = bj_CAMPAIGN_OFFSET_XH * 1000 + 4
constant integer bj_MISSION_INDEX_XH05 = bj_CAMPAIGN_OFFSET_XH * 1000 + 5
constant integer bj_MISSION_INDEX_XH06 = bj_CAMPAIGN_OFFSET_XH * 1000 + 6
constant integer bj_MISSION_INDEX_XH07 = bj_CAMPAIGN_OFFSET_XH * 1000 + 7
constant integer bj_MISSION_INDEX_XH08 = bj_CAMPAIGN_OFFSET_XH * 1000 + 8
constant integer bj_MISSION_INDEX_XH09 = bj_CAMPAIGN_OFFSET_XH * 1000 + 9
// Expansion Undead
constant integer bj_MISSION_INDEX_XU00 = bj_CAMPAIGN_OFFSET_XU * 1000 + 0
constant integer bj_MISSION_INDEX_XU01 = bj_CAMPAIGN_OFFSET_XU * 1000 + 1
constant integer bj_MISSION_INDEX_XU02 = bj_CAMPAIGN_OFFSET_XU * 1000 + 2
constant integer bj_MISSION_INDEX_XU03 = bj_CAMPAIGN_OFFSET_XU * 1000 + 3
constant integer bj_MISSION_INDEX_XU04 = bj_CAMPAIGN_OFFSET_XU * 1000 + 4
constant integer bj_MISSION_INDEX_XU05 = bj_CAMPAIGN_OFFSET_XU * 1000 + 5
constant integer bj_MISSION_INDEX_XU06 = bj_CAMPAIGN_OFFSET_XU * 1000 + 6
constant integer bj_MISSION_INDEX_XU07 = bj_CAMPAIGN_OFFSET_XU * 1000 + 7
constant integer bj_MISSION_INDEX_XU08 = bj_CAMPAIGN_OFFSET_XU * 1000 + 8
constant integer bj_MISSION_INDEX_XU09 = bj_CAMPAIGN_OFFSET_XU * 1000 + 9
constant integer bj_MISSION_INDEX_XU10 = bj_CAMPAIGN_OFFSET_XU * 1000 + 10
constant integer bj_MISSION_INDEX_XU11 = bj_CAMPAIGN_OFFSET_XU * 1000 + 11
constant integer bj_MISSION_INDEX_XU12 = bj_CAMPAIGN_OFFSET_XU * 1000 + 12
constant integer bj_MISSION_INDEX_XU13 = bj_CAMPAIGN_OFFSET_XU * 1000 + 13
// Expansion Orc
constant integer bj_MISSION_INDEX_XO00 = bj_CAMPAIGN_OFFSET_XO * 1000 + 0
constant integer bj_MISSION_INDEX_XO01 = bj_CAMPAIGN_OFFSET_XO * 1000 + 1
constant integer bj_MISSION_INDEX_XO02 = bj_CAMPAIGN_OFFSET_XO * 1000 + 2
constant integer bj_MISSION_INDEX_XO03 = bj_CAMPAIGN_OFFSET_XO * 1000 + 3
// Cinematic indexing constants
constant integer bj_CINEMATICINDEX_TOP = 0
constant integer bj_CINEMATICINDEX_HOP = 1
constant integer bj_CINEMATICINDEX_HED = 2
constant integer bj_CINEMATICINDEX_OOP = 3
constant integer bj_CINEMATICINDEX_OED = 4
constant integer bj_CINEMATICINDEX_UOP = 5
constant integer bj_CINEMATICINDEX_UED = 6
constant integer bj_CINEMATICINDEX_NOP = 7
constant integer bj_CINEMATICINDEX_NED = 8
constant integer bj_CINEMATICINDEX_XOP = 9
constant integer bj_CINEMATICINDEX_XED = 10
// Alliance settings
constant integer bj_ALLIANCE_UNALLIED = 0
constant integer bj_ALLIANCE_UNALLIED_VISION = 1
constant integer bj_ALLIANCE_ALLIED = 2
constant integer bj_ALLIANCE_ALLIED_VISION = 3
constant integer bj_ALLIANCE_ALLIED_UNITS = 4
constant integer bj_ALLIANCE_ALLIED_ADVUNITS = 5
constant integer bj_ALLIANCE_NEUTRAL = 6
constant integer bj_ALLIANCE_NEUTRAL_VISION = 7
// Keyboard Event Types
constant integer bj_KEYEVENTTYPE_DEPRESS = 0
constant integer bj_KEYEVENTTYPE_RELEASE = 1
// Keyboard Event Keys
constant integer bj_KEYEVENTKEY_LEFT = 0
constant integer bj_KEYEVENTKEY_RIGHT = 1
constant integer bj_KEYEVENTKEY_DOWN = 2
constant integer bj_KEYEVENTKEY_UP = 3
// Mouse Event Types
constant integer bj_MOUSEEVENTTYPE_DOWN = 0
constant integer bj_MOUSEEVENTTYPE_UP = 1
constant integer bj_MOUSEEVENTTYPE_MOVE = 2
// Transmission timing methods
constant integer bj_TIMETYPE_ADD = 0
constant integer bj_TIMETYPE_SET = 1
constant integer bj_TIMETYPE_SUB = 2
// Camera bounds adjustment methods
constant integer bj_CAMERABOUNDS_ADJUST_ADD = 0
constant integer bj_CAMERABOUNDS_ADJUST_SUB = 1
// Quest creation states
constant integer bj_QUESTTYPE_REQ_DISCOVERED = 0
constant integer bj_QUESTTYPE_REQ_UNDISCOVERED = 1
constant integer bj_QUESTTYPE_OPT_DISCOVERED = 2
constant integer bj_QUESTTYPE_OPT_UNDISCOVERED = 3
// Quest message types
constant integer bj_QUESTMESSAGE_DISCOVERED = 0
constant integer bj_QUESTMESSAGE_UPDATED = 1
constant integer bj_QUESTMESSAGE_COMPLETED = 2
constant integer bj_QUESTMESSAGE_FAILED = 3
constant integer bj_QUESTMESSAGE_REQUIREMENT = 4
constant integer bj_QUESTMESSAGE_MISSIONFAILED = 5
constant integer bj_QUESTMESSAGE_ALWAYSHINT = 6
constant integer bj_QUESTMESSAGE_HINT = 7
constant integer bj_QUESTMESSAGE_SECRET = 8
constant integer bj_QUESTMESSAGE_UNITACQUIRED = 9
constant integer bj_QUESTMESSAGE_UNITAVAILABLE = 10
constant integer bj_QUESTMESSAGE_ITEMACQUIRED = 11
constant integer bj_QUESTMESSAGE_WARNING = 12
// Leaderboard sorting methods
constant integer bj_SORTTYPE_SORTBYVALUE = 0
constant integer bj_SORTTYPE_SORTBYPLAYER = 1
constant integer bj_SORTTYPE_SORTBYLABEL = 2
// Cinematic fade filter methods
constant integer bj_CINEFADETYPE_FADEIN = 0
constant integer bj_CINEFADETYPE_FADEOUT = 1
constant integer bj_CINEFADETYPE_FADEOUTIN = 2
// Buff removal methods
constant integer bj_REMOVEBUFFS_POSITIVE = 0
constant integer bj_REMOVEBUFFS_NEGATIVE = 1
constant integer bj_REMOVEBUFFS_ALL = 2
constant integer bj_REMOVEBUFFS_NONTLIFE = 3
// Buff properties - polarity
constant integer bj_BUFF_POLARITY_POSITIVE = 0
constant integer bj_BUFF_POLARITY_NEGATIVE = 1
constant integer bj_BUFF_POLARITY_EITHER = 2
// Buff properties - resist type
constant integer bj_BUFF_RESIST_MAGIC = 0
constant integer bj_BUFF_RESIST_PHYSICAL = 1
constant integer bj_BUFF_RESIST_EITHER = 2
constant integer bj_BUFF_RESIST_BOTH = 3
// Hero stats
constant integer bj_HEROSTAT_STR = 0
constant integer bj_HEROSTAT_AGI = 1
constant integer bj_HEROSTAT_INT = 2
// Hero skill point modification methods
constant integer bj_MODIFYMETHOD_ADD = 0
constant integer bj_MODIFYMETHOD_SUB = 1
constant integer bj_MODIFYMETHOD_SET = 2
// Unit state adjustment methods (for replaced units)
constant integer bj_UNIT_STATE_METHOD_ABSOLUTE = 0
constant integer bj_UNIT_STATE_METHOD_RELATIVE = 1
constant integer bj_UNIT_STATE_METHOD_DEFAULTS = 2
constant integer bj_UNIT_STATE_METHOD_MAXIMUM = 3
// Gate operations
constant integer bj_GATEOPERATION_CLOSE = 0
constant integer bj_GATEOPERATION_OPEN = 1
constant integer bj_GATEOPERATION_DESTROY = 2
// Game cache value types
constant integer bj_GAMECACHE_BOOLEAN = 0
constant integer bj_GAMECACHE_INTEGER = 1
constant integer bj_GAMECACHE_REAL = 2
constant integer bj_GAMECACHE_UNIT = 3
constant integer bj_GAMECACHE_STRING = 4
// Hashtable value types
constant integer bj_HASHTABLE_BOOLEAN = 0
constant integer bj_HASHTABLE_INTEGER = 1
constant integer bj_HASHTABLE_REAL = 2
constant integer bj_HASHTABLE_STRING = 3
constant integer bj_HASHTABLE_HANDLE = 4
// Item status types
constant integer bj_ITEM_STATUS_HIDDEN = 0
constant integer bj_ITEM_STATUS_OWNED = 1
constant integer bj_ITEM_STATUS_INVULNERABLE = 2
constant integer bj_ITEM_STATUS_POWERUP = 3
constant integer bj_ITEM_STATUS_SELLABLE = 4
constant integer bj_ITEM_STATUS_PAWNABLE = 5
// Itemcode status types
constant integer bj_ITEMCODE_STATUS_POWERUP = 0
constant integer bj_ITEMCODE_STATUS_SELLABLE = 1
constant integer bj_ITEMCODE_STATUS_PAWNABLE = 2
// Minimap ping styles
constant integer bj_MINIMAPPINGSTYLE_SIMPLE = 0
constant integer bj_MINIMAPPINGSTYLE_FLASHY = 1
constant integer bj_MINIMAPPINGSTYLE_ATTACK = 2
// Campaign Minimap icon styles
constant integer bj_CAMPPINGSTYLE_PRIMARY = 0
constant integer bj_CAMPPINGSTYLE_PRIMARY_GREEN = 1
constant integer bj_CAMPPINGSTYLE_PRIMARY_RED = 2
constant integer bj_CAMPPINGSTYLE_BONUS = 3
constant integer bj_CAMPPINGSTYLE_TURNIN = 4
constant integer bj_CAMPPINGSTYLE_BOSS = 5
constant integer bj_CAMPPINGSTYLE_CONTROL_ALLY = 6
constant integer bj_CAMPPINGSTYLE_CONTROL_NEUTRAL = 7
constant integer bj_CAMPPINGSTYLE_CONTROL_ENEMY = 8
// Corpse creation settings
constant real bj_CORPSE_MAX_DEATH_TIME = 8.00
// Corpse creation styles
constant integer bj_CORPSETYPE_FLESH = 0
constant integer bj_CORPSETYPE_BONE = 1
// Elevator pathing-blocker destructable code
constant integer bj_ELEVATOR_BLOCKER_CODE = 'DTep'
constant integer bj_ELEVATOR_CODE01 = 'DTrf'
constant integer bj_ELEVATOR_CODE02 = 'DTrx'
// Elevator wall codes
constant integer bj_ELEVATOR_WALL_TYPE_ALL = 0
constant integer bj_ELEVATOR_WALL_TYPE_EAST = 1
constant integer bj_ELEVATOR_WALL_TYPE_NORTH = 2
constant integer bj_ELEVATOR_WALL_TYPE_SOUTH = 3
constant integer bj_ELEVATOR_WALL_TYPE_WEST = 4
//-----------------------------------------------------------------------
// Variables
//
// Force predefs
force bj_FORCE_ALL_PLAYERS = null
force array bj_FORCE_PLAYER
integer bj_MELEE_MAX_TWINKED_HEROES = 0
// Map area rects
rect bj_mapInitialPlayableArea = null
rect bj_mapInitialCameraBounds = null
// Utility function vars
integer bj_forLoopAIndex = 0
integer bj_forLoopBIndex = 0
integer bj_forLoopAIndexEnd = 0
integer bj_forLoopBIndexEnd = 0
boolean bj_slotControlReady = false
boolean array bj_slotControlUsed
mapcontrol array bj_slotControl
// Game started detection vars
timer bj_gameStartedTimer = null
boolean bj_gameStarted = false
timer bj_volumeGroupsTimer = CreateTimer()
// Singleplayer check
boolean bj_isSinglePlayer = false
// Day/Night Cycle vars
trigger bj_dncSoundsDay = null
trigger bj_dncSoundsNight = null
sound bj_dayAmbientSound = null
sound bj_nightAmbientSound = null
trigger bj_dncSoundsDawn = null
trigger bj_dncSoundsDusk = null
sound bj_dawnSound = null
sound bj_duskSound = null
boolean bj_useDawnDuskSounds = true
boolean bj_dncIsDaytime = false
// Triggered sounds
//sound bj_pingMinimapSound = null
sound bj_rescueSound = null
sound bj_questDiscoveredSound = null
sound bj_questUpdatedSound = null
sound bj_questCompletedSound = null
sound bj_questFailedSound = null
sound bj_questHintSound = null
sound bj_questSecretSound = null
sound bj_questItemAcquiredSound = null
sound bj_questWarningSound = null
sound bj_victoryDialogSound = null
sound bj_defeatDialogSound = null
// Marketplace vars
trigger bj_stockItemPurchased = null
timer bj_stockUpdateTimer = null
boolean array bj_stockAllowedPermanent
boolean array bj_stockAllowedCharged
boolean array bj_stockAllowedArtifact
integer bj_stockPickedItemLevel = 0
itemtype bj_stockPickedItemType
// Melee vars
trigger bj_meleeVisibilityTrained = null
boolean bj_meleeVisibilityIsDay = true
boolean bj_meleeGrantHeroItems = false
location bj_meleeNearestMineToLoc = null
unit bj_meleeNearestMine = null
real bj_meleeNearestMineDist = 0.00
boolean bj_meleeGameOver = false
boolean array bj_meleeDefeated
boolean array bj_meleeVictoried
unit array bj_ghoul
timer array bj_crippledTimer
timerdialog array bj_crippledTimerWindows
boolean array bj_playerIsCrippled
boolean array bj_playerIsExposed
boolean bj_finishSoonAllExposed = false
timerdialog bj_finishSoonTimerDialog = null
integer array bj_meleeTwinkedHeroes
// Rescue behavior vars
trigger bj_rescueUnitBehavior = null
boolean bj_rescueChangeColorUnit = true
boolean bj_rescueChangeColorBldg = true
// Transmission vars
timer bj_cineSceneEndingTimer = null
sound bj_cineSceneLastSound = null
trigger bj_cineSceneBeingSkipped = null
// Cinematic mode vars
gamespeed bj_cineModePriorSpeed = MAP_SPEED_NORMAL
boolean bj_cineModePriorFogSetting = false
boolean bj_cineModePriorMaskSetting = false
boolean bj_cineModeAlreadyIn = false
boolean bj_cineModePriorDawnDusk = false
integer bj_cineModeSavedSeed = 0
// Cinematic fade vars
timer bj_cineFadeFinishTimer = null
timer bj_cineFadeContinueTimer = null
real bj_cineFadeContinueRed = 0
real bj_cineFadeContinueGreen = 0
real bj_cineFadeContinueBlue = 0
real bj_cineFadeContinueTrans = 0
real bj_cineFadeContinueDuration = 0
string bj_cineFadeContinueTex = ""
// QueuedTriggerExecute vars
integer bj_queuedExecTotal = 0
trigger array bj_queuedExecTriggers
boolean array bj_queuedExecUseConds
timer bj_queuedExecTimeoutTimer = CreateTimer()
trigger bj_queuedExecTimeout = null
// Helper vars (for Filter and Enum funcs)
integer bj_destInRegionDiesCount = 0
trigger bj_destInRegionDiesTrig = null
integer bj_groupCountUnits = 0
integer bj_forceCountPlayers = 0
integer bj_groupEnumTypeId = 0
player bj_groupEnumOwningPlayer = null
group bj_groupAddGroupDest = null
group bj_groupRemoveGroupDest = null
integer bj_groupRandomConsidered = 0
unit bj_groupRandomCurrentPick = null
group bj_groupLastCreatedDest = null
group bj_randomSubGroupGroup = null
integer bj_randomSubGroupWant = 0
integer bj_randomSubGroupTotal = 0
real bj_randomSubGroupChance = 0
integer bj_destRandomConsidered = 0
destructable bj_destRandomCurrentPick = null
destructable bj_elevatorWallBlocker = null
destructable bj_elevatorNeighbor = null
integer bj_itemRandomConsidered = 0
item bj_itemRandomCurrentPick = null
integer bj_forceRandomConsidered = 0
player bj_forceRandomCurrentPick = null
unit bj_makeUnitRescuableUnit = null
boolean bj_makeUnitRescuableFlag = true
boolean bj_pauseAllUnitsFlag = true
location bj_enumDestructableCenter = null
real bj_enumDestructableRadius = 0
playercolor bj_setPlayerTargetColor = null
boolean bj_isUnitGroupDeadResult = true
boolean bj_isUnitGroupEmptyResult = true
boolean bj_isUnitGroupInRectResult = true
rect bj_isUnitGroupInRectRect = null
boolean bj_changeLevelShowScores = false
string bj_changeLevelMapName = null
group bj_suspendDecayFleshGroup = CreateGroup()
group bj_suspendDecayBoneGroup = CreateGroup()
timer bj_delayedSuspendDecayTimer = CreateTimer()
trigger bj_delayedSuspendDecayTrig = null
integer bj_livingPlayerUnitsTypeId = 0
widget bj_lastDyingWidget = null
// Random distribution vars
integer bj_randDistCount = 0
integer array bj_randDistID
integer array bj_randDistChance
// Last X'd vars
unit bj_lastCreatedUnit = null
item bj_lastCreatedItem = null
item bj_lastRemovedItem = null
unit bj_lastHauntedGoldMine = null
destructable bj_lastCreatedDestructable = null
group bj_lastCreatedGroup = CreateGroup()
fogmodifier bj_lastCreatedFogModifier = null
effect bj_lastCreatedEffect = null
weathereffect bj_lastCreatedWeatherEffect = null
terraindeformation bj_lastCreatedTerrainDeformation = null
quest bj_lastCreatedQuest = null
questitem bj_lastCreatedQuestItem = null
defeatcondition bj_lastCreatedDefeatCondition = null
timer bj_lastStartedTimer = CreateTimer()
timerdialog bj_lastCreatedTimerDialog = null
leaderboard bj_lastCreatedLeaderboard = null
multiboard bj_lastCreatedMultiboard = null
sound bj_lastPlayedSound = null
string bj_lastPlayedMusic = ""
real bj_lastTransmissionDuration = 0
gamecache bj_lastCreatedGameCache = null
hashtable bj_lastCreatedHashtable = null
unit bj_lastLoadedUnit = null
button bj_lastCreatedButton = null
unit bj_lastReplacedUnit = null
texttag bj_lastCreatedTextTag = null
lightning bj_lastCreatedLightning = null
image bj_lastCreatedImage = null
ubersplat bj_lastCreatedUbersplat = null
minimapicon bj_lastCreatedMinimapIcon = null
commandbuttoneffect bj_lastCreatedCommandButtonEffect = null
// Filter function vars
boolexpr filterIssueHauntOrderAtLocBJ = null
boolexpr filterEnumDestructablesInCircleBJ = null
boolexpr filterGetUnitsInRectOfPlayer = null
boolexpr filterGetUnitsOfTypeIdAll = null
boolexpr filterGetUnitsOfPlayerAndTypeId = null
boolexpr filterMeleeTrainedUnitIsHeroBJ = null
boolexpr filterLivingPlayerUnitsOfTypeId = null
// Memory cleanup vars
boolean bj_wantDestroyGroup = false
// Instanced Operation Results
boolean bj_lastInstObjFuncSuccessful = true
endglobals
//***************************************************************************
//*
//* Debugging Functions
//*
//***************************************************************************
//===========================================================================
function BJDebugMsg takes string msg returns nothing
local integer i = 0
loop
call DisplayTimedTextToPlayer(Player(i),0,0,60,msg)
set i = i + 1
exitwhen i == bj_MAX_PLAYERS
endloop
endfunction
//***************************************************************************
//*
//* Math Utility Functions
//*
//***************************************************************************
//===========================================================================
function RMinBJ takes real a, real b returns real
if (a < b) then
return a
else
return b
endif
endfunction
//===========================================================================
function RMaxBJ takes real a, real b returns real
if (a < b) then
return b
else
return a
endif
endfunction
//===========================================================================
function RAbsBJ takes real a returns real
if (a >= 0) then
return a
else
return -a
endif
endfunction
//===========================================================================
function RSignBJ takes real a returns real
if (a >= 0.0) then
return 1.0
else
return -1.0
endif
endfunction
//===========================================================================
function IMinBJ takes integer a, integer b returns integer
if (a < b) then
return a
else
return b
endif
endfunction
//===========================================================================
function IMaxBJ takes integer a, integer b returns integer
if (a < b) then
return b
else
return a
endif
endfunction
//===========================================================================
function IAbsBJ takes integer a returns integer
if (a >= 0) then
return a
else
return -a
endif
endfunction
//===========================================================================
function ISignBJ takes integer a returns integer
if (a >= 0) then
return 1
else
return -1
endif
endfunction
//===========================================================================
function SinBJ takes real degrees returns real
return Sin(degrees * bj_DEGTORAD)
endfunction
//===========================================================================
function CosBJ takes real degrees returns real
return Cos(degrees * bj_DEGTORAD)
endfunction
//===========================================================================
function TanBJ takes real degrees returns real
return Tan(degrees * bj_DEGTORAD)
endfunction
//===========================================================================
function AsinBJ takes real degrees returns real
return Asin(degrees) * bj_RADTODEG
endfunction
//===========================================================================
function AcosBJ takes real degrees returns real
return Acos(degrees) * bj_RADTODEG
endfunction
//===========================================================================
function AtanBJ takes real degrees returns real
return Atan(degrees) * bj_RADTODEG
endfunction
//===========================================================================
function Atan2BJ takes real y, real x returns real
return Atan2(y, x) * bj_RADTODEG
endfunction
//===========================================================================
function AngleBetweenPoints takes location locA, location locB returns real
return bj_RADTODEG * Atan2(GetLocationY(locB) - GetLocationY(locA), GetLocationX(locB) - GetLocationX(locA))
endfunction
//===========================================================================
function DistanceBetweenPoints takes location locA, location locB returns real
local real dx = GetLocationX(locB) - GetLocationX(locA)
local real dy = GetLocationY(locB) - GetLocationY(locA)
return SquareRoot(dx * dx + dy * dy)
endfunction
//===========================================================================
function PolarProjectionBJ takes location source, real dist, real angle returns location
local real x = GetLocationX(source) + dist * Cos(angle * bj_DEGTORAD)
local real y = GetLocationY(source) + dist * Sin(angle * bj_DEGTORAD)
return Location(x, y)
endfunction
//===========================================================================
function GetRandomDirectionDeg takes nothing returns real
return GetRandomReal(0, 360)
endfunction
//===========================================================================
function GetRandomPercentageBJ takes nothing returns real
return GetRandomReal(0, 100)
endfunction
//===========================================================================
function GetRandomLocInRect takes rect whichRect returns location
return Location(GetRandomReal(GetRectMinX(whichRect), GetRectMaxX(whichRect)), GetRandomReal(GetRectMinY(whichRect), GetRectMaxY(whichRect)))
endfunction
//===========================================================================
// Calculate the modulus/remainder of (dividend) divided by (divisor).
// Examples: 18 mod 5 = 3. 15 mod 5 = 0. -8 mod 5 = 2.
//
function ModuloInteger takes integer dividend, integer divisor returns integer
local integer modulus = dividend - (dividend / divisor) * divisor
// If the dividend was negative, the above modulus calculation will
// be negative, but within (-divisor..0). We can add (divisor) to
// shift this result into the desired range of (0..divisor).
if (modulus < 0) then
set modulus = modulus + divisor
endif
return modulus
endfunction
//===========================================================================
// Calculate the modulus/remainder of (dividend) divided by (divisor).
// Examples: 13.000 mod 2.500 = 0.500. -6.000 mod 2.500 = 1.500.
//
function ModuloReal takes real dividend, real divisor returns real
local real modulus = dividend - I2R(R2I(dividend / divisor)) * divisor
// If the dividend was negative, the above modulus calculation will
// be negative, but within (-divisor..0). We can add (divisor) to
// shift this result into the desired range of (0..divisor).
if (modulus < 0) then
set modulus = modulus + divisor
endif
return modulus
endfunction
//===========================================================================
function OffsetLocation takes location loc, real dx, real dy returns location
return Location(GetLocationX(loc) + dx, GetLocationY(loc) + dy)
endfunction
//===========================================================================
function OffsetRectBJ takes rect r, real dx, real dy returns rect
return Rect( GetRectMinX(r) + dx, GetRectMinY(r) + dy, GetRectMaxX(r) + dx, GetRectMaxY(r) + dy )
endfunction
//===========================================================================
function RectFromCenterSizeBJ takes location center, real width, real height returns rect
local real x = GetLocationX( center )
local real y = GetLocationY( center )
return Rect( x - width*0.5, y - height*0.5, x + width*0.5, y + height*0.5 )
endfunction
//===========================================================================
function RectContainsCoords takes rect r, real x, real y returns boolean
return (GetRectMinX(r) <= x) and (x <= GetRectMaxX(r)) and (GetRectMinY(r) <= y) and (y <= GetRectMaxY(r))
endfunction
//===========================================================================
function RectContainsLoc takes rect r, location loc returns boolean
return RectContainsCoords(r, GetLocationX(loc), GetLocationY(loc))
endfunction
//===========================================================================
function RectContainsUnit takes rect r, unit whichUnit returns boolean
return RectContainsCoords(r, GetUnitX(whichUnit), GetUnitY(whichUnit))
endfunction
//===========================================================================
function RectContainsItem takes item whichItem, rect r returns boolean
if (whichItem == null) then
return false
endif
if (IsItemOwned(whichItem)) then
return false
endif
return RectContainsCoords(r, GetItemX(whichItem), GetItemY(whichItem))
endfunction
//***************************************************************************
//*
//* Utility Constructs
//*
//***************************************************************************
//===========================================================================
// Runs the trigger's actions if the trigger's conditions evaluate to true.
//
function ConditionalTriggerExecute takes trigger trig returns nothing
if TriggerEvaluate(trig) then
call TriggerExecute(trig)
endif
endfunction
//===========================================================================
// Runs the trigger's actions if the trigger's conditions evaluate to true.
//
function TriggerExecuteBJ takes trigger trig, boolean checkConditions returns boolean
if checkConditions then
if not (TriggerEvaluate(trig)) then
return false
endif
endif
call TriggerExecute(trig)
return true
endfunction
//===========================================================================
// Arranges for a trigger to fire almost immediately, except that the calling
// trigger is not interrupted as is the case with a TriggerExecute call.
// Since the trigger executes normally, its conditions are still evaluated.
//
function PostTriggerExecuteBJ takes trigger trig, boolean checkConditions returns boolean
if checkConditions then
if not (TriggerEvaluate(trig)) then
return false
endif
endif
call TriggerRegisterTimerEvent(trig, 0, false)
return true
endfunction
//===========================================================================
// Debug - Display the contents of the trigger queue (as either null or "x"
// for each entry).
function QueuedTriggerCheck takes nothing returns nothing
local string s = "TrigQueue Check "
local integer i
set i = 0
loop
exitwhen i >= bj_queuedExecTotal
set s = s + "q[" + I2S(i) + "]="
if (bj_queuedExecTriggers[i] == null) then
set s = s + "null "
else
set s = s + "x "
endif
set i = i + 1
endloop
set s = s + "(" + I2S(bj_queuedExecTotal) + " total)"
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,600,s)
endfunction
//===========================================================================
// Searches the queue for a given trigger, returning the index of the
// trigger within the queue if it is found, or -1 if it is not found.
//
function QueuedTriggerGetIndex takes trigger trig returns integer
// Determine which, if any, of the queued triggers is being removed.
local integer index = 0
loop
exitwhen index >= bj_queuedExecTotal
if (bj_queuedExecTriggers[index] == trig) then
return index
endif
set index = index + 1
endloop
return -1
endfunction
//===========================================================================
// Removes a trigger from the trigger queue, shifting other triggers down