-
Notifications
You must be signed in to change notification settings - Fork 0
/
module_simple_triggers.py
9553 lines (8730 loc) · 422 KB
/
module_simple_triggers.py
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
from header_common import *
from header_operations import *
from header_parties import *
from header_items import *
from header_skills import *
from header_triggers import *
from header_troops import *
from header_music import *
from header_terrain_types import * #added motomataru chief
from module_constants import *
####################################################################################################################
# Simple triggers are the alternative to old style triggers. They do not preserve state, and thus simpler to maintain.
#
# Each simple trigger contains the following fields:
# 1) Check interval: How frequently this trigger will be checked
# 2) Operation block: This must be a valid operation block. See header_operations.py for reference.
####################################################################################################################
simple_triggers = [
# This trigger is deprecated. Use "script_game_event_party_encounter" in module_scripts.py instead
(ti_on_party_encounter,
[
]),
# This trigger is deprecated. Use "script_game_event_simulate_battle" in module_scripts.py instead
(ti_simulate_battle,
[
]),
(1,
[
#(try_begin),
# (eq, "$training_ground_position_changed", 0),
# (assign, "$training_ground_position_changed", 1),
#(set_fixed_point_multiplier, 100),
#(position_set_x, pos0, 7050),
#(position_set_y, pos0, 7200),
# (party_set_position, "p_training_ground_3", pos0),
#(try_end),
(try_begin),
(neq, "$tml_version", 123),
(assign, "$tml_version", 123),
(set_fixed_point_multiplier, 100),
(position_set_x, pos0, -1224),
(position_set_y, pos0, 338),
(party_set_position, "p_town_7", pos0),
(position_set_x, pos0, -5904),
(position_set_y, pos0, -4742),
(party_set_position, "p_town_27", pos0),
(position_set_x, pos0, 5049),
(position_set_y, pos0, 2548),
(party_set_position, "p_town_32", pos0),
(position_set_x, pos0, 8234),
(position_set_y, pos0, -1891),
(party_set_position, "p_town_33", pos0),
(position_set_x, pos0, -5234),
(position_set_y, pos0, -13013),
(party_set_position, "p_town_37", pos0),
(position_set_x, pos0, -7649),
(position_set_y, pos0, 12352),
(party_set_position, "p_castle_19", pos0),
(position_set_x, pos0, -8828),
(position_set_y, pos0, 12660),
(party_set_position, "p_village_49", pos0),
(position_set_x, pos0, 1388),
(position_set_y, pos0, 7976),
(party_set_position, "p_celidon_forest", pos0),
(position_set_x, pos0, -6060),
(position_set_y, pos0, 4785),
(party_set_position, "p_hidden_valley", pos0),
(position_set_x, pos0, 9305),
(position_set_y, pos0, 9085),
(party_set_position, "p_iniau_hideout", pos0),
(position_set_x, pos0, 1501),
(position_set_y, pos0, -12305),
(party_set_position, "p_odin_cave", pos0),
(position_set_x, pos0, 1225),
(position_set_y, pos0, 549),
(party_set_position, "p_monasterio1", pos0),
(position_set_x, pos0, -7320),
(position_set_y, pos0, 3302),
(party_set_position, "p_bridge_1", pos0),
(position_set_x, pos0, -5903),
(position_set_y, pos0, -1036),
(party_set_position, "p_bridge_2", pos0),
(position_set_x, pos0, -7831),
(position_set_y, pos0, 7870),
(party_set_position, "p_bridge_3", pos0),
(position_set_x, pos0, -1903),
(position_set_y, pos0, 10656),
(party_set_position, "p_bridge_4", pos0),
(position_set_x, pos0, -8837),
(position_set_y, pos0, 13087),
(party_set_position, "p_bridge_5", pos0),
(position_set_x, pos0, -5010),
(position_set_y, pos0, 12552),
(party_set_position, "p_bridge_6", pos0),
(position_set_x, pos0, -1972),
(position_set_y, pos0, 9466),
(party_set_position, "p_bridge_7", pos0),
(position_set_x, pos0, 3100),
(position_set_y, pos0, -5927),
(party_set_position, "p_bridge_8", pos0),
(position_set_x, pos0, 10106),
(position_set_y, pos0, 7006),
(party_set_position, "p_bridge_9", pos0),
(position_set_x, pos0, 823),
(position_set_y, pos0, -6391),
(party_set_position, "p_bridge_10", pos0),
(position_set_x, pos0, -5932),
(position_set_y, pos0, 702),
(party_set_position, "p_bridge_11", pos0),
(position_set_x, pos0, -7448),
(position_set_y, pos0, 4441),
(party_set_position, "p_bridge_12", pos0),
(position_set_x, pos0, -3787),
(position_set_y, pos0, 11490),
(party_set_position, "p_bridge_13", pos0),
(position_set_x, pos0, -403),
(position_set_y, pos0, 8336),
(party_set_position, "p_bridge_15", pos0),
(position_set_x, pos0, 8831),
(position_set_y, pos0, 4445),
(party_set_position, "p_bridge_16", pos0),
(position_set_x, pos0, -3304),
(position_set_y, pos0, 15350),
(party_set_position, "p_bridge_17", pos0),
(position_set_x, pos0, 7366),
(position_set_y, pos0, 9129),
(party_set_position, "p_bridge_18", pos0),
(position_set_x, pos0, 8605),
(position_set_y, pos0, 9431),
(party_set_position, "p_bridge_19", pos0),
(str_store_string, s0, "@looking for victims"),
(party_set_name, "p_sea_raider_spawn_point_1", s0),
(party_set_name, "p_sea_raider_spawn_point_2", s0),
(party_set_name, "p_sea_raider_spawn_point_3", s0),
(try_end),
# (gt,"$auto_siege_town",0), #siege warfare chief
# (gt,"$auto_siege_port",0), #siege warfare chief
(gt,"$auto_besiege_town",0),
(gt,"$g_player_besiege_town", 0),
(ge, "$g_siege_method", 1),
(store_current_hours, ":cur_hours"),
(eq, "$g_siege_force_wait", 0),
(ge, ":cur_hours", "$g_siege_method_finish_hours"),
(ge, ":cur_hours", "$g_siegewarfare_metodo"), #siege warfare
(neg|is_currently_night),
(rest_for_hours, 0, 0, 0), #stop resting
]),
#Duh chief bank system and land
(1,
[
(try_for_range, ":town_no", towns_begin, towns_end), # Floris Moneylenders // Not paying debts has consequences
(party_get_slot, ":debt", ":town_no", slot_town_bank_debt),
(gt, ":debt", 0), # If a debt exists, a deadline exists
(party_get_slot, ":deadline", ":town_no", slot_town_bank_deadline),
(store_current_hours, ":date"),
(ge, ":date", ":deadline"),
(call_script, "script_change_player_relation_with_center", ":town_no", -5, 0xff3333),
(try_begin),
(lt, ":debt", 100000),
(val_mul, ":debt", 14),
(val_div, ":debt", 10),
(try_begin),
(gt, ":debt", 100000), #Debt doesnt get higher than 100000 denars
(assign, ":debt", 100000),
(try_end),
(val_add, ":deadline", 24*14),
(party_set_slot, ":town_no", slot_town_bank_debt, ":debt"),
(party_set_slot, ":town_no", slot_town_bank_deadline, ":deadline"),
(str_store_party_name, s1, ":town_no"),
(display_message, "@You missed the deadline to pay back your debts in {s1}. They now grow at an interest of 50%."),
(else_try),
(assign, ":debt", 100000), #If debt = 100000 denars, then additionally to -5 relation with town, you get -1 relation with Faction.
(val_add, ":deadline", 24*14),
(party_set_slot, ":town_no", slot_town_bank_debt, ":debt"),
(party_set_slot, ":town_no", slot_town_bank_deadline, ":deadline"),
(store_faction_of_party, ":faction_no", ":town_no"),
(call_script, "script_change_player_relation_with_faction_ex", ":faction_no", -2), #chief hace mas dramatico
(str_store_party_name, s1, ":town_no"),
(display_message, "@Your debt in {s1} is now so high that the King himself has taken notice. He has frozen your debt, but is displeased with the situation.", 0xff3333),
(try_end),
(try_end),
]),
(24*14,
[
(try_for_range, ":town_no", towns_begin, towns_end), # Floris // Adjust Population Depending on Prosperity
(party_get_slot, ":prosperity", ":town_no", slot_town_prosperity),
(party_get_slot, ":population", ":town_no", slot_center_population),
(assign,":change",0),
(try_begin),
(ge, ":prosperity", 60),
(store_sub, ":change", ":prosperity",60),
(val_div, ":change", 5),
(val_add, ":change", 3),
(else_try),
(le, ":prosperity", 40),
(store_sub, ":change", ":prosperity", 40), # Fixed typo
(val_div, ":change", 5),
(val_sub, ":change", 3),
(try_end),
(store_div,":base",":population",100), # Base population change is 1% of pop
(val_mul,":change",":base"),
(val_add,":population", ":change"),
(try_begin),
(gt, ":population", 10000),
(assign, ":population", 10000),
(party_set_slot, ":town_no", slot_center_population, ":population"),
(else_try),
(lt, ":population", 1000),
(assign, ":population", 1000),
(party_set_slot, ":town_no", slot_center_population, ":population"),
(else_try),
(party_set_slot, ":town_no", slot_center_population, ":population"),
(try_end),
(try_end),
(try_for_range, ":town_no", towns_begin, towns_end), # Floris // Calculating Land Demand and Consequences for supply, pricing and renting
(party_get_slot, ":population", ":town_no", slot_center_population),
(party_get_slot, ":land_town", ":town_no", slot_town_acres),
(party_get_slot, ":land_player", ":town_no", slot_town_player_acres),
(party_get_slot, ":prosperity", ":town_no", slot_town_prosperity),
(store_sub, ":revenue", ":prosperity", 50),
(val_add, ":revenue", 100),
(try_begin),
(store_div, ":acres_needed", ":population", 200), # 200 People warrant 1 acre of cultivated land
(store_add, ":total_land", ":land_town", ":land_player"),
(store_sub, ":surplus", ":total_land", ":acres_needed"),
(try_begin), # AI Consequences
(lt, ":total_land", ":acres_needed"),
(store_sub, ":new_acres", ":acres_needed", ":total_land"),
(val_add, ":land_town", ":new_acres"),
(party_set_slot, ":town_no", slot_town_acres, ":land_town"),
(else_try),
(ge, ":surplus", 20),
(ge, ":land_town", 10),
(val_sub, ":land_town", 10), # Changed from 2 / Faster rebalancing in case of player screw up
(party_set_slot, ":town_no", slot_town_acres, ":land_town"),
(try_end),
(try_begin),
(gt, ":land_player", 0), # New Fix / Before it was possible for the towns land to cause the player a deficit
(try_begin), # Player Consequences
(le, ":total_land", ":acres_needed"),
(val_mul, ":land_player", ":revenue"),
(party_set_slot, ":town_no", slot_town_bank_rent, ":land_player"),
(else_try),
(store_mul, ":penalty", ":surplus", -1),
(val_add, ":penalty", ":revenue"),
(try_begin),
(ge, ":penalty", 85),
(val_mul, ":land_player", ":penalty"),
(party_set_slot, ":town_no", slot_town_bank_rent, ":land_player"),
(else_try),
(store_sub, ":non_rented", ":surplus", 15),
(val_sub, ":land_player", ":non_rented"),
(try_begin), # Safety check // No penalty on rent should turn rent negative.
(lt, ":penalty", 0),
(assign, ":penalty", 0),
(try_end),
(val_mul, ":land_player", ":penalty"),
(party_set_slot, ":town_no", slot_town_bank_rent, ":land_player"),
(val_mul, ":non_rented", -50),
(party_set_slot, ":town_no", slot_town_bank_upkeep, ":non_rented"),
(try_end),
(try_end),
(party_get_slot, ":assets", ":town_no", slot_town_bank_assets), # Adding/Subtracting profits/losses
(party_get_slot, ":rent", ":town_no", slot_town_bank_rent),
(party_get_slot, ":upkeep", ":town_no", slot_town_bank_upkeep),
(val_add, ":assets", ":rent"),
(val_add, ":assets", ":upkeep"),
(party_set_slot, ":town_no", slot_town_bank_assets, ":assets"),
(try_end),
(try_end),
(try_end),
]),
#duh acaba chief
(0,
[
(try_begin),
(eq, "$bug_fix_version", 0),
#fix for hiding test_scene in older savegames
(disable_party, "p_test_scene"),
#fix for correcting town_1 siege type
(party_set_slot, "p_town_1", slot_center_siege_with_belfry, 0),
#fix for hiding player_faction notes
(faction_set_note_available, "fac_player_faction", 0),
#fix for hiding faction 0 notes
(faction_set_note_available, "fac_no_faction", 0),
#fix for removing kidnapped girl from party
(try_begin),
(neg|check_quest_active, "qst_kidnapped_girl"),
(party_remove_members, "p_main_party", "trp_kidnapped_girl", 1),
(try_end),
#fix for not occupied but belong to a faction lords
(try_for_range, ":cur_troop", lords_begin, lords_end),
(try_begin),
(troop_slot_eq, ":cur_troop", slot_troop_occupation, slto_inactive),
(store_troop_faction, ":cur_troop_faction", ":cur_troop"),
(is_between, ":cur_troop_faction", "fac_kingdom_1", kingdoms_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_hero),
(try_end),
(try_end),
#fix for an error in 1.105, also fills new slot values
(call_script, "script_initialize_item_info"),
(assign, "$bug_fix_version", 1),
(try_end),
(eq,"$g_player_is_captive",1),
(gt, "$capturer_party", 0),
(party_is_active, "$capturer_party"),
(party_relocate_near_party, "p_main_party", "$capturer_party", 0),
]),
#Auto-menu
(0,
[
(try_begin),
(gt, "$g_last_rest_center", 0),
(party_get_battle_opponent, ":besieger_party", "$g_last_rest_center"),
(gt, ":besieger_party", 0),
(store_faction_of_party, ":encountered_faction", "$g_last_rest_center"),
(store_relation, ":faction_relation", ":encountered_faction", "fac_player_supporters_faction"),
(store_faction_of_party, ":besieger_party_faction", ":besieger_party"),
(store_relation, ":besieger_party_relation", ":besieger_party_faction", "fac_player_supporters_faction"),
(ge, ":faction_relation", 0),
(lt, ":besieger_party_relation", 0),
(start_encounter, "$g_last_rest_center"),
(rest_for_hours, 0, 0, 0), #stop resting
(else_try),
(store_current_hours, ":cur_hours"),
(assign, ":check", 0),
(try_begin),
(neq, "$g_check_autos_at_hour", 0),
(ge, ":cur_hours", "$g_check_autos_at_hour"),
(assign, ":check", 1),
(assign, "$g_check_autos_at_hour", 0),
(try_end),
(this_or_next|eq, ":check", 1),
(map_free),
(try_begin),
(ge,"$auto_menu",1),
(jump_to_menu,"$auto_menu"),
(assign,"$auto_menu",-1),
(else_try),
(ge,"$auto_enter_town",1),
(start_encounter, "$auto_enter_town"),
(try_begin), #rigale chief empieza
(eq,"$begging_action_started",1),
(assign,"$begging_action_started",0), #abort begging to avoid conflicts
(try_end), #rigale chief acaba
(else_try), #chief permite a player acceder a inventario en sieges, mas en tigger por clave: acceder inventario en sieges
(ge,"$auto_besiege_town",1),
(start_encounter, "$auto_besiege_town"),
(else_try),
(ge,"$g_camp_mode", 1),
(assign, "$g_camp_mode", 0),
(assign, "$g_infinite_camping", 0),
#motomataru fix camping on water
# (assign, "$g_player_icon_state", pis_normal),
(party_get_current_terrain,":terrain","p_main_party"),
(try_begin),
(neq, ":terrain", 0), #not rt_water
(neq, ":terrain", 7), #not rt_river used as water terrain
(neq, ":terrain", 8), #not rt_bridge used as water terrain
(assign, "$g_player_icon_state", pis_normal),
(else_try),
(assign, "$g_player_icon_state", pis_ship),
(try_end),
#end motomataru fix camping on water
(rest_for_hours, 0, 0, 0), #stop camping
(display_message, "@Breaking camp..."),
###rigale chief
(else_try), #rigale ambush end by moving
(eq, "$ambush_set_by_player", 1),
(assign,"$ambush_set_by_player", 0),
(display_message, "@AMBUSH CANCELLED, DON'T MOVE WHILE AMBUSHING.",0xFF3300),
(rest_for_hours, 0, 0, 0), #stop ambushing
#rigale chief acaba
(try_end),
(try_end),
]),
###anadido sieges menu por caba'drin chief
(0.25,
[
(gt,"$auto_besiege_town",0),
(ge,"$g_player_besiege_town", 0),
(ge, "$g_siege_method", 1),
(store_distance_to_party_from_party, ":distance", "$g_player_besiege_town", "p_main_party"),
(try_begin),
(gt, ":distance", raid_distance / 2),
(str_store_party_name_link, s1, "$g_player_besiege_town"),
(display_message, "@You have broken off your siege of {s1}."),
(call_script, "script_lift_siege", "$g_player_besiege_town", 0),
(assign, "$g_player_besiege_town", -1),
(assign, "$g_raid_distance_warned", 0),
(else_try),
(ge, ":distance", raid_distance / 3),
(neq, "$g_raid_distance_warned", 1),
(str_store_party_name_link, s1, "$g_player_besiege_town"),
(display_message, "@You cannot maintain your siege of {s1} from this distance. You risk your lines breaking."),
(assign, "$g_raid_distance_warned", 1),
(else_try),
(assign, "$g_raid_distance_warned", 0),
(store_current_hours, ":cur_hours"),
(eq, "$g_siege_force_wait", 0), #chief cambia para reparar bug de esperar
(ge, ":cur_hours", "$g_siege_method_finish_hours"), #chief cambia para reparar bug de esperar
(ge, ":cur_hours", "$g_siegewarfare_metodo"), #siege warfare #chief cambia para reparar bug de esperar
(neg|is_currently_night),
(rest_for_hours, 0, 0, 0), #stop resting, if resting
(start_encounter, "$auto_besiege_town"),
(try_end),
]),
###acaba sieges menu chief
#Notification menus
(0,
[
(troop_slot_ge, "trp_notification_menu_types", 0, 1),
(troop_get_slot, ":menu_type", "trp_notification_menu_types", 0),
(troop_get_slot, "$g_notification_menu_var1", "trp_notification_menu_var1", 0),
(troop_get_slot, "$g_notification_menu_var2", "trp_notification_menu_var2", 0),
(jump_to_menu, ":menu_type"),
(assign, ":end_cond", 2),
(try_for_range, ":cur_slot", 1, ":end_cond"),
(try_begin),
(troop_slot_ge, "trp_notification_menu_types", ":cur_slot", 1),
(val_add, ":end_cond", 1),
(try_end),
(store_sub, ":cur_slot_minus_one", ":cur_slot", 1),
(troop_get_slot, ":local_temp", "trp_notification_menu_types", ":cur_slot"),
(troop_set_slot, "trp_notification_menu_types", ":cur_slot_minus_one", ":local_temp"),
(troop_get_slot, ":local_temp", "trp_notification_menu_var1", ":cur_slot"),
(troop_set_slot, "trp_notification_menu_var1", ":cur_slot_minus_one", ":local_temp"),
(troop_get_slot, ":local_temp", "trp_notification_menu_var2", ":cur_slot"),
(troop_set_slot, "trp_notification_menu_var2", ":cur_slot_minus_one", ":local_temp"),
(try_end),
]),
#Music,
(1,
[
(map_free),
(call_script, "script_music_set_situation_with_culture", mtf_sit_travel),
]),
(0,
[
#escort caravan quest auto dialog trigger
(try_begin),
(eq, "$caravan_escort_state", 1),
(party_is_active, "$caravan_escort_party_id"),
(store_distance_to_party_from_party, ":caravan_distance_to_destination","$caravan_escort_destination_town","$caravan_escort_party_id"),
(lt, ":caravan_distance_to_destination", 2),
(store_distance_to_party_from_party, ":caravan_distance_to_player","p_main_party","$caravan_escort_party_id"),
(lt, ":caravan_distance_to_player", 5),
(assign, "$talk_context", tc_party_encounter),
(assign, "$g_encountered_party", "$caravan_escort_party_id"),
(party_stack_get_troop_id, ":caravan_leader", "$caravan_escort_party_id", 0),
(party_stack_get_troop_dna, ":caravan_leader_dna", "$caravan_escort_party_id", 0),
(start_map_conversation, ":caravan_leader", ":caravan_leader_dna"),
(try_end),
(try_begin),
(gt, "$g_reset_mission_participation", 1),
(try_for_range, ":troop", active_npcs_begin, kingdom_ladies_end),
(troop_set_slot, ":troop", slot_troop_mission_participation, 0),
(try_end),
(try_end),
]),
(24,
[
(try_for_range, ":kingdom_no", npc_kingdoms_begin, npc_kingdoms_end),
(faction_get_slot, ":faction_morale", ":kingdom_no", slot_faction_morale_of_player_troops),
(store_sub, ":divisor", 140, "$player_right_to_rule"),
(val_div, ":divisor", 14),
(val_max, ":divisor", 1),
(store_div, ":faction_morale_div_10", ":faction_morale", ":divisor"), #10 is the base, down to 2 for 100 rtr
(val_sub, ":faction_morale", ":faction_morale_div_10"),
(faction_set_slot, ":kingdom_no", slot_faction_morale_of_player_troops, ":faction_morale"),
(try_end),
]),
(4, #Locate kingdom ladies
[
#change location for all ladies
(try_for_range, ":troop_id", kingdom_ladies_begin, kingdom_ladies_end),
(neg|troop_slot_ge, ":troop_id", slot_troop_prisoner_of_party, 0),
(call_script, "script_get_kingdom_lady_social_determinants", ":troop_id"),
(assign, ":location", reg1),
(troop_set_slot, ":troop_id", slot_troop_cur_center, ":location"),
(try_end),
]),
(2, #Error check for multiple parties on the map
[
(eq, "$cheat_mode", 1),
(assign, ":debug_menu_noted", 0),
(try_for_parties, ":party_no"),
(gt, ":party_no", "p_spawn_points_end"),
(party_stack_get_troop_id, ":commander", ":party_no", 0),
##diplomacy start+ chief
(is_between, ":commander", heroes_begin, heroes_end),
(this_or_next|troop_slot_eq, ":commander", slot_troop_occupation, slto_kingdom_hero),
##diplomacy end+
(is_between, ":commander", active_npcs_begin, active_npcs_end),
(troop_get_slot, ":commander_party", ":commander", slot_troop_leaded_party),
(neq, ":party_no", ":commander_party"),
(assign, reg4, ":party_no"),
(assign, reg5, ":commander_party"),
(str_store_troop_name, s3, ":commander"),
(display_message, "@{!}{s3} commander of party #{reg4} which is not his troop_leaded party {reg5}"),
##diplomacy start+ Make it clear what the error was chief
(try_begin),
(gt, reg4, 0),
(gt, reg5, 0),
(str_store_party_name, s3, reg4),
(str_store_party_name, s65, reg5),
(display_message, "@{!} Commanded party #{reg4} is {s3}, troop_leaded party #{reg5} is {s65}"),
(str_store_troop_name, s3, ":commander"),
(try_end),
##diplomacy end+
(str_store_string, s65, "str_party_with_commander_mismatch__check_log_for_details_"),
(try_begin),
(eq, ":debug_menu_noted", 0),
(call_script, "script_add_notification_menu", "mnu_debug_alert_from_s65", 0, 0),
(assign, ":debug_menu_noted", 1),
(try_end),
(try_end),
]),
(24, #Kingdom ladies send messages
[
(try_begin),
(neg|check_quest_active, "qst_visit_lady"),
(neg|troop_slot_ge, "trp_player", slot_troop_prisoner_of_party, 1),
(neg|troop_slot_ge, "trp_player", slot_troop_spouse, active_npcs_begin),
(assign, ":lady_not_visited_longest_time", -1),
(assign, ":longest_time_without_visit", 120), #five days
(try_for_range, ":troop_id", kingdom_ladies_begin, kingdom_ladies_end),
##diplomacy start+ not dead, exiled, etc. chief
(neg|troop_slot_ge, ":troop_id", slot_troop_occupation, slto_retirement),
##diplomacy end+
#set up message for ladies the player is courting
(troop_slot_ge, ":troop_id", slot_troop_met, 2),
(neg|troop_slot_eq, ":troop_id", slot_troop_met, 4),
(troop_slot_eq, ":troop_id", slot_lady_no_messages, 0),
(troop_slot_eq, ":troop_id", slot_troop_spouse, -1),
(troop_get_slot, ":location", ":troop_id", slot_troop_cur_center),
(is_between, ":location", walled_centers_begin, walled_centers_end),
(call_script, "script_troop_get_relation_with_troop", "trp_player", ":troop_id"),
(gt, reg0, 1),
(store_current_hours, ":hours_since_last_visit"),
(troop_get_slot, ":last_visit_hour", ":troop_id", slot_troop_last_talk_time),
(val_sub, ":hours_since_last_visit", ":last_visit_hour"),
(gt, ":hours_since_last_visit", ":longest_time_without_visit"),
(assign, ":longest_time_without_visit", ":hours_since_last_visit"),
(assign, ":lady_not_visited_longest_time", ":troop_id"),
(assign, ":visit_lady_location", ":location"),
(try_end),
(try_begin),
(gt, ":lady_not_visited_longest_time", 0),
(call_script, "script_add_notification_menu", "mnu_notification_lady_requests_visit", ":lady_not_visited_longest_time", ":visit_lady_location"),
(try_end),
(try_end),
]),
##################grueso tempered chief################
###chief asigna lvl de skill segun numero de tropas, para prisioneros
(1 , #chief
[
(party_get_num_companion_stacks, ":num_stacks","p_main_party"),
(assign, ":num_men", 0),
(try_for_range, ":i_stack", 0, ":num_stacks"),
(party_stack_get_size, ":stack_size","p_main_party",":i_stack"),
(val_add, ":num_men", ":stack_size"),
(try_end),
(try_begin),
(lt, ":num_men", 50),
(call_script, "script_troop_set_skill_level", "skl_prisoner_management", 1),
(else_try),
(gt, ":num_men", 49),
(lt, ":num_men", 100),
(call_script, "script_troop_set_skill_level", "skl_prisoner_management", 2),
(else_try),
(gt, ":num_men", 99),
(lt, ":num_men", 150),
(call_script, "script_troop_set_skill_level", "skl_prisoner_management", 3),
(else_try),
(gt, ":num_men", 149),
(lt, ":num_men", 200),
(call_script, "script_troop_set_skill_level", "skl_prisoner_management", 4),
(else_try),
(gt, ":num_men", 199),
(lt, ":num_men", 250),
(call_script, "script_troop_set_skill_level", "skl_prisoner_management", 5),
(else_try),
(gt, ":num_men", 249),
(lt, ":num_men", 300),
(call_script, "script_troop_set_skill_level", "skl_prisoner_management", 6),
(else_try),
(gt, ":num_men", 299),
(lt, ":num_men", 350),
(call_script, "script_troop_set_skill_level", "skl_prisoner_management", 7),
(else_try),
(gt, ":num_men", 349),
(lt, ":num_men", 400),
(call_script, "script_troop_set_skill_level", "skl_prisoner_management", 8),
(else_try),
(gt, ":num_men", 399),
(lt, ":num_men", 450),
(call_script, "script_troop_set_skill_level", "skl_prisoner_management", 9),
(else_try),
(gt, ":num_men", 449),
(call_script, "script_troop_set_skill_level", "skl_prisoner_management", 10),
(else_try),
(call_script, "script_troop_set_skill_level", "skl_prisoner_management", 10),
(try_end),
]),
######prisioneros acaba
#####Ikaguia chief bardo entretenimiento acaba
#entertainment party morale bonus
(24, [
(assign, ":entertain_bonus", 0),
#companions
(store_party_size_wo_prisoners, reg0, "p_main_party"),
(try_begin),
(gt, reg0, 1),
(try_for_range, ":hero", companions_begin, companions_end),
(main_party_has_troop,":hero"),
(store_skill_level,":skill","skl_entertain",":hero"),
(store_mul, reg0, ":skill", ":skill"), #higher skill has bigger effect
(val_add, ":entertain_bonus", reg0),
(try_end),
#player troop
(store_skill_level,":skill","skl_entertain","trp_player"),
(store_mul, reg0, ":skill", ":skill"), #higher skill has bigger effect
(val_add, ":entertain_bonus", reg0),
#now get the bonus
(assign, reg0, ":entertain_bonus"),
(convert_to_fixed_point, reg0),
(store_sqrt, ":entertain_bonus", reg0),
(convert_from_fixed_point, ":entertain_bonus"),
(val_mul, ":entertain_bonus", "$entertainement_on"), #normal kind is 1 but if it is an aewsome entertainement it will get a bonus (like playing lordly/royal musics)
(val_div, ":entertain_bonus", 2), #every two skill level gives a morale point (normally)
#and apply it
(try_begin),
(gt, ":entertain_bonus", 0),
(display_message, "@Your troops enjoy the entertainment you and your companions give them."),
(call_script, "script_change_player_party_morale", ":entertain_bonus"),
(else_try),
(display_message, "@Your troops wish you and your companions would provide more entertainment."),
(lt, "$entertainement_on", 1),
# (call_script, "script_change_player_party_morale", -1), #Moto, if a player wantnt be bard, should we do him have entertain skill?
(try_end),
(try_end), #party size > 1
(assign, "$entertainement_on", 0), #init for new day
]),
#bardic reputation bonus
#bardic reputation bonus
# (48,[#(store_div, ":reputation", "$bardic_reputation", 1000), MOTO tweak entertainment -- renown bump done in script_entertain_income now
# (val_min, ":reputation", 1),
# (val_add, ":reputation", 1),
# (troop_get_slot, ":old_reputation", "trp_player", slot_troop_renown),
# (store_mul, ":new_reputation", ":old_reputation", ":reputation"), #MOTO: multiply? $bardic_reputation will have an EXPONENTIAL effect...
# (troop_set_slot, "trp_player", slot_troop_renown, ":new_reputation"),
# (store_sub, reg12, ":new_reputation", ":old_reputation"),
# (try_begin),
# (gt, reg12, 0),
# (display_message, "@You gained {reg12} renown over the last two days from your bardic reputation.", 0x33ff33),
# (else_try),
# (lt, reg12, 0),
# (val_mul, reg12, -1),
# (display_message, "@You lost {reg12} renown over the last two days from your bardic reputation.", 0xff3333),
# (try_end),
# ]),
#entertainment effects other than party morale NOW a script called from menu
# (12, [(ge, "$entertainement_on", 1),
# (assign, ":income_rate", "$entertain_income_rate"),
# (assign, ":income_type", "$entertain_income_type"),
# (assign, ":income_type2", "$entertain_income_type2"),
# (store_mul, ":max", ":income_rate", 1),
# (store_skill_level,":skill_lvl","skl_entertain","trp_player"),
# (val_add, ":max", ":skill_lvl"),
# (val_mul, ":max", "$entertainement_on"),
# (store_mul, ":min", ":income_rate", -1),
# (val_div, ":min", 2),
# (val_div, ":min", "$entertainement_on"),
# (store_random_in_range, ":income", ":min", ":max"),
# (store_div, ":reputation", "$bardic_reputation", 400),
# (val_min, ":reputation", 1),
# (val_add, ":reputation", 1),
# (val_mul, ":income", ":reputation"),
# (val_sub, ":income", ":reputation"),
# (call_script, "script_entertain_income", ":income", ":income_type"),
# (call_script, "script_entertain_income", ":income", ":income_type2"),
# ]),
###skill de entretenimiento acaba bardo
###rigale chief
(4 , #rigale begging
[
(troop_get_slot, ":player_renown","trp_player", slot_troop_renown),
(str_store_string,s2,"@0",),
(str_store_string,s3,"@0",),
(try_begin),
(eq,"$begging_action_started",1),
(store_random_in_range,":honor_loss",1,6),
(try_begin),
(eq,":honor_loss",1),
(val_sub,"$player_honor",1),
(str_store_string,s2,"@1",),
(try_end),
(store_random_in_range,":renown_loss",1,6),
(try_begin),
(eq,":renown_loss",1),
(val_sub,":player_renown",1),
(str_store_string,s3,"@1",),
(troop_set_slot, "trp_player", slot_troop_renown, ":player_renown"),
(try_end),
(store_random_in_range,reg0,0,11), #gold gain
(display_message,"@You gain {reg0} scillingas from begging. You lose {s2} reputation and {s3} renown"),
(troop_add_gold,"trp_player",reg0),
(try_end),
]),
( 1, #rigale ambush notices
[
(try_begin),
(eq, "$ambush_set_by_player", 1),
(try_begin),
(eq, "$type_of_ambushing_success", 1),
(store_random_in_range,":show_message",1,16),
(try_begin),
(lt,":show_message",2),
(display_message,"@You have very bad feelings about this ambush...",0xFF0000),
(else_try),
(is_between,":show_message",2,6),
(display_message,"@You have bad feelings about this ambush.",0xFF9999),
(else_try),
(is_between,":show_message",6,13),
(display_message,"@You have good feelings about this ambush.",0xCCFF33),
(else_try),
(gt,":show_message",13),
(display_message,"@You have very good feelings about this ambush.",0x66FF33),
(try_end),
(else_try),
(eq, "$type_of_ambushing_success", 2),
(store_random_in_range,":show_message",1,16),
(try_begin),
(lt,":show_message",2),
(display_message,"@You have very bad feelings about this ambush...",0xFF0000),
(else_try),
(is_between,":show_message",2,7),
(display_message,"@You have bad feelings about this ambush.",0xFF9999),
(else_try),
(is_between,":show_message",7,14),
(display_message,"@You have good feelings about this ambush.",0xCCFF33),
(else_try),
(gt,":show_message",14),
(display_message,"@You have very good feelings about this ambush.",0x66FF33),
(try_end),
(else_try),
(eq, "$type_of_ambushing_success", 3),
(store_random_in_range,":show_message",1,16),
(try_begin),
(lt,":show_message",2),
(display_message,"@You have very bad feelings about this ambush...",0xFF0000),
(else_try),
(is_between,":show_message",2,9),
(display_message,"@You have bad feelings about this ambush.",0xFF9999),
(else_try),
(is_between,":show_message",9,14),
(display_message,"@You have good feelings about this ambush.",0xCCFF33),
(else_try),
(gt,":show_message",14),
(display_message,"@You have very good feelings about this ambush.",0x66FF33),
(try_end),
(else_try),
(eq, "$type_of_ambushing_success", 4),
(store_random_in_range,":show_message",1,16),
(try_begin),
(lt,":show_message",4),
(display_message,"@You have very bad feelings about this ambush...",0xFF0000),
(else_try),
(is_between,":show_message",4,10),
(display_message,"@You have bad feelings about this ambush.",0xFF9999),
(else_try),
(is_between,":show_message",10,14),
(display_message,"@You have good feelings about this ambush.",0xCCFF33),
(else_try),
(gt,":show_message",14),
(display_message,"@You have very good feelings about this ambush.",0x66FF33),
(try_end),
(try_end),
(rest_for_hours_interactive,2,1,1),
(try_end),
]
),
( 1, #rigale sneaking notices
[
(try_begin),
(eq, "$sneaking_set_by_player", 1),
(try_begin),
(eq, "$type_of_sneaking_success", 1),
(store_random_in_range,":show_message",1,16),
(try_begin),
(lt,":show_message",2),
(display_message,"@You have very bad feelings about this sneaking...",0xFF0000),
(else_try),
(is_between,":show_message",2,6),
(display_message,"@You have bad feelings about this sneaking.",0xFF9999),
(else_try),
(is_between,":show_message",6,13),
(display_message,"@You have good feelings about this sneaking.",0xCCFF33),
(else_try),
(gt,":show_message",13),
(display_message,"@You have very good feelings about this sneaking.",0x66FF33),
(try_end),
(else_try),
(eq, "$type_of_sneaking_success", 2),
(store_random_in_range,":show_message",1,16),
(try_begin),
(lt,":show_message",2),
(display_message,"@You have very bad feelings about this sneaking...",0xFF0000),
(else_try),
(is_between,":show_message",2,7),
(display_message,"@You have bad feelings about this sneaking.",0xFF9999),
(else_try),
(is_between,":show_message",7,14),
(display_message,"@You have good feelings about this sneaking.",0xCCFF33),
(else_try),
(gt,":show_message",14),
(display_message,"@You have very good feelings about this sneaking.",0x66FF33),
(try_end),
(else_try),
(eq, "$type_of_sneaking_success", 3),
(store_random_in_range,":show_message",1,16),
(try_begin),
(lt,":show_message",2),
(display_message,"@You have very bad feelings about this sneaking...",0xFF0000),
(else_try),
(is_between,":show_message",2,9),
(display_message,"@You have bad feelings about this sneaking.",0xFF9999),
(else_try),
(is_between,":show_message",9,14),
(display_message,"@You have good feelings about this sneaking.",0xCCFF33),
(else_try),
(gt,":show_message",14),
(display_message,"@You have very good feelings about this sneaking.",0x66FF33),
(try_end),
(else_try),
(eq, "$type_of_sneaking_success", 4),
(store_random_in_range,":show_message",1,16),
(try_begin),
(lt,":show_message",4),
(display_message,"@You have very bad feelings about this sneaking...",0xFF0000),
(else_try),
(is_between,":show_message",4,10),
(display_message,"@You have bad feelings about this sneaking.",0xFF9999),
(else_try),
(is_between,":show_message",10,14),
(display_message,"@You have good feelings about this sneaking.",0xCCFF33),
(else_try),
(gt,":show_message",14),
(display_message,"@You have very good feelings about this sneaking.",0x66FF33),
(try_end),
(try_end),
(try_end),
]
),
( 1, #rigale peasantry timelapse
[
(try_begin),
(this_or_next|eq, "$g_player_is_captive", 1),
(this_or_next|party_slot_eq, "$current_town", slot_village_state, svs_being_raided),
(party_slot_ge, "$current_town", slot_village_infested_by_bandits, 1),
# (gt,"$g_work_for_village_ongoing",1),
(gt,"$g_work_for_village_ongoing",0), #MOTO chief avoid successful conclusion
(assign,"$g_work_for_village_ongoing", 0),
(rest_for_hours,0,0,0),
(jump_to_menu,"mnu_village_basic_work"),
(else_try),
(gt,"$g_work_for_village_ongoing",1),
(val_sub, "$g_work_for_village_ongoing", 1),
(store_random_in_range,":show_overrall_message",1,5),
(try_begin),
(eq,":show_overrall_message",1),
(display_message,"@You keep working hard for this village...",0x66CC33),
(try_end),
(rest_for_hours,2,5,0),
(else_try),
(eq,"$g_work_for_village_ongoing",1),
(display_message,"@Your strenuous village work ends.",),
(rest_for_hours,0,0,0),
(val_sub, "$g_work_for_village_ongoing", 1),
(jump_to_menu,"mnu_village_basic_work"),
(try_end),
]
),
###chief acaba rigale
#TEMPERED chief ################### CHANGE CONTEXT MENU FOR PARTY PICKING ##############################
(0, [ (map_free),
(eq,"$pick_party",1),
(assign,"$pick_party",0),
(assign,"$party_picker_active",1),
(dialog_box,"str_party_picker_attack","str_party_picker_title"),
(disable_party,"p_main_party"),
]),
(0, [ (map_free),
(eq,"$party_picker_active",1),
(gt,"$message_party_target",0),
(assign,"$party_picker_active",0),
(enable_party,"p_main_party"),
(start_presentation,"prsnt_view_message"),
]),
#TEMPERED chief ############################ SPEND TIME AFTER BATTLE BURYING THE DEAD AND LOOTING #####################################