cheats.j

1
//===========================================================================
2
// Cheats.j
3
//===========================================================================
4
5
6
globals
7
    // Debug-cheat globals
8
    constant real     bj_DEBUG_CAMFIELD_SPEED     = 0
9
    constant string   bj_DEBUG_CHAT_GIMME         = "gimme"
10
    constant string   bj_DEBUG_CHAT_DEMO          = "demo"
11
    constant string   bj_DEBUG_CHAT_TELEPORT      = "teleport"
12
    constant string   bj_DEBUG_CHAT_TELEPORT2     = "ttt"
13
    constant string   bj_DEBUG_CHAT_UNITINFO      = "unitinfo"
14
    constant string   bj_DEBUG_CHAT_UNITINFO2     = "ui"
15
    constant string   bj_DEBUG_CHAT_CAMINFO       = "caminfo"
16
    constant string   bj_DEBUG_CHAT_CAMINFO2      = "ci"
17
    constant string   bj_DEBUG_CHAT_CAMDIST       = "camdist"
18
    constant string   bj_DEBUG_CHAT_CAMFARZ       = "camfarz"
19
    constant string   bj_DEBUG_CHAT_CAMAOA        = "camaoa"
20
    constant string   bj_DEBUG_CHAT_CAMFOV        = "camfov"
21
    constant string   bj_DEBUG_CHAT_CAMROLL       = "camroll"
22
    constant string   bj_DEBUG_CHAT_CAMROT        = "camrot"
23
    constant string   bj_DEBUG_CHAT_CAMRESET      = "camreset"
24
    constant string   bj_DEBUG_CHAT_CLONE         = "clone"
25
    constant string   bj_DEBUG_CHAT_DISPEL        = "dispel"
26
    constant string   bj_DEBUG_CHAT_GOTOX         = "gotox"
27
    constant string   bj_DEBUG_CHAT_GOTOY         = "gotoy"
28
    constant string   bj_DEBUG_CHAT_GOTOXY        = "gotoxy"
29
    constant string   bj_DEBUG_CHAT_GOTOUNIT      = "gotounit"
30
    constant string   bj_DEBUG_CHAT_BLACKMASK     = "blackmask"
31
    constant string   bj_DEBUG_CHAT_BLACKMASK2    = "bm"
32
    constant string   bj_DEBUG_CHAT_DIFFICULTY    = "difficulty"
33
    constant string   bj_DEBUG_CHAT_FINGEROFDEATH = "fingerofdeath"
34
35
    trigger           bj_debugGimmeTrig
36
    trigger           bj_debugDemoTrig
37
    trigger           bj_debugTeleportTrig
38
    trigger           bj_debugUnitInfoTrig
39
    trigger           bj_debugCamInfoTrig
40
    trigger           bj_debugCamDistTrig
41
    trigger           bj_debugCamFarzTrig
42
    trigger           bj_debugCamAoaTrig
43
    trigger           bj_debugCamFovTrig
44
    trigger           bj_debugCamRollTrig
45
    trigger           bj_debugCamRotTrig
46
    trigger           bj_debugCamResetTrig
47
    trigger           bj_debugCloneTrig
48
    trigger           bj_debugDispelTrig
49
    trigger           bj_debugGotoXTrig
50
    trigger           bj_debugGotoYTrig
51
    trigger           bj_debugGotoXYTrig
52
    trigger           bj_debugGotoUnitTrig
53
    trigger           bj_debug_BlackMaskTrig
54
    trigger           bj_debugDifficultyTrig
55
    trigger  array    bj_debugFingerOfDeathTrig
56
    trigger  array    bj_debugToolOfDeathTrig
57
    boolean  array    bj_debugFingerOfDeathEnabled
58
    real              bj_debugGotoUnitX = 0
59
    real              bj_debugGotoUnitY = 0
60
    integer           bj_debugGotoUnits = 0
61
endglobals
62
63
64
65
//***************************************************************************
66
//*
67
//*  Debug cheats
68
//*
69
//***************************************************************************
70
71
//===========================================================================
72
function DebugGimmeEnum takes nothing returns nothing
73
    local player thePlayer = GetEnumPlayer()
