View difference between Paste ID: USZNX9qj and tREBhu8V
SHOW: | | - or go back to the newest paste.
1-
Hi,
1+
groupid = 800
2
3-
I'm having some issues with the addgroup script, it seems that sometimes it works and sometimes it doesn't :huh:
3+
4
								["groupId"] = groupid,
5-
The trigger is simple -
5+
6-
Switched condition - Group dead - Do script, activate group.
6+
7-
[SPOILER]coalition.addGroup(country.id.USA, Group.Category.AIRPLANE, {
7+
8
                                    [1] = 
9-
                                ["tasks"] = 
9+
10
                                        ["alt"] = 449,
11-
                                }, -- end of ["tasks"]
11+
12-
                                ["radioSet"] = false,
12+
13-
                                ["task"] = "CAP",
13+
14-
                                ["uncontrolled"] = false,
14+
15-
                                ["route"] = 
15+
16
                                            [3] = 1,
17-
                                    ["points"] = 
17+
18
                                        }, -- end of ["callsign"]
19-
                                        [1] = 
19+
20
                                        ["livery_id"] = "104th FS Maryland ANG, Baltimore (MD)",
21-
                                            ["alt"] = 320,
21+
22-
                                            ["type"] = "TakeOff",
22+
23-
                                            ["action"] = "From Runway",
23+
24-
                                            ["alt_type"] = "BARO",
24+
25-
                                            ["formation_template"] = "",
25+
26-
                                            ["properties"] = 
26+
27
                                        {
28-
                                                ["vnav"] = 1,
28+
29-
                                                ["scale"] = 0,
29+
30-
                                                ["angle"] = 0,
30+
31-
                                                ["vangle"] = 0,
31+
32-
                                                ["steer"] = 2,
32+
33-
                                            }, -- end of ["properties"]
33+
34-
                                            ["ETA"] = 0,
34+
35-
                                            ["airdromeId"] = 26,
35+
36-
                                            ["y"] = 705718.47981263,
36+
37-
                                            ["x"] = -51251.551717591,
37+
38-
                                            ["speed"] = 138.88888888889,
38+
39-
                                            ["ETA_locked"] = true,
39+
40-
                                            ["task"] = 
40+
41
                                            ["ammo_type"] = 1,
42-
                                                ["id"] = "ComboTask",
42+
43-
                                                ["params"] = 
43+
44
                                        }, -- end of ["payload"]
45-
                                                    ["tasks"] = 
45+
46-
                                                    {
46+
47-
                                                        [1] = 
47+
48-
                                                        {
48+
49-
                                                            ["enabled"] = true,
49+
50-
                                                            ["key"] = "CAP",
50+
51-
                                                            ["id"] = "EngageTargets",
51+
52-
                                                            ["number"] = 1,
52+
53-
                                                            ["auto"] = true,
53+
54-
                                                            ["params"] = 
54+
55-
                                                            {
55+
56-
                                                                ["targetTypes"] = 
56+
57-
                                                                {
57+
58-
                                                                    [1] = "Air",
58+
59-
                                                                }, -- end of ["targetTypes"]
59+
60-
                                                                ["priority"] = 0,
60+
61-
                                                            }, -- end of ["params"]
61+
62-
                                                        }, -- end of [1]
62+
63-
                                                        [2] = 
63+
64-
                                                        {
64+
65-
                                                            ["number"] = 2,
65+
66-
                                                            ["auto"] = false,
66+
67-
                                                            ["id"] = "WrappedAction",
67+
68-
                                                            ["enabled"] = true,
68+
69-
                                                            ["params"] = 
69+
70-
                                                            {
70+
71-
                                                                ["action"] = 
71+
72-
                                                                {
72+
73-
                                                                    ["id"] = "Option",
73+
74-
                                                                    ["params"] = 
74+
75-
                                                                    {
75+
76-
                                                                        ["value"] = 1,
76+
77-
                                                                        ["name"] = 0,
77+
78-
                                                                    }, -- end of ["params"]
78+
79-
                                                                }, -- end of ["action"]
79+
80-
                                                            }, -- end of ["params"]
80+
81-
                                                        }, -- end of [2]
81+
82-
                                                    }, -- end of ["tasks"]
82+
83-
                                                }, -- end of ["params"]
