-
-
Notifications
You must be signed in to change notification settings - Fork 991
/
goto.cfg
780 lines (674 loc) · 21.2 KB
/
goto.cfg
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
#textdomain wesnoth-ai
[test]
id=goto
name= _ "Goto"
next_scenario=micro_ai_test
map_data="{ai/micro_ais/maps/goto.map}"
{DEFAULT_SCHEDULE}
turns=-1
victory_when_enemies_defeated=no
# wmllint: local spellings Minry Aethubry Gadoc Senvan AIs
[side]
side=1
controller=human
suppress_end_turn_confirmation=yes
hidden=no
name=Vaddan
id=Vaddan
type=Outlaw
persistent=no
team_name=Vaddan,humans
user_team_name= _ "Vaddan"
canrecruit=yes
recruit=Ruffian,Footpad,Thug,Poacher
gold=0
[/side]
[side]
side=2
controller=ai
type=General
id=leader2
name=Minry
persistent=no
team_name=humans,hum_wood
user_team_name= _ "Humans"
scroll_to_leader=no
canrecruit=yes
recruit=Spearman,Bowman
gold=0
income=-2
[/side]
[side]
side=3
controller=ai
type=Poacher
id=leader3
persistent=no
team_name=woodsmen,hum_wood
user_team_name= _ "Woodsmen"
canrecruit=yes
recruit=Woodsman
gold=0
income=-2
[/side]
[side]
side=4
controller=ai
type=Saurian Flanker
id=leader4
persistent=no
team_name=saurians,Vaddan,woodsmen
user_team_name= _ "Saurians"
canrecruit=yes
recruit=Saurian Augur,Saurian Skirmisher
gold=50
income=12
[/side]
[side]
side=5
controller=ai
type=Lieutenant
name=Gadoc
id=leader5
persistent=no
team_name=humans,hum_wood
user_team_name= _ "Humans"
canrecruit=yes
recruit=Spearman,Bowman
gold=50
income=8
[/side]
[side]
side=6
controller=ai
type=Lieutenant
name=Senvan
id=leader6
persistent=no
team_name=humans,hum_wood
user_team_name= _ "Humans"
canrecruit=yes
recruit=Spearman,Bowman
gold=50
income=8
[/side]
[side]
side=7
controller=ai
no_leader=yes
persistent=no
team_name=Vaddan,hum_wood,saurians
user_team_name= _ "team_name^Animals"
gold=0
income=-2
[/side]
[side]
side=8
controller=ai
no_leader=yes
persistent=no
team_name=saurians
user_team_name= _ "team_name^Ghosts"
gold=0
income=-2
[/side]
[side] # This side is only here because we need one persistent side for the game to go on
side=9
controller=null
persistent=yes
save_id=Grnk
hidden=yes
[/side]
# Put all the units and markers out there
[event]
name=prestart
{VARIABLE scenario_name goto}
# Put all the units out there
# The Side 2 Messengers
[unit]
side=2
type=Spearman
id=messenger1
x,y=40,4
random_traits=no
[/unit]
[unit]
side=2
type=Bowman
id=messenger2
x,y=41,4
random_traits=no
[/unit]
# Side 3 guardians
{UNIT 3 Woodsman 15 10 id=guard1}
{UNIT 3 Woodsman 13 12 id=guard2}
# Side 7 bats
{REPEAT 4 {UNIT 7 (Vampire Bat) 35 13 ()}}
# The River Fort commander
{UNIT 5 Sergeant 12 30 (id,name=fort_commander,Aethubry)}
# Labels
{SET_LABEL 7 3 _"General Minry"}
{SET_LABEL 4 21 _"Lieutenant Gadoc"}
{SET_LABEL 14 16 _"Lieutenant Senvan"}
{SET_LABEL 12 30 _"Sergeant Aethubry"}
# Now activate the Micro AIs
# Set up the Goto Micro AI for the two messengers with ca_score set
# so that messenger2 always goes first
[micro_ai]
side=2
ai_type=goto
action=add
ca_id=messenger1
[filter]
id=messenger1
[/filter]
[filter_location]
x,y=6-7,2-4
terrain=C*
[/filter_location]
ca_score=210001
[/micro_ai]
[micro_ai]
side=2
ai_type=goto
action=add
ca_id=messenger2
[filter]
id=messenger2
[/filter]
[filter_location]
x,y=6-7,2-4
terrain=C*
[/filter_location]
ca_score=210002
[/micro_ai]
# The two Side 3 guardians don't move unless a Side 1 unit is within 8 hexes
[micro_ai]
side=3
ai_type=goto
action=add
[filter]
id=guard1
[/filter]
[filter_location]
[filter]
id=guard1
[/filter]
[not]
[filter]
side=1
[/filter]
radius=8
[/not]
[/filter_location]
[/micro_ai]
[micro_ai]
side=3
ai_type=goto
action=add
[filter]
id=guard2
[/filter]
[filter_location]
[filter]
id=guard2
[/filter]
[not]
[filter]
side=1
[/filter]
radius=8
[/not]
[/filter_location]
[/micro_ai]
# Send the Side 5 and 6 recruits to the River Fort
[micro_ai]
side=5
ai_type=goto
action=add
[filter]
type=Spearman,Bowman
[/filter]
[filter_location]
x,y=11-13,29-30
terrain=C*
[/filter_location]
release_unit_at_goal=yes
[/micro_ai]
[micro_ai]
side=6
ai_type=goto
action=add
[filter]
type=Spearman,Bowman
[/filter]
[filter_location]
x,y=12,30
radius=1
[/filter_location]
release_all_units_at_goal=yes
[/micro_ai]
# Make the bats go to the corners of the map
[micro_ai]
side=7
ai_type=goto
action=add
[filter_location]
x=1,1,44,44
y=1,33,1,33
[/filter_location]
unique_goals=yes
[/micro_ai]
# The ghost move to the southern edge of the map, avoiding enemies
[micro_ai]
side=8
ai_type=goto
action=add
[filter_location]
y=33
[/filter_location]
avoid_enemies=1
[/micro_ai]
# Make the saurians behave like swamp lurkers
[micro_ai]
side=4
ai_type=lurkers
action=add
[filter]
type=Saurian Skirmisher,Saurian Augur
[/filter]
[filter_location]
terrain=S*
[/filter_location]
[/micro_ai]
# The right-click menu items
[set_menu_item]
id=m01_new_footpad
description= _ "Place Side 1 Footpad"
image=units/human-outlaws/footpad.png~CROP(26,17,24,24)
[show_if]
{VARIABLE_CONDITIONAL scenario_name equals goto}
[/show_if]
[command]
{UNIT 1 Footpad $x1 $y1 ()}
[/command]
[/set_menu_item]
[set_menu_item]
id=m02_kill_unit
description= _ "Kill Unit under Cursor"
image=items/potion-poison.png~CROP(24,29,24,24)
[show_if]
{VARIABLE_CONDITIONAL scenario_name equals goto}
[/show_if]
[command]
[kill]
x,y=$x1,$y1
[/kill]
[/command]
[/set_menu_item]
[set_menu_item]
id=m03_null_control
description= _ "Turn off human control of Side 1"
image=items/ring-gold.png~CROP(26,26,20,20)
[show_if]
{VARIABLE_CONDITIONAL scenario_name equals goto}
[/show_if]
[command]
[end_turn]
[/end_turn]
[event]
name=side turn
[modify_side]
side=1
controller=null
[/modify_side]
[/event]
[/command]
[/set_menu_item]
[set_menu_item]
id=m04_end_animals
description= _ "End Scenario"
image=items/ring-red.png~CROP(26,26,20,20)
[show_if]
{VARIABLE_CONDITIONAL scenario_name equals goto}
[/show_if]
[command]
# So that game goes on to next scenario
[modify_side]
side=9
controller=human
[/modify_side]
{MESSAGE narrator "wesnoth-icon.png" "" _"Well, that was that."}
[endlevel]
result=victory
bonus=no
carryover_percentage=0
carryover_report=no
linger_mode=no
[/endlevel]
[/command]
[/set_menu_item]
[/event]
[event]
name=start
#{MESSAGE narrator "wesnoth-icon.png" "" _"Text"}
# wmllint: unbalanced-on
{MESSAGE narrator "wesnoth-icon.png" "" _"This scenario demonstrates a variety of different uses of the Goto Micro AI. All AI sides are controlled by this MAI in one way or another (except for the saurians, which are run by the Lurkers Micro AI). Messages will be displayed throughout the scenario to point out what the units are doing.
The player controls Side 1. There are right-click context menu options for adding Side 1 units to the map and for taking them off again. This is useful mostly for testing how the Side 3 guardians react.
Note: The Goto AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
# wmllint: unbalanced-off
[objectives]
side=1
summary= _ "Watch the AI units do their things"
[objective]
description= _ "Use right-click option"
condition=win
[/objective]
[objective]
description= _ "Death of Vaddan"
condition=lose
[/objective]
[note]
description= _ "Check out the right-click menu options for additional actions"
[/note]
[/objectives]
[/event]
# Dialog involving the messengers
[event]
name=side 2 turn
[message]
speaker=messenger1
message= _ "The bridge is out. What do we do now?"
[/message]
[message]
speaker=messenger2
message= _ "Looks like we need to take the long way around to get to General Minry."
[/message]
[/event]
[event]
name=side 3 turn
[message]
speaker=leader3
message= _ "Chaps, ignore everybody except for that swindler Vaddan and his men. Stay in place until any of his units gets within 8 hexes of you.
Note: This is a demonstration of how the Goto Micro AI can be used to code guardian units, although one of the dedicated Guardian Micro AIs will often be better suited for that purpose."
[/message]
[/event]
[event]
name=side 7 turn
[message]
side=7
type=Vampire Bat
message= _ "Us four bats switch between running off to the corners of the map (each one to a different corner), and getting back in a group right here. Either behavior is set up with a single [micro_ai] tag, one with 'unique_goals=yes', the other without." # wmllint: no spellcheck
[/message]
[/event]
[event]
name=side 8 turn
{UNIT 8 Ghost 29 1 id=ghost1}
{MESSAGE ghost1 "" "" _"Aaiiieeeeeee !!!"}
{MESSAGE messenger2 "" "" _"O no, a ghost!"}
{MESSAGE messenger1 "" "" _"Don't worry, those are really shy ghosts. Nobody knows why, but they always appear in the north this time of year and move through to the south. Also, very unusually for ghosts, they seem to be scared of everybody and avoid other units as much as possible -- except for the bats and saurians, with which they seem to get along just fine for some reason. So as long as we don't corner them, they'll leave us alone."}
[event]
name=side 8 turn
first_time_only=no
{RANDOM 0..99}
[if]
[have_unit]
side=8
count=0-2
[/have_unit]
[variable]
name=random
less_than=50
[/variable]
[then]
{UNIT 8 Ghost 29 1 ()}
[/then]
[/if]
{CLEAR_VARIABLE random}
[/event]
# Remove ghosts that have made it all the way south
[event]
name=side 8 turn end
first_time_only=no
[store_unit]
[filter]
side=8
y=33
[/filter]
variable=stored_ghosts
[/store_unit]
{FOREACH stored_ghosts i_g}
[kill]
id=$stored_ghosts[$i_g].id
[/kill]
{NEXT i_g}
{CLEAR_VARIABLE stored_ghosts}
[/event]
[/event]
# When the messengers get across the river, send them on separate paths
[event]
name=moveto
[filter]
id=messenger1,messenger2
x=28-34
[/filter]
[message]
speaker=messenger2
message= _ "I'll take the route straight through the mountains. It's much shorter than following the trail all the way around in the south."
[/message]
[message]
speaker=messenger1
message= _ "You're crazy. It might be shorter as the crow flies, but it will take you forever to get through those mountains.
Note: The messengers are controlled by Goto Micro AI definitions that differ by a single line, 'use_straight_line=yes/no'." # wmllint: no spellcheck
[/message]
[micro_ai]
side=2
ai_type=goto
action=change
ca_id=messenger2
[filter]
id=messenger2
[/filter]
[filter_location]
x,y=6-7,2-4
terrain=C*
[/filter_location]
use_straight_line=yes
ca_score=210002
[/micro_ai]
[/event]
# When the first messenger gets to the castle
[event]
name=moveto
[filter]
id=messenger1,messenger2
x,y=6-7,2-4
terrain=C*
[/filter]
[message]
speaker=unit
message= _ "I told you so!"
[/message]
[/event]
# Dialog involving the River Fort
[event]
name=side 5 turn 2
[message]
speaker=leader5
message= _ "Men, head down to the River Fort and get your orders from Sergeant Aethubry. I want each and every one of you to report to him before going east to fight those saurians."
[/message]
[/event]
[event]
name=side 6 turn 2
[message]
speaker=leader6
message= _ "Hah, that's that pencil pusher Gadoc for you! Men, I want you to move toward the River Fort as well, but it's good enough for one of you to report to Sergeant Aethubry. Once that has happened, the rest of you can head into battle directly."
[/message]
[/event]
# When the Side 5 units make it to Aethubry
[event]
name=moveto
first_time_only=no
[filter]
side=5
[filter_location]
x,y=11-13,29-30
terrain=C*
[/filter_location]
[/filter]
[message]
speaker=unit
message= _ "$unit.language_name $unit.name from Lieutenant Gadoc's squadron reporting for duty, sir."
[/message]
[fire_event]
name=sergeant_replies
[primary_unit]
id=$unit.id
[/primary_unit]
[/fire_event]
[/event]
[event]
name=sergeant_replies
[message]
speaker=fort_commander
message= _ "Ready to fight those saurians, soldier?"
[/message]
[message]
speaker=unit
message= _ "Yes, sir."
[/message]
[event]
name=sergeant_replies
[message]
speaker=fort_commander
message= _ "Very good, $unit.language_name. Now go help your comrade get rid of that saurian infestation in the swamps."
[/message]
[event]
name=sergeant_replies
[message]
speaker=fort_commander
message= _ "Maybe if I ignore them, they'll just go away?"
[/message]
[/event]
[/event]
[/event]
# When the first Side 6 unit makes it to Aethubry
[event]
name=moveto
[filter]
side=6
[filter_location]
x,y=12,30
radius=1
[/filter_location]
[/filter]
[message]
speaker=unit
message= _ "Lieutenant Senvan's men reporting for duty, sir."
[/message]
[message]
speaker=fort_commander
message= _ "Ah, Lieutenant Senvan... Is every single one of you going to bother me individually as well?"
[/message]
[message]
speaker=unit
message= _ "No, sir. Lieutenant Senvan ordered us to head into battle as soon as I have reported to you."
[/message]
[message]
speaker=fort_commander
message= _ "Well, that's a relief. Somebody knows how to use his ... I mean, very well, off you go then.
" + {WHISPER _"I wouldn't say anything negative about one of my superior officers now, would I?"}
[/message]
[/event]
# When the bats make it to the 4 corners, make then move into a group again
[event]
name=moveto
[filter]
side=7
type=Vampire Bat
[/filter]
first_time_only=no
[if]
[have_unit]
side=7
type=Vampire Bat
x,y=1,1
[/have_unit]
[have_unit]
side=7
type=Vampire Bat
x,y=1,33
[/have_unit]
[have_unit]
side=7
type=Vampire Bat
x,y=44,1
[/have_unit]
[have_unit]
side=7
type=Vampire Bat
x,y=44,33
[/have_unit]
[then]
[message]
side=7
type=Vampire Bat
message= _ "We've all made it to the corners, let's get back together again."
[/message]
# Send the bats back to their starting point
[micro_ai]
side=7
ai_type=goto
action=change
[filter_location]
x,y=35,13
[/filter_location]
[/micro_ai]
[/then]
[/if]
[/event]
# When the bats are back together, make them go to the corners again
[event]
name=moveto
[filter]
side=7
type=Vampire Bat
[/filter]
first_time_only=no
[if]
[have_unit]
side=7
type=Vampire Bat
count=4
[filter_location]
x,y=35,13
radius=2
[/filter_location]
[/have_unit]
[then]
[message]
side=7
type=Vampire Bat
message= _ "We're back together, let's head out to the corners again."
[/message]
# Make the bats go to the corners of the map
[micro_ai]
side=7
ai_type=goto
action=change
[filter_location]
x=1,1,44,44
y=1,33,1,33
[/filter_location]
unique_goals=yes
[/micro_ai]
[/then]
[/if]
[/event]
# The River Fort commander never moves
[event]
name=side 5 turn refresh
first_time_only=no
{MODIFY_UNIT id=fort_commander moves 0}
[/event]
[/test]