74
    call DisplayTextToPlayer(thePlayer, 0, 0, "Player "+I2S(GetPlayerId(GetTriggerPlayer())+1)+" cheated: Give 5000 gold and 5000 lumber to all players")
75
    call SetPlayerState(thePlayer, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(thePlayer, PLAYER_STATE_RESOURCE_GOLD) + 5000)
76
    call SetPlayerState(thePlayer, PLAYER_STATE_RESOURCE_LUMBER, GetPlayerState(thePlayer, PLAYER_STATE_RESOURCE_LUMBER) + 5000)
77
endfunction
78
79
//===========================================================================
80
function DebugGimme takes nothing returns nothing
81
    call ForForce(bj_FORCE_ALL_PLAYERS, function DebugGimmeEnum)
82
endfunction
83
84
//===========================================================================
85
function DebugDemoEnum takes nothing returns nothing
86
    local player thePlayer = GetEnumPlayer()
87
    call SetPlayerState(thePlayer, PLAYER_STATE_RESOURCE_GOLD, 0)
88
    call SetPlayerState(thePlayer, PLAYER_STATE_RESOURCE_LUMBER, 0)
89
endfunction
90
91
//===========================================================================
92
function DebugDemo takes nothing returns nothing
93
    local player thePlayer = GetTriggerPlayer()
94
    local integer gold = GetRandomInt(750, 1500)
95
    local integer lumber = GetRandomInt(200, 450)
96
97
    call ForForce(bj_FORCE_ALL_PLAYERS, function DebugDemoEnum)
98
    call MultiboardSuppressDisplay(true)
99
    if (GetLocalPlayer() == GetTriggerPlayer()) then
100
        call Cheat("warnings")
101
        call Cheat("fastbuild")
102
        call Cheat("techtree")
103
        call Cheat("research")
104
        call Cheat("food")
105
        call Cheat("mana")
106
        call Cheat("dawn")
107
        call Cheat("gold " + I2S(gold))
108
        call Cheat("lumber " + I2S(lumber))
109
    endif
110
endfunction
111
112
//===========================================================================
113
function DebugTeleportEnum takes nothing returns nothing
114
    local unit u = GetEnumUnit()
115
    call SetUnitPosition(u, GetCameraTargetPositionX(), GetCameraTargetPositionY())
116
endfunction
117
118
//===========================================================================
119
function DebugTeleport takes nothing returns nothing
120
    local group g = CreateGroup()
121
    call SyncSelections()
122
    call GroupEnumUnitsSelected(g, GetTriggerPlayer(), null)
123
    call ForGroup(g, function DebugTeleportEnum)
124
endfunction
125
126
//===========================================================================
127
function TertiaryStringOp takes boolean expr, string a, string b returns string
128
    if (expr) then
129
        return a
130
    else
131
        return b
132
    endif
133
endfunction
134
135
//===========================================================================
136
// Convert a integer id value into a 4-letter id code.
137
//
138
function DebugIdInteger2IdString takes integer value returns string
139
    local string charMap = ".................................!.#$%&'()*+,-./0123456789:;<=>.@ABCDEFGHIJKLMNOPQRSTUVWXYZ[.]^_`abcdefghijklmnopqrstuvwxyz{|}~................................................................................................................................."
140
    local string result = ""
141
    local integer remainingValue = value
142
    local integer charValue
143
    local integer byteno
144
145
    set byteno = 0
146
    loop
147
        set charValue = ModuloInteger(remainingValue, 256)
148
        set remainingValue = remainingValue / 256
149
        set result = SubString(charMap, charValue, charValue + 1) + result
150
151
        set byteno = byteno + 1
152
        exitwhen byteno == 4
153
    endloop
154
    return result
155
endfunction
156
157
//===========================================================================
158
function DebugUnitInfoEnum takes nothing returns nothing
159
    local player thePlayer = GetTriggerPlayer()
160
    local unit   theUnit   = GetEnumUnit()
161
    local string message
162
163
    set message = "Player " + I2S(GetPlayerId(GetOwningPlayer(theUnit))+1)
164
    set message = message + " '" + DebugIdInteger2IdString(GetUnitTypeId(theUnit)) + "'"
165
    set message = message + " " + GetUnitName(theUnit)