83+
84-
                                            }, -- end of ["task"]
84+
85-
                                            ["speed_locked"] = true,
85+
86-
                                        }, -- end of [1]
86+
87-
                                        [2] = 
87+
88
                                                [7] = 
89-
                                            ["alt"] = 1524,
89+
90-
                                            ["type"] = "Turning Point",
90+
91-
                                            ["action"] = "Turning Point",
91+
92-
                                            ["alt_type"] = "BARO",
92+
93-
                                            ["formation_template"] = "",
93+
94-
                                            ["properties"] = 
94+
95
                                                }, -- end of [6]
96-
                                                ["vnav"] = 1,
96+
97-
                                                ["scale"] = 0,
97+
98-
                                                ["angle"] = 0,
98+
99-
                                                ["vangle"] = 0,
99+
100-
                                                ["steer"] = 2,
100+
101-
                                            }, -- end of ["properties"]
101+
102-
                                            ["ETA"] = 390.41662629717,
102+
103-
                                            ["y"] = 744407.42857143,
103+
104-
                                            ["x"] = -104979.42857143,
104+
105-
                                            ["speed"] = 169.58333333333,
105+
106-
                                            ["ETA_locked"] = false,
106+
107-
                                            ["task"] = 
107+
108
                                ["y"] = 895424.57142858,
109-
                                                ["id"] = "ComboTask",
109+
110-
                                                ["params"] = 
110+
111
                                ["communication"] = true,
112-
                                                    ["tasks"] = 
112+
113-
                                                    {
113+
114-
                                                        [1] = 
114+
115-
                                                        {
115+
116-
                                                            ["enabled"] = true,
116+
117-
                                                            ["auto"] = false,
117+
118-
                                                            ["id"] = "Orbit",
118+
119-
                                                            ["number"] = 1,
119+
120-
                                                            ["params"] = 
120+
121-
                                                            {
121+
122-
                                                                ["altitude"] = 1524,
122+
123-
                                                                ["pattern"] = "Race-Track",
123+
124-
                                                                ["speed"] = 169.58333333333,
124+
125-
                                                                ["speedEdited"] = true,
125+
126-
                                                            }, -- end of ["params"]
126+
127-
                                                        }, -- end of [1]
127+
128-
                                                    }, -- end of ["tasks"]
128+
129-
                                                }, -- end of ["params"]
129+
130-
                                            }, -- end of ["task"]
130+
131-
                                            ["speed_locked"] = true,
131+
132-
                                        }, -- end of [2]
132+
133-
                                        [3] = 
133+
134
                                        ["onboard_num"] = "56",
135-
                                            ["alt"] = 333,
135+
136-
                                            ["type"] = "Turning Point",
136+
137-
                                            ["action"] = "Turning Point",
137+
138-
                                            ["alt_type"] = "BARO",
138+
139-
                                            ["formation_template"] = "",
139+
140-
                                            ["properties"] = 
140+
141
                                            ["pylons"] = 
142-
                                                ["vnav"] = 1,
142+
143-
                                                ["scale"] = 0,
143+
144-
                                                ["angle"] = 0,
144+
145-
                                                ["vangle"] = 0,
145+
146-
                                                ["steer"] = 2,
146+
147-
                                            }, -- end of ["properties"]
147+
148-
                                            ["ETA"] = 825.1362291002,
148+
149-
                                            ["y"] = 800407.42857143,
149+
150-
                                            ["x"] = -82408,
150+
151-
                                            ["speed"] = 138.88888888889,
151+
152-
                                            ["ETA_locked"] = false,
152+
153-
                                            ["task"] = 
153+
154
                                                }, -- end of [9]
155-
                                                ["id"] = "ComboTask",
155+
156-
                                                ["params"] = 
156+
157
                                                    ["CLSID"] = "{9BFD8C90-F7AE-4e90-833B-BFD0CED0E536}",
158-
                                                    ["tasks"] = 
158+
159-
                                                    {
159+
160-
                                                    }, -- end of ["tasks"]
160+
161-
                                                }, -- end of ["params"]
161+
162-
                                            }, -- end of ["task"]
162+
163-
                                            ["speed_locked"] = true,
163+
164-
                                        }, -- end of [3]
164+
165-
                                    }, -- end of ["points"]
