Skip to content

Commit

Permalink
* Test: Have lords retreating towards center take the threat in diffe…
Browse files Browse the repository at this point in the history
…rent angles into account when moving towards the center
  • Loading branch information
khamukkamu committed Mar 8, 2019
1 parent a0ae10d commit d712347
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 3 deletions.
90 changes: 88 additions & 2 deletions ModuleSystem/module_simple_triggers.py
Expand Up @@ -920,7 +920,92 @@
## (try_end),
## ]),

# (32) Make heroes running away from someone retreat to friendly centers
# (32) Make heroes running away from someone retreat to friendly centers

#WB Version - Take into account the angle of the center and the lord

] + (is_a_wb_trigger==1 and [
(0.5,
[
(try_for_range, ":cur_troop", heroes_begin, heroes_end),
(troop_slot_eq, ":cur_troop", slot_troop_occupation, slto_kingdom_hero),
(troop_get_slot, ":cur_party", ":cur_troop", slot_troop_leaded_party),
(gt, ":cur_party", 0),
(try_begin),
(party_is_active, ":cur_party"),
(try_begin),
(get_party_ai_current_behavior, ":ai_bhvr", ":cur_party"),
(eq, ":ai_bhvr", ai_bhvr_avoid_party),
(assign, ":continue", 1),
(get_party_ai_current_object, ":ai_object", ":cur_party"),
(eq, ":continue", 1),
(store_faction_of_party, ":party_faction", ":cur_party"),
(party_get_slot, ":commander_party", ":cur_party", slot_party_commander_party),
(faction_get_slot, ":faction_marshall", ":party_faction", slot_faction_marshall),
(neq, ":faction_marshall", ":cur_troop"),
(assign, ":continue", 1),
(try_begin),
(ge, ":faction_marshall", 0),
(troop_get_slot, ":faction_marshall_party", ":faction_marshall", slot_troop_leaded_party),
(party_is_active, ":faction_marshall_party", 0),
(eq, ":commander_party", ":faction_marshall_party"),
(assign, ":continue", 0),
(try_end),
(eq, ":continue", 1),
(assign, ":done", 0),
(try_for_range, ":cur_center", centers_begin, centers_end),
(party_is_active, ":cur_center"), #TLD
(party_slot_eq, ":cur_center", slot_center_destroyed, 0), #TLD
(eq, ":done", 0),
(party_slot_eq, ":cur_center", slot_center_is_besieged_by, -1),
(store_faction_of_party, ":center_faction", ":cur_center"),
(store_relation, ":cur_relation", ":center_faction", ":party_faction"),
(gt, ":cur_relation", 0),
(store_distance_to_party_from_party, ":cur_distance", ":cur_party", ":cur_center"),
(lt, ":cur_distance", 20),
(party_get_position, pos1, ":cur_party"),
(party_get_position, pos2, ":cur_center"),
(neg|position_is_behind_position, pos2, pos1),
#Angle effect start
(assign, ":alpha", 0),
(assign, ":betta",0),
(party_get_position, pos3, ":ai_object"),
(position_get_x, ":x1", pos1),
(position_get_y, ":y1", pos1),
(position_get_x, ":x2", pos2),
(position_get_y, ":y2", pos2),
(position_get_x, ":x3", pos3),
(position_get_y, ":y3", pos3),
(store_sub, ":y", ":y1", ":y2"),
(store_sub, ":x", ":x1", ":x2"),
(store_atan2, ":alpha", ":y", ":x"),
(store_sub, ":y", ":y1", ":y3"),
(store_sub, ":x", ":x1", ":x3"),
(store_atan2, ":betta", ":y", ":x"),
(store_sub, ":angle", ":betta", ":alpha"),
(val_abs, ":angle"),
(store_distance_to_party_from_party, ":cur_distance", ":cur_party", ":ai_object"),
(try_begin),
(gt, ":cur_distance", 5),
(gt, ":angle", 45),
(call_script, "script_party_set_ai_state", ":cur_party", spai_retreating_to_center, ":cur_center"),
(assign, ":done", 1),
(else_try),
(gt, ":angle", 90),
(call_script, "script_party_set_ai_state", ":cur_party", spai_retreating_to_center, ":cur_center"),
(assign, ":done", 1),
(try_end),
(try_end),
(try_end),
(else_try),
(troop_set_slot, ":cur_troop", slot_troop_leaded_party, -1),
(try_end),
(try_end),
]),

#MB Version - Native

] or [
(0.5,[(try_for_range, ":cur_troop", heroes_begin, heroes_end),
(troop_slot_eq, ":cur_troop", slot_troop_occupation, slto_kingdom_hero),
(troop_get_slot, ":cur_party", ":cur_troop", slot_troop_leaded_party),
Expand Down Expand Up @@ -971,7 +1056,8 @@
(try_end),
(try_end),
]),

]) + [

# (33) Centers give alarm if the player is around
(0.5,[(store_current_hours, ":cur_hours"),
(store_mod, ":cur_hours_mod", ":cur_hours", 11),
Expand Down
2 changes: 1 addition & 1 deletion _wb/simple_triggers.txt
Expand Up @@ -32,7 +32,7 @@ simple_triggers_file version 1
48 11 1 3 304 0 50 6 3 1224979098644774912 18 96 132 1 1224979098644774912 541 3 1224979098644774912 260 0 2133 2 1224979098644774913 30 4 0 541 3 1224979098644774912 135 1 2133 2 1224979098644774913 5 3 0 1 3 304 1224979098644774912 1224979098644774913 3 0
48 18 6 3 1224979098644774912 529 614 540 3 1224979098644774912 2 2 2147484208 3 1224979098644774912 8 0 2147484208 3 1224979098644774912 10 1 2147484188 3 1224979098644774912 1 16 2173 2 1224979098644774913 1224979098644774912 4 0 542 3 1224979098644774913 21 0 1 3 118 1224979098644774913 1224979098644774912 2133 2 1224979098644774914 72057594037927936 1 3 435 1224979098644774912 1224979098644774914 1660 2 144115188075856378 1224979098644774914 1 2 149 144115188075856378 5 0 2147484190 3 1224979098644774913 21 0 500 3 1224979098644774912 38 1 3 0 3 0
8 48 11 1 1224979098644774912 541 3 1224979098644774912 0 11 132 1 1224979098644774912 131 1 1224979098644774912 2204 2 1224979098644774913 1224979098644774912 522 3 1224979098644774914 1224979098644774913 82 4 0 2147483680 2 1224979098644774914 0 1 2 583 1224979098644774912 5 0 2136 3 1224979098644774915 0 100 2147483678 2 1224979098644774915 35 1665 2 1224979098644774916 1224979098644774912 2133 2 1224979098644774917 1 4 0 33 3 1224979098644774916 18 96 2147484189 3 1224979098644774916 54 -1 2133 2 1224979098644774917 0 3 0 31 2 1224979098644774917 1 2133 2 1224979098644774918 0 4 0 521 3 1224979098644774919 1224979098644774912 4 31 2 1224979098644774919 13 521 3 1224979098644774920 1224979098644774912 5 31 2 1224979098644774916 1224979098644774920 2133 2 1224979098644774918 1 3 0 2133 2 1224979098644774921 -1 4 0 1 3 121 1224979098644774916 1224979098644774913 2133 2 1224979098644774921 72057594037927936 31 2 1224979098644774921 -1 1 2 583 1224979098644774912 3 0 33 3 1224979098644774921 18 96 2147483778 2 1224979098644774912 1224979098644774921 4 0 31 2 1224979098644774918 1 1 3 79 1224979098644774912 1224979098644774916 3 0 1640 2 1224979098644774912 1 1641 2 1224979098644774912 1224979098644774921 1603 3 1224979098644774912 65536 0 501 3 1224979098644774912 4 13 501 3 1224979098644774912 5 1224979098644774921 3 0 3 0
0.5 49 6 3 1224979098644774912 529 614 540 3 1224979098644774912 2 2 520 3 1224979098644774913 1224979098644774912 10 32 2 1224979098644774913 0 4 0 132 1 1224979098644774913 4 0 2293 2 1224979098644774914 1224979098644774913 31 2 1224979098644774914 5 2204 2 1224979098644774915 1224979098644774913 521 3 1224979098644774916 1224979098644774913 30 522 3 1224979098644774917 1224979098644774915 7 2147483679 2 1224979098644774917 1224979098644774912 2133 2 1224979098644774918 1 4 0 30 2 1224979098644774917 0 520 3 1224979098644774919 1224979098644774917 10 30 2 1224979098644774919 0 31 2 1224979098644774916 1224979098644774919 2133 2 1224979098644774918 0 3 0 4 0 2270 1 1224979098644774920 561 3 1224979098644774913 32 1224979098644774920 2133 2 1224979098644774918 0 3 0 31 2 1224979098644774918 1 2133 2 1224979098644774921 0 6 3 1224979098644774922 18 96 132 1 1224979098644774922 541 3 1224979098644774922 260 0 31 2 1224979098644774921 0 541 3 1224979098644774922 54 -1 2204 2 1224979098644774923 1224979098644774922 2190 3 1224979098644774924 1224979098644774923 1224979098644774915 32 2 1224979098644774924 0 2281 3 1224979098644774925 1224979098644774913 1224979098644774922 2147483678 2 1224979098644774925 20 1625 2 1 1224979098644774913 1625 2 2 1224979098644774922 2147484362 2 2 1 1 4 421 1224979098644774913 14 1224979098644774922 2133 2 1224979098644774921 1 3 0 3 0 5 0 500 3 1224979098644774912 10 -1 3 0 3 0
0.5 73 6 3 1224979098644774912 529 614 540 3 1224979098644774912 2 2 520 3 1224979098644774913 1224979098644774912 10 32 2 1224979098644774913 0 4 0 132 1 1224979098644774913 4 0 2293 2 1224979098644774914 1224979098644774913 31 2 1224979098644774914 5 2133 2 1224979098644774915 1 2294 2 1224979098644774916 1224979098644774913 31 2 1224979098644774915 1 2204 2 1224979098644774917 1224979098644774913 521 3 1224979098644774918 1224979098644774913 30 522 3 1224979098644774919 1224979098644774917 7 2147483679 2 1224979098644774919 1224979098644774912 2133 2 1224979098644774915 1 4 0 30 2 1224979098644774919 0 520 3 1224979098644774920 1224979098644774919 10 132 2 1224979098644774920 0 31 2 1224979098644774918 1224979098644774920 2133 2 1224979098644774915 0 3 0 31 2 1224979098644774915 1 2133 2 1224979098644774921 0 6 3 1224979098644774922 18 96 132 1 1224979098644774922 541 3 1224979098644774922 260 0 31 2 1224979098644774921 0 541 3 1224979098644774922 54 -1 2204 2 1224979098644774923 1224979098644774922 2190 3 1224979098644774924 1224979098644774923 1224979098644774917 32 2 1224979098644774924 0 2281 3 1224979098644774925 1224979098644774913 1224979098644774922 2147483678 2 1224979098644774925 20 1625 2 1 1224979098644774913 1625 2 2 1224979098644774922 2147484362 2 2 1 2133 2 1224979098644774926 0 2133 2 1224979098644774927 0 1625 2 3 1224979098644774916 726 2 1224979098644774928 1 727 2 1224979098644774929 1 726 2 1224979098644774930 2 727 2 1224979098644774931 2 726 2 1224979098644774932 3 727 2 1224979098644774933 3 2121 3 1224979098644774934 1224979098644774929 1224979098644774931 2121 3 1224979098644774935 1224979098644774928 1224979098644774930 2143 3 1224979098644774926 1224979098644774934 1224979098644774935 2121 3 1224979098644774934 1224979098644774929 1224979098644774933 2121 3 1224979098644774935 1224979098644774928 1224979098644774932 2143 3 1224979098644774927 1224979098644774934 1224979098644774935 2121 3 1224979098644774936 1224979098644774927 1224979098644774926 2113 1 1224979098644774936 2281 3 1224979098644774925 1224979098644774913 1224979098644774916 4 0 32 2 1224979098644774925 5 32 2 1224979098644774936 45 1 4 421 1224979098644774913 14 1224979098644774922 2133 2 1224979098644774921 1 5 0 32 2 1224979098644774936 90 1 4 421 1224979098644774913 14 1224979098644774922 2133 2 1224979098644774921 1 3 0 3 0 3 0 5 0 500 3 1224979098644774912 10 -1 3 0 3 0
0.5 46 2270 1 1224979098644774912 2119 3 1224979098644774913 1224979098644774912 11 2121 3 1224979098644774914 1224979098644774912 5 1601 2 1224979098644774915 0 1602 2 1224979098644774916 0 2105 2 1224979098644774915 1224979098644774916 2130 1 1224979098644774915 2125 2 1224979098644774917 1224979098644774915 2131 1 1224979098644774917 4 0 31 2 1224979098644774913 0 6 3 1224979098644774918 3 21 522 3 1224979098644774919 1224979098644774918 30 2106 2 1224979098644774919 1 2111 2 1224979098644774919 0 502 3 1224979098644774918 30 1224979098644774919 3 0 3 0 31 2 144115188075855996 0 6 3 1224979098644774920 18 96 132 1 1224979098644774920 541 3 1224979098644774920 260 0 2204 2 1224979098644774918 1224979098644774920 2190 3 1224979098644774921 1224979098644774918 22 2147483678 2 1224979098644774921 0 2281 3 1224979098644774922 0 1224979098644774920 2147483678 2 1224979098644774922 5 2122 3 1224979098644774923 1224979098644774922 1224979098644774922 2121 3 1224979098644774924 20 1224979098644774923 2121 3 1224979098644774925 20 1224979098644774921 2122 3 1224979098644774926 1224979098644774924 1224979098644774925 2107 2 1224979098644774926 1224979098644774917 2123 3 1224979098644774927 1224979098644774926 10 2136 3 1224979098644774928 0 1000 2147483678 2 1224979098644774928 1224979098644774927 522 3 1224979098644774919 1224979098644774918 30 2105 2 1224979098644774919 1 2110 2 1224979098644774919 100 502 3 1224979098644774918 30 1224979098644774919 4 0 2147484209 3 1224979098644774920 42 1224979098644774914 2342 2 1 1224979098644774920 1106 1 1585267068834415863 501 3 1224979098644774920 42 1224979098644774912 3 0 3 0
5 4 1 2 111 0 2133 2 1224979098644774912 72057594037927936 32 2 1224979098644774912 0 1 2 249 1224979098644774912
14 64 31 2 144115188075855996 0 1650 2 1224979098644774912 0 2133 2 1224979098644774913 0 2133 2 1224979098644774914 0 6 3 1224979098644774915 0 1224979098644774912 1653 3 1224979098644774916 0 1224979098644774915 2105 2 1224979098644774913 1224979098644774916 1652 3 72057594037927937 0 1224979098644774915 1506 2 72057594037927937 72057594037927937 4 0 1073741855 2 72057594037927937 5 1073741855 2 72057594037927937 7 31 2 72057594037927937 6 2105 2 1224979098644774914 1224979098644774916 3 0 31 2 72057594037927937 5 2105 2 1224979098644774913 1224979098644774916 3 0 2108 2 1224979098644774913 3 4 0 31 2 1224979098644774913 0 2105 2 1224979098644774913 1 3 0 2133 2 1224979098644774917 1224979098644774913 2133 2 1224979098644774918 0 6 3 1224979098644774919 0 1224979098644774917 2133 2 1224979098644774920 0 4 0 507 3 1 0 0 1 3 169 1 41 2105 2 1224979098644774920 1 3 0 6 3 1224979098644774921 7 14 507 3 1224979098644774921 0 0 1 3 169 1224979098644774921 41 4 0 31 2 1224979098644774921 7 32 2 1224979098644774914 0 2105 2 1224979098644774920 1 5 0 2147483679 2 1224979098644774921 7 2105 2 1224979098644774920 1 3 0 3 0 4 0 32 2 1224979098644774920 0 2136 3 1224979098644774922 0 1224979098644774920 1 2 248 1224979098644774922 5 0 31 2 1224979098644774918 0 1106 2 1585267068834415864 16711680 1 2 168 -3 2133 2 1224979098644774918 1 4 0 1 2 107 0 32 2 72057594037927936 0 1 3 289 2 216172782113784368 3 0 3 0 3 0 4 0 2147483678 2 144115188075856580 6 1 1 601 3 0
Expand Down

0 comments on commit d712347

Please sign in to comment.