166
    set message = message + " (" + R2SW(GetUnitX(theUnit), 0, 0) + ", " + R2SW(GetUnitY(theUnit), 0, 0)
167
    set message = message + ": " + R2SW(GetUnitFacing(theUnit), 0, 0) + ") "
168
    set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_HERO),            " Hero",      "")
169
    set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_DEAD),            " Dead",      "")
170
    set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_STRUCTURE),       " Structure", "")
171
    set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_GROUND),          " Grnd",      "")
172
    set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_FLYING),          " Air",       "")
173
    set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_ATTACKS_GROUND),  " VsGrnd",    "")
174
    set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_ATTACKS_FLYING),  " VsAir",     "")
175
    set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_MELEE_ATTACKER),  " Melee",     "")
176
    set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_RANGED_ATTACKER), " Ranged",    "")
177
    set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_SUMMONED),        " Summoned",  "")
178
179
    call DisplayTextToPlayer(thePlayer, 0, 0, message)
180
endfunction
181
182
//===========================================================================
183
function DebugUnitInfo takes nothing returns nothing
184
    local group g = CreateGroup()
185
    call SyncSelections()
186
    call GroupEnumUnitsSelected(g, GetTriggerPlayer(), null)
187
    call ForGroup(g, function DebugUnitInfoEnum)
188
endfunction
189
190
//===========================================================================
191
function DebugCamInfo takes nothing returns nothing
192
    local player thePlayer = GetTriggerPlayer()
193
    local string message
194
195
    set message = "Targ(" + R2SW(GetCameraTargetPositionX(), 0, 0)
196
    set message = message + "," + R2SW(GetCameraTargetPositionY(), 0, 0)
197
    set message = message + "," + R2SW(GetCameraTargetPositionZ(), 0, 0)
198
    set message = message + ")"
199
    set message = message + ", Dist=" + R2SW(GetCameraField(CAMERA_FIELD_TARGET_DISTANCE), 0, 0)
200
    set message = message + ", FarZ=" + R2SW(GetCameraField(CAMERA_FIELD_FARZ), 0, 0)
201
    set message = message + ", AoA=" + R2SW(GetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK) * bj_RADTODEG, 0, 2)
202
    set message = message + ", FoV=" + R2SW(GetCameraField(CAMERA_FIELD_FIELD_OF_VIEW) * bj_RADTODEG, 0, 2)
203
    set message = message + ", Roll=" + R2SW(GetCameraField(CAMERA_FIELD_ROLL) * bj_RADTODEG, 0, 2)
204
    set message = message + ", Rot=" + R2SW(GetCameraField(CAMERA_FIELD_ROTATION) * bj_RADTODEG, 0, 2)
205
    set message = message + ", LocalPitch=" + R2SW(GetCameraField(CAMERA_FIELD_LOCAL_PITCH) * bj_RADTODEG, 0, 2)
206
    set message = message + ", LocalYaw=" + R2SW(GetCameraField(CAMERA_FIELD_LOCAL_YAW) * bj_RADTODEG, 0, 2)
207
    set message = message + ", LocalRoll=" + R2SW(GetCameraField(CAMERA_FIELD_LOCAL_ROLL) * bj_RADTODEG, 0, 2)
208
209
    call DisplayTextToPlayer(thePlayer, 0, 0, message)
210
endfunction
211
212
//===========================================================================
213
function DebugCamField takes camerafield whichField, integer cheatLength, real defaultValue returns nothing
214
    local string param        = SubString(GetEventPlayerChatString(), cheatLength, 50)
215
    local real   value        = S2R(param)
216
217
    // Remove any excess preceding whitespace
218
    loop
219
        exitwhen not (SubString(param, 0, 1) == " ")
220
        set param = SubString(param, 1, 50)
221
    endloop
222
223
    if param == "" then
224
        set value = defaultValue
225
    endif
226
    if (whichField == CAMERA_FIELD_FARZ) and (value <= bj_CAMERA_MIN_FARZ) then
227
        return
228
    endif
229
    call SetCameraFieldForPlayer(GetTriggerPlayer(), whichField, value, bj_DEBUG_CAMFIELD_SPEED)