165+
166-
                                }, -- end of ["route"]
166+
167-
                                ["groupId"] = 287,
167+
168
                                        ["skill"] = "Random",
169
                                    }, -- end of [1]
170
                                }, -- end of ["units"]
171
                                ["y"] = 895424.57142858,
172
                                ["x"] = -317838.57142857,
173-
                                        ["alt"] = 320,
173+
174-
                                        ["heading"] = 2.5175098164787,
174+
175
                                ["start_time"] = 0,
176
                                ["modulation"] = 0,
177-
                                            [1] = 4,
177+
178
			),
179
su27 = 		(
180-
                                            ["name"] = "Colt11",
180+
181
                                ["hidden"] = false,
182-
                                        ["psi"] = -2.5175098164787,
182+
183
                                {
184-
                                        ["onboard_num"] = "55",
184+
185
                                    {
186-
                                        ["y"] = 705718.47981263,
186+
187-
                                        ["x"] = -51251.551717591,
187+
188-
                                        ["name"] = "F15_1",
188+
189
                                        ["psi"] = 0,
190
                                        ["livery_id"] = "Air Force Standard",
191
                                        ["onboard_num"] = "56",
192
                                        ["type"] = "Su-27",
193
                                        ["y"] = 895424.57142858,
194
                                        ["x"] = -317838.57142857,
195-
                                                    ["CLSID"] = "{D078E3E5-30C1-444e-A09E-6EEDCD334582}",
195+
196
                                        ["payload"] = 
197
                                        {
198
                                            ["pylons"] = 
199-
                                                    ["CLSID"] = "{E1F29B21-F291-4589-9FD8-3272EEC69506}",
199+
200
                                                [1] = 
201
                                                {
202
                                                    ["CLSID"] = "{FBC29BFE-3D24-4C64-B81D-941239D12249}",
203
                                                }, -- end of [1]
204
                                                [2] = 
205
                                                {
206
                                                    ["CLSID"] = "{FBC29BFE-3D24-4C64-B81D-941239D12249}",
207-
                                                    ["CLSID"] = "{8D399DDA-FF81-4F14-904D-099B34FE7918}",
207+
208
                                                [9] = 
209-
                                                [5] = 
209+
210
                                                    ["CLSID"] = "{FBC29BFE-3D24-4C64-B81D-941239D12249}",
211-
                                                    ["CLSID"] = "{02CAFD34-010A-4874-8506-4A7C89210353}",
211+
212-
                                                }, -- end of [5]
212+
213
                                                {
214
                                                    ["CLSID"] = "{FBC29BFE-3D24-4C64-B81D-941239D12249}",
215-
                                                    ["CLSID"] = "{E1F29B21-F291-4589-9FD8-3272EEC69506}",
215+
216
                                            }, -- end of ["pylons"]
217
                                            ["fuel"] = "9400",
218
                                            ["flare"] = 96,
219-
                                                    ["CLSID"] = "{8D399DDA-FF81-4F14-904D-099B34FE7918}",
219+
220
                                            ["gun"] = 100,
221-
                                                [8] = 
221+
222
                                        ["speed"] = 138.88888888889,
223-
                                                    ["CLSID"] = "{33556742-C0F5-4643-BD8F-530B4DEC719B}",
223+
224-
                                                }, -- end of [8]
224+
225
                                        ["skill"] = "Random",
226
                                    }, -- end of [1]
227
                                }, -- end of ["units"]
228
                                ["y"] = 895424.57142858,
229
                                ["x"] = -317838.57142857,
230
                                ["name"] = "Su-27" .. groupid,
231-
                                                    ["CLSID"] = "{E1F29B21-F291-4589-9FD8-3272EEC69506}",
231+
232
                                ["start_time"] = 0,
233
                                ["modulation"] = 0,
234
                                ["frequency"] = 124,
235-
                                                    ["CLSID"] = "{34271A1E-477E-4754-8C72-DF7C1855A782}",
235+
236
su33 = 		(
237
								["groupId"] = groupid,
238
                                ["hidden"] = false,
239
                                ["units"] = 
240
                                {
241
                                    [1] = 
242
                                    {
243
                                        ["alt"] = 449,
244-
                                        ["unitId"] = 475,
244+
245
                                        ["callsign"] = 116,
246
                                        ["psi"] = 0,
247
                                        ["livery_id"] = "279th kiap 1st squad navy",
248
                                        ["onboard_num"] = "56",
249-
                                ["y"] = 705718.47981263,
249+
250-
                                ["x"] = -51251.551717591,
250+
251-
                                ["name"] = "AI - F-15C",
251+
252
                                        ["name"] = "Su-33" .. groupid,
253
                                        ["payload"] = 
254
                                        {
255-
                            })[/SPOILER]
255+
256
                                            {
257-
After the F-15 is destroyed it should be respawning at the Miner...Vody, in Runway position, it sometimes work and sometimes doesn't, I've tried to experiment with the other takeoff options such as ramp and hot, both don't work - no spawn at all.
257+
258-
Another issue is that if i destroy the F-15 The trigger will sometimes start before I get the kill message and the score.
258+
259
                                                    ["CLSID"] = "{FBC29BFE-3D24-4C64-B81D-941239D12249}",
260-
Is there a way to change the trigger to fix these issues?
260+
261
                                                [2] = 
262
                                                {
263-
2nd thing, I want to add an option to spawn an airplane using the radio menu, I'm trying to impliment the AddCommandForGroup option but I need some help, here is the script (this is the first attempt to make somthing, pretty sure i messed it up :doh:) -
263+
264
                                                }, -- end of [2]
265-
[SPOILER]groupid = 800
265+
266
                                                {
267
                                                    ["CLSID"] = "{FBC29BFE-3D24-4C64-B81D-941239D12249}",
268
                                                }, -- end of [12]
269
                                                [1] = 
270
                                                {
271
                                                    ["CLSID"] = "{FBC29BFE-3D24-4C64-B81D-941239D12249}",
272
                                                }, -- end of [1]
273
                                            }, -- end of ["pylons"]
274
                                            ["fuel"] = "9400",
275
                                            ["flare"] = 48,
276
                                            ["chaff"] = 48,
277
                                            ["gun"] = 100,
278
                                        }, -- end of ["payload"]
279
                                        ["speed"] = 138.88888888889,
280
                                        ["unitId"] = 491,
281
                                        ["alt_type"] = "BARO",
282
                                        ["skill"] = "Random",
283
                                    }, -- end of [1]
284
                                }, -- end of ["units"]