230
endfunction
231
232
//===========================================================================
233
function DebugCamDist takes nothing returns nothing
234
    call DebugCamField(CAMERA_FIELD_TARGET_DISTANCE, 7, 1600)
235
endfunction
236
237
//===========================================================================
238
function DebugCamFarZ takes nothing returns nothing
239
    call DebugCamField(CAMERA_FIELD_FARZ, 7, 4000)
240
endfunction
241
242
//===========================================================================
243
function DebugCamFOV takes nothing returns nothing
244
    call DebugCamField(CAMERA_FIELD_FIELD_OF_VIEW, 6, 65)
245
endfunction
246
247
//===========================================================================
248
function DebugCamAOA takes nothing returns nothing
249
    call DebugCamField(CAMERA_FIELD_ANGLE_OF_ATTACK, 6, 310)
250
endfunction
251
252
//===========================================================================
253
function DebugCamRoll takes nothing returns nothing
254
    call DebugCamField(CAMERA_FIELD_ROLL, 7, 0)
255
endfunction
256
257
//===========================================================================
258
function DebugCamRot takes nothing returns nothing
259
    call DebugCamField(CAMERA_FIELD_ROTATION, 6, 90)
260
endfunction
261
262
//===========================================================================
263
function DebugCamReset takes nothing returns nothing
264
    call ResetToGameCamera(0)
265
    call EnableUserControl(true)
266
endfunction
267
268
//===========================================================================
269
function DebugCloneUnitEnum takes nothing returns nothing
270
    local unit u = GetEnumUnit()
271
    call CreateUnit(GetOwningPlayer(u), GetUnitTypeId(u), GetUnitX(u), GetUnitY(u), GetUnitFacing(u))
272
endfunction
273
274
//===========================================================================
275
function DebugCloneUnit takes nothing returns nothing
276
    local group g = CreateGroup()
277
    call SyncSelections()
278
    call GroupEnumUnitsSelected(g, GetTriggerPlayer(), null)
279
    call ForGroup(g, function DebugCloneUnitEnum)
280
endfunction
281
282
//===========================================================================
283
function DebugDispelUnitEnum takes nothing returns nothing
284
    call UnitRemoveBuffs(GetEnumUnit(), true, true)
285
endfunction
286
287
//===========================================================================
288
function DebugDispelUnit takes nothing returns nothing
289
    local group g = CreateGroup()
290
    call SyncSelections()
291
    call GroupEnumUnitsSelected(g, GetTriggerPlayer(), null)
292
    call ForGroup(g, function DebugDispelUnitEnum)
293
endfunction
294
295
//===========================================================================
296
function DebugGotoX takes nothing returns nothing
297
    local string chatString = GetEventPlayerChatString()
298
299
    if (bj_DEBUG_CHAT_GOTOX + " " == SubString(chatString, 0, 6)) then
300
        call SetCameraPositionForPlayer(GetTriggerPlayer(), S2R(SubString(chatString, 6, 50)), GetCameraTargetPositionY())
301
    endif
302
endfunction
303
304
//===========================================================================
305
function DebugGotoY takes nothing returns nothing
306
    local string chatString = GetEventPlayerChatString()
307
308
    if (bj_DEBUG_CHAT_GOTOY + " " == SubString(chatString, 0, 6)) then
309
        call SetCameraPositionForPlayer(GetTriggerPlayer(), GetCameraTargetPositionX(), S2R(SubString(chatString, 6, 50)))
310
    endif
311
endfunction
312
313
//===========================================================================
314
function DebugGotoXY takes nothing returns nothing
315
    local string chatString = GetEventPlayerChatString()
316
    local integer index
317
    local boolean inParam1
318
319
    if (bj_DEBUG_CHAT_GOTOXY + " " == SubString(chatString, 0, 7)) then
320
        set inParam1 = false
321
        set index = 7
322
        loop
323
            if (SubString(chatString, index, index + 1) != " ") then
324
                set inParam1 = true
325
            endif
326
327
            exitwhen (inParam1 and SubString(chatString, index, index + 1) == " ")
328
            exitwhen index > 50
329
            set index = index + 1
330
        endloop
331
332
        if (index > 50) then
333
            call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "Usage:  GotoXY x y")
334
        else
335
            if (GetLocalPlayer() == GetTriggerPlayer()) then
336
                call SetCameraPositionForPlayer(GetTriggerPlayer(), S2R(SubString(chatString, 7, index)), S2R(SubString(chatString, index, 50)))
337
            endif
338
        endif
339
    endif
340
endfunction
341
342
//===========================================================================
343
function DebugGotoUnitEnum takes nothing returns nothing
344
    local unit u = GetEnumUnit()
345
346
    set bj_debugGotoUnitX = bj_debugGotoUnitX + GetUnitX(u)
347
    set bj_debugGotoUnitY = bj_debugGotoUnitY + GetUnitY(u)
348
    set bj_debugGotoUnits = bj_debugGotoUnits + 1
349
endfunction
350
351
//===========================================================================
352
function DebugGotoUnit takes nothing returns nothing
353
    local group g = CreateGroup()
354
355
    set bj_debugGotoUnitX = 0
356
    set bj_debugGotoUnitY = 0
357
    set bj_debugGotoUnits = 0
358
359
    call SyncSelections()
360
    call GroupEnumUnitsSelected(g, GetTriggerPlayer(), null)
361
    call ForGroup(g, function DebugGotoUnitEnum)
362
363
    if (bj_debugGotoUnits != 0) then
364
        set bj_debugGotoUnitX = bj_debugGotoUnitX / bj_debugGotoUnits
365
        set bj_debugGotoUnitY = bj_debugGotoUnitY / bj_debugGotoUnits
366
        call SetCameraPositionForPlayer(GetTriggerPlayer(), bj_debugGotoUnitX, bj_debugGotoUnitY)
367
    endif
368
endfunction
369
370
//===========================================================================
371
function DebugBlackMask takes nothing returns nothing
372
    call SetFogStateRect(GetTriggerPlayer(), FOG_OF_WAR_MASKED, GetWorldBounds(), true)
373
endfunction
374
375
//===========================================================================
376
function DebugDifficulty takes nothing returns nothing
377
    local player         thePlayer = GetTriggerPlayer()
378
    local gamedifficulty theDiff   = GetGameDifficulty()
379
380
    if (theDiff == MAP_DIFFICULTY_EASY) then
381
        call DisplayTextToPlayer(thePlayer, 0, 0, "Easy Difficulty")
382
    elseif (theDiff == MAP_DIFFICULTY_NORMAL) then
383
        call DisplayTextToPlayer(thePlayer, 0, 0, "Normal Difficulty")
384
    elseif (theDiff == MAP_DIFFICULTY_HARD) then
385
        call DisplayTextToPlayer(thePlayer, 0, 0, "Hard Difficulty")
386
    else
387
        call DisplayTextToPlayer(thePlayer, 0, 0, "ERROR!  Unrecognized Difficulty")
388
    endif
389
endfunction
390
391
//===========================================================================
392
function DebugToolOfDeath takes nothing returns nothing
393
    call KillUnit(GetTriggerUnit())
394
endfunction
395
396
//===========================================================================
397
function DebugToggleFingerOfDeath takes nothing returns nothing
398
    local integer index = GetPlayerId(GetTriggerPlayer())
399
    if (bj_debugFingerOfDeathEnabled[index]) then
400
        call DisplayTextToPlayer(Player(index), 0, 0, "Finger Of Death Disabled")
401
        call DisableTrigger(bj_debugToolOfDeathTrig[index])
402
    else
403
        call DisplayTextToPlayer(Player(index), 0, 0, "Finger Of Death Enabled")
404
        call EnableTrigger(bj_debugToolOfDeathTrig[index])
405
    endif
406
    set bj_debugFingerOfDeathEnabled[index] = not bj_debugFingerOfDeathEnabled[index]
407
endfunction
408
409
//===========================================================================
410
function InitDebugTriggers takes nothing returns boolean
411
    local player  indexPlayer
412
    local integer index
413
414
    set index = 0
415
    loop
416
        set indexPlayer = Player(index)
417
        if (GetPlayerSlotState(indexPlayer) == PLAYER_SLOT_STATE_PLAYING) then
418
            set bj_debugGimmeTrig = CreateTrigger()