285
                                ["y"] = 895424.57142858,
286
                                ["x"] = -317838.57142857,
287
                                ["name"] = "Su-33" .. groupid,
288
                                ["communication"] = true,
289
                                ["start_time"] = 0,
290
                                ["modulation"] = 0,
291
                                ["frequency"] = 124,
292
			),
293
p51d = 		(
294
								["groupId"] = groupid,
295
                                ["hidden"] = false,
296
                                ["units"] = 
297
                                {
298
                                    [1] = 
299
                                    {
300
                                        ["alt"] = 449,
301
                                        ["heading"] = 0,
302
                                        ["callsign"] = 
303
                                        {
304
                                            [1] = 6,
305
                                            [2] = 1,
306
                                            [3] = 1,
307
                                            ["name"] = "Ford11",
308
                                        }, -- end of ["callsign"]
309
                                        ["psi"] = 0,
310
                                        ["livery_id"] = "DCS_P51D_Big_Dick",
311
                                        ["onboard_num"] = "56",
312
                                        ["type"] = "P-51D",
313
                                        ["y"] = 895424.57142858,
314
                                        ["x"] = -317838.57142857,
315
                                        ["name"] = "P-51D" .. groupid,
316
                                        ["payload"] = 
317
                                        {
318
                                            ["pylons"] = 
319
                                            {
320
                                            }, -- end of ["pylons"]
321
                                            ["fuel"] = 366,
322
                                            ["flare"] = 0,
323
                                            ["chaff"] = 0,
324
                                            ["gun"] = 100,
325
                                        }, -- end of ["payload"]
326
                                        ["speed"] = 138.88888888889,
327
                                        ["unitId"] = 484,
328
                                        ["alt_type"] = "BARO",
329
                                        ["skill"] = "Random",
330
                                    }, -- end of [1]
331
                                }, -- end of ["units"]
332
                                ["y"] = 895424.57142858,
333
                                ["x"] = -317838.57142857,
334
                                ["name"] = "P-51D" .. groupid,
335
                                ["communication"] = true,
336
                                ["start_time"] = 0,
337
                                ["modulation"] = 0,
338
                                ["frequency"] = 124,
339
			),