419
            call TriggerRegisterPlayerChatEvent(bj_debugGimmeTrig, indexPlayer, bj_DEBUG_CHAT_GIMME, true)
420
            call TriggerAddAction(bj_debugGimmeTrig, function DebugGimme)
421
422
            set bj_debugDemoTrig = CreateTrigger()
423
            call TriggerRegisterPlayerChatEvent(bj_debugDemoTrig, indexPlayer, bj_DEBUG_CHAT_DEMO, true)
424
            call TriggerAddAction(bj_debugDemoTrig, function DebugDemo)
425
426
            set bj_debugTeleportTrig = CreateTrigger()
427
            call TriggerRegisterPlayerChatEvent(bj_debugTeleportTrig, indexPlayer, bj_DEBUG_CHAT_TELEPORT, true)
428
            call TriggerRegisterPlayerChatEvent(bj_debugTeleportTrig, indexPlayer, bj_DEBUG_CHAT_TELEPORT2, true)
429
            call TriggerAddAction(bj_debugTeleportTrig, function DebugTeleport)
430
431
            set bj_debugUnitInfoTrig = CreateTrigger()
432
            call TriggerRegisterPlayerChatEvent(bj_debugUnitInfoTrig, indexPlayer, bj_DEBUG_CHAT_UNITINFO, true)
433
            call TriggerRegisterPlayerChatEvent(bj_debugUnitInfoTrig, indexPlayer, bj_DEBUG_CHAT_UNITINFO2, true)
434
            call TriggerAddAction(bj_debugUnitInfoTrig, function DebugUnitInfo)
435
436
            set bj_debugCamInfoTrig = CreateTrigger()
437
            call TriggerRegisterPlayerChatEvent(bj_debugCamInfoTrig, indexPlayer, bj_DEBUG_CHAT_CAMINFO, true)
438
            call TriggerRegisterPlayerChatEvent(bj_debugCamInfoTrig, indexPlayer, bj_DEBUG_CHAT_CAMINFO2, true)
439
            call TriggerAddAction(bj_debugCamInfoTrig, function DebugCamInfo)
440
441
            set bj_debugCamDistTrig = CreateTrigger()
442
            call TriggerRegisterPlayerChatEvent(bj_debugCamDistTrig, indexPlayer, bj_DEBUG_CHAT_CAMDIST, false)
443
            call TriggerAddAction(bj_debugCamDistTrig, function DebugCamDist)
444
445
            set bj_debugCamFarzTrig = CreateTrigger()
446
            call TriggerRegisterPlayerChatEvent(bj_debugCamFarzTrig, indexPlayer, bj_DEBUG_CHAT_CAMFARZ, false)
447
            call TriggerAddAction(bj_debugCamFarzTrig, function DebugCamFarZ)
448
449
            set bj_debugCamFovTrig = CreateTrigger()
450
            call TriggerRegisterPlayerChatEvent(bj_debugCamFovTrig, indexPlayer, bj_DEBUG_CHAT_CAMFOV, false)
451
            call TriggerAddAction(bj_debugCamFovTrig, function DebugCamFOV)
452
453
            set bj_debugCamAoaTrig = CreateTrigger()
454
            call TriggerRegisterPlayerChatEvent(bj_debugCamAoaTrig, indexPlayer, bj_DEBUG_CHAT_CAMAOA, false)
455
            call TriggerAddAction(bj_debugCamAoaTrig, function DebugCamAOA)
456
457
            set bj_debugCamRollTrig = CreateTrigger()
458
            call TriggerRegisterPlayerChatEvent(bj_debugCamRollTrig, indexPlayer, bj_DEBUG_CHAT_CAMROLL, false)
459
            call TriggerAddAction(bj_debugCamRollTrig, function DebugCamRoll)
460
461
            set bj_debugCamRotTrig = CreateTrigger()
462
            call TriggerRegisterPlayerChatEvent(bj_debugCamRotTrig, indexPlayer, bj_DEBUG_CHAT_CAMROT, false)
463
            call TriggerAddAction(bj_debugCamRotTrig, function DebugCamRot)
464
465
            set bj_debugCamResetTrig = CreateTrigger()
466
            call TriggerRegisterPlayerChatEvent(bj_debugCamResetTrig, indexPlayer, bj_DEBUG_CHAT_CAMRESET, true)
467
            call TriggerAddAction(bj_debugCamResetTrig, function DebugCamReset)
468
469
            set bj_debugCloneTrig = CreateTrigger()
470
            call TriggerRegisterPlayerChatEvent(bj_debugCloneTrig, indexPlayer, bj_DEBUG_CHAT_CLONE, true)
471
            call TriggerAddAction(bj_debugCloneTrig, function DebugCloneUnit)
472
473
            set bj_debugDispelTrig = CreateTrigger()
474
            call TriggerRegisterPlayerChatEvent(bj_debugDispelTrig, indexPlayer, bj_DEBUG_CHAT_DISPEL, true)
475
            call TriggerAddAction(bj_debugDispelTrig, function DebugDispelUnit)
476
477
            set bj_debugGotoXTrig = CreateTrigger()
478
            call TriggerRegisterPlayerChatEvent(bj_debugGotoXTrig, indexPlayer, bj_DEBUG_CHAT_GOTOX, false)
479
            call TriggerAddAction(bj_debugGotoXTrig, function DebugGotoX)
480
481
            set bj_debugGotoYTrig = CreateTrigger()
482
            call TriggerRegisterPlayerChatEvent(bj_debugGotoYTrig, indexPlayer, bj_DEBUG_CHAT_GOTOY, false)
483
            call TriggerAddAction(bj_debugGotoYTrig, function DebugGotoY)
484
485
            set bj_debugGotoXYTrig = CreateTrigger()
486
            call TriggerRegisterPlayerChatEvent(bj_debugGotoXYTrig, indexPlayer, bj_DEBUG_CHAT_GOTOXY, false)
487
            call TriggerAddAction(bj_debugGotoXYTrig, function DebugGotoXY)
488
489
            set bj_debugGotoUnitTrig = CreateTrigger()
490
            call TriggerRegisterPlayerChatEvent(bj_debugGotoUnitTrig, indexPlayer, bj_DEBUG_CHAT_GOTOUNIT, true)
491
            call TriggerAddAction(bj_debugGotoUnitTrig, function DebugGotoUnit)
492
493
            set bj_debug_BlackMaskTrig = CreateTrigger()
494
            call TriggerRegisterPlayerChatEvent(bj_debug_BlackMaskTrig, indexPlayer, bj_DEBUG_CHAT_BLACKMASK, true)
495
            call TriggerRegisterPlayerChatEvent(bj_debug_BlackMaskTrig, indexPlayer, bj_DEBUG_CHAT_BLACKMASK2, true)
496
            call TriggerAddAction(bj_debug_BlackMaskTrig, function DebugBlackMask)
497
498
            set bj_debugDifficultyTrig = CreateTrigger()
499
            call TriggerRegisterPlayerChatEvent(bj_debugDifficultyTrig, indexPlayer, bj_DEBUG_CHAT_DIFFICULTY, true)
500
            call TriggerAddAction(bj_debugDifficultyTrig, function DebugDifficulty)
501
502
            set bj_debugFingerOfDeathEnabled[index] = false
503
504
            set bj_debugToolOfDeathTrig[index] = CreateTrigger()
505
            call TriggerRegisterPlayerUnitEvent(bj_debugToolOfDeathTrig[index], indexPlayer, EVENT_PLAYER_UNIT_SELECTED, null)
506
            call TriggerAddAction(bj_debugToolOfDeathTrig[index], function DebugToolOfDeath)
507
            call DisableTrigger(bj_debugToolOfDeathTrig[index])
508
509
            set bj_debugFingerOfDeathTrig[index] = CreateTrigger()
510
            call TriggerRegisterPlayerChatEvent(bj_debugFingerOfDeathTrig[index], indexPlayer, bj_DEBUG_CHAT_FINGEROFDEATH, true)
511
            call TriggerAddAction(bj_debugFingerOfDeathTrig[index], function DebugToggleFingerOfDeath)
512
        endif
513
514
        set index = index + 1
515
        exitwhen index == bj_MAX_PLAYERS
516
    endloop
517
518
    return true
519
endfunction
520