340
ka50 = 		(
341
								["groupId"] = groupid,
342
                                ["hidden"] = false,
343
                                ["units"] = 
344
                                {
345
                                    [1] = 
346
                                    {
347
                                        ["alt"] = 449,
348
                                        ["heading"] = 0,
349
                                        ["callsign"] = 118,
350
                                        ["psi"] = 0,
351
                                        ["livery_id"] = "Russia Demo #024",
352
                                        ["onboard_num"] = "57",
353
                                        ["type"] = "Ka-50",
354
                                        ["y"] = 895424.57142858,
355
                                        ["x"] = -317838.57142857,
356
                                        ["name"] = "Ka-50" .. groupid,
357
                                        ["payload"] = 
358
                                        {
359
                                            ["pylons"] = 
360
                                            {
361
                                            }, -- end of ["pylons"]
362
                                            ["fuel"] = "1450",
363
                                            ["flare"] = 128,
364
                                            ["chaff"] = 0,
365
                                            ["gun"] = 100,
366
                                        }, -- end of ["payload"]
367
                                        ["speed"] = 41.666666666667,
368
                                        ["unitId"] = 498,
369
                                        ["alt_type"] = "BARO",
370
                                        ["skill"] = "Random",
371
                                    }, -- end of [1]
372
                                }, -- end of ["units"]
373
                                ["y"] = 895424.57142858,
374
                                ["x"] = -317838.57142857,
375
                                ["name"] = "Ka-50" .. groupid,
376
                                ["communication"] = true,
377
                                ["start_time"] = 0,
378
                                ["frequency"] = 124,
379
			),
380
huey = 		(
381
								["groupId"] = groupid,
382
                                ["hidden"] = false,
383
                                ["units"] = 
384
                                {
385
                                    [1] = 
386
                                    {
387
                                        ["alt"] = 449,
388
                                        ["heading"] = 0,
389
                                        ["callsign"] = 
390
                                        {
391
                                            [1] = 7,
392
                                            [2] = 1,
393
                                            [3] = 1,
394
                                            ["name"] = "Chevy11",
395
                                        }, -- end of ["callsign"]
396
                                        ["psi"] = 0,
397
                                        ["livery_id"] = "Army Standard",
398
                                        ["onboard_num"] = "57",
399
                                        ["type"] = "UH-1H",
400
                                        ["y"] = 895424.57142858,
401
                                        ["x"] = -317838.57142857,
402
                                        ["name"] = "Huey" .. groupid,
403
                                        ["payload"] = 
404
                                        {
405
                                            ["pylons"] = 
406
                                            {
407
                                                [1] = 
408
                                                {
409
                                                    ["CLSID"] = "M134_L",
410
                                                }, -- end of [1]
411
                                                [4] = 
412
                                                {
413
                                                    ["CLSID"] = "M134_R",
414
                                                }, -- end of [4]
415
                                            }, -- end of ["pylons"]
416
                                            ["fuel"] = "631",
417
                                            ["flare"] = 0,
418
                                            ["chaff"] = 0,
419
                                            ["gun"] = 100,
420
                                        }, -- end of ["payload"]
421
                                        ["speed"] = 41.666666666667,
422
                                        ["unitId"] = 497,
423
                                        ["alt_type"] = "BARO",
424
                                        ["skill"] = "Random",
425
                                    }, -- end of [1]
426
                                }, -- end of ["units"]
427
                                ["y"] = 895424.57142858,
428
                                ["x"] = -317838.57142857,
429
                                ["name"] = "Huey" .. groupid,
430
                                ["communication"] = true,
431
                                ["start_time"] = 0,
432
                                ["frequency"] = 124,
433
			),
434
fw190d9 = 	(
435
								["groupId"] = groupid,
436
                                ["hidden"] = false,
437
                                ["units"] = 
438
                                {
439
                                    [1] = 
440
                                    {
441
                                        ["alt"] = 449,
442
                                        ["type"] = "FW-190D9",
443
                                        ["unitId"] = 499,
444
                                        ["psi"] = 0,
445
                                        ["alt_type"] = "BARO",
446
                                        ["skill"] = "Random",
447
                                        ["y"] = 895424.57142858,
448
                                        ["x"] = -317838.57142857,
449
                                        ["name"] = "FW-190D9" .. groupid,
450
                                        ["payload"] = 
451
                                        {
452
                                            ["pylons"] = 
453
                                            {
454
                                            }, -- end of ["pylons"]
455
                                            ["fuel"] = 277,
456
                                            ["flare"] = 0,
457
                                            ["chaff"] = 0,
458
                                            ["gun"] = 100,
459
                                        }, -- end of ["payload"]
460
                                        ["speed"] = 138.88888888889,
461
                                        ["heading"] = 0,
462
                                        ["callsign"] = 117,
463
                                        ["onboard_num"] = "56",
464
                                    }, -- end of [1]
465
                                }, -- end of ["units"]
466
                                ["y"] = 895424.57142858,
467
                                ["x"] = -317838.57142857,
468
                                ["name"] = "FW-190D9" .. groupid,
469
                                ["communication"] = true,
470
                                ["start_time"] = 213,
471
                                ["modulation"] = 0,
472
                                ["frequency"] = 124,
473
			)
474
			
475
476
477
function UnitRadioCommand(arg)
478
    if arg == f15c or p51d then
479
		coalition.addGroup(country.id.USA, Group.Category.AIRPLANE, arg)
480
		groupid = groupid + 1
481
		trigger.action.outTextForGroup(GroupId groupId, string text, Time delay)
482
		return
483
	end
484
	if arg == su25t or su27 or su33 or mig29s or fw190d9 then
485
		coalition.addGroup(country.id.RUSSIA, Group.Category.AIRPLANE, arg)
486
		groupid = groupid + 1
487
		return
488
	end
489
	if arg == ka50 then
490
		coalition.addGroup(country.id.RUSSIA, Group.Category.HELICOPTER, arg)
491
		groupid = groupid + 1
492
		return
493
	end
494
	if arg == huey then
495
		coalition.addGroup(country.id.USA, Group.Category.HELICOPTER, arg)
496
		groupid = groupid + 1
497
		return
498
	end
499
	local playerName = unit:getPlayerName()
500
	trigger.action.outTextForGroup(gid,PlayerName .. " generated " .. arg, 15)
501
end
502
503
504
function AddRadioCommand(unitName)
505
        gid = group:getID()
506
       
507
        missionCommands.addCommandForGroup(gid, "F-15C", nil, UnitRadioCommand, f15c)
508
		missionCommands.addCommandForGroup(gid, "Su-25T", nil, UnitRadioCommand, su25t)
509
		missionCommands.addCommandForGroup(gid, "Su-27", nil, UnitRadioCommand, su27)
510
		missionCommands.addCommandForGroup(gid, "Su-33", nil, UnitRadioCommand, su33)
511
		missionCommands.addCommandForGroup(gid, "Mig-29S", nil, UnitRadioCommand, mig29s)
512
		missionCommands.addCommandForGroup(gid, "A-10C", nil, UnitRadioCommand, a10c)
513
		missionCommands.addCommandForGroup(gid, "P-51D", nil, UnitRadioCommand, p51d)
514
		missionCommands.addCommandForGroup(gid, "FW-190D9", nil, UnitRadioCommand, fw190d9)
515
		missionCommands.addCommandForGroup(gid, "Huey", nil, UnitRadioCommand, huey)
516
		missionCommands.addCommandForGroup(gid, "Ka-50", nil, UnitRadioCommand, ka50)
517
		        
518
    
519
end
520
 
521
 
522
 
523
function AddRadioCommands(arg, time)
524
    AddRadioCommand("GEN - F-15C")
525
    AddRadioCommand("GEN - Su-25T")
526
    AddRadioCommand("GEN - Su-27")
527
    AddRadioCommand("GEN - Su-33")
528
	AddRadioCommand("GEN - Mig-29S")
529
    AddRadioCommand("GEN - A-10C")
530
    AddRadioCommand("GEN - P-51D")
531
    AddRadioCommand("GEN - Huey")
532
    AddRadioCommand("GEN - Ka-50")      
533
    return time + 5
534
end