Skip to content

Commit

Permalink
*Fix to Force Faction Center & TLD DIstance Scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
khamukkamu committed May 24, 2017
1 parent 5aa75c9 commit 5b211d9
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 29 deletions.
10 changes: 5 additions & 5 deletions ModuleSystem/module_scripts.py
Expand Up @@ -21398,7 +21398,7 @@ def set_item_score():
(assign, reg0, "p_town_eastfold"),
(else_try),
(eq, ":town",3),
(party_is_active, "p_town_eastfold"),
(party_is_active, "p_town_west_emnet"),
(assign, reg0, "p_town_west_emnet"),
(else_try),
(call_script, "script_cf_get_random_enemy_center_within_range", "p_main_party", tld_max_quest_distance),
Expand Down Expand Up @@ -21466,7 +21466,7 @@ def set_item_score():
(assign, reg0, "p_town_woodelf_camp"),
(else_try),
(eq, ":town", 2),
(party_is_active, "p_town_woodelf_camp"),
(party_is_active, "p_town_woodelf_west_camp"),
(assign, reg0, "p_town_woodelf_west_camp"),
(else_try),
(call_script, "script_cf_get_random_enemy_center_within_range", "p_main_party", tld_max_quest_distance),
Expand All @@ -21486,7 +21486,7 @@ def set_item_score():
(assign, reg0, "p_town_erebor"),
(else_try),
(eq, ":town", 2),
(party_is_active, "p_town_woodelf_camp"),
(party_is_active, "p_town_esgaroth"),
(assign, reg0, "p_town_esgaroth"),
(else_try),
(eq, ":town", 3),
Expand Down Expand Up @@ -21530,7 +21530,7 @@ def set_item_score():
(assign, reg0, "p_town_urukhai_outpost"),
(else_try),
(eq, ":town", 3),
(party_is_active, "p_town_urukhai_outpost"),
(party_is_active, "p_town_urukhai_r_camp"),
(assign, reg0, "p_town_urukhai_r_camp"),
(else_try),
(call_script, "script_cf_get_random_enemy_center_within_range", "p_main_party", tld_max_quest_distance),
Expand Down Expand Up @@ -21574,7 +21574,7 @@ def set_item_score():
(assign, reg0, "p_town_moria"),
(else_try),
(eq, ":town", 3),
(party_is_active, "p_town_moria"),
(party_is_active, "p_town_goblin_south_outpost"),
(assign, reg0, "p_town_goblin_south_outpost"),
(else_try),
(call_script, "script_cf_get_random_enemy_center_within_range", "p_main_party", tld_max_quest_distance),
Expand Down
56 changes: 40 additions & 16 deletions ModuleSystem/module_scripts_ai.py
Expand Up @@ -2769,7 +2769,7 @@
# (try_end),
# (eq, ":count", 1), #xor, but should never be 2
(try_begin),
(call_script, "script_cf_party_west_of_minas_tirith", ":party1"),
#(call_script, "script_cf_party_west_of_minas_tirith", ":party1"),
(call_script, "script_party_which_side_of_white_mountains", ":party2"), (assign, ":s2", reg0),
(call_script, "script_party_which_side_of_white_mountains", ":party1"), (assign, ":s1", reg0),
(neq, ":s1", ":s2"), # not on same side
Expand All @@ -2784,31 +2784,55 @@
# (str_store_party_name, s14, ":party2"),
# (display_message, "@Debug: TLD distance between {s13} and {s14}: {reg0} (regular: {reg1})."),
]),

]

#Date: 24/05/2017
#Coordinate x grows from East to West
#Coordinate y grows from North to South
#Current Minas Tirith coordinates are (-47.47, 24.28)
#White Mountains follow a line roughtly intersecting points (26,-1) and (-44,24)
#If the maps get edited and the White Mountains are moved, get two coordinates on the
#White Mountains mountaintops, far apart, and update the values below with them
tld_white_mountains_p1=( 26,-1)
tld_white_mountains_p2=(-44,24)
#And let me handle the rest obtaining the line equation y=mx+n
tld_white_mountains_m=(tld_white_mountains_p1[1]-tld_white_mountains_p2[1])*1.0/(tld_white_mountains_p1[0]-tld_white_mountains_p2[0])
tld_white_mountains_n=tld_white_mountains_p1[1]-tld_white_mountains_m*tld_white_mountains_p1[0]
tld_white_mountains_m=int(round(tld_white_mountains_m*100,0))
tld_white_mountains_n=int(round(tld_white_mountains_n*10000,0)) # When doing y=x*m + n, both x and m are mult * 100, k now must be mult an extra *100

ai_scripts+=[
# script_cf_party_is_south_of_white_mountains (drastically simpler version -- mtarini)
# Input: party
# Output: reg1 = 0 if NORTH. reg1 = 1 if SOUTH
("party_which_side_of_white_mountains", [
(set_fixed_point_multiplier, 100),
(store_script_param, ":party", 1),
(party_get_position, pos10, ":party"),
(position_get_x, ":x", pos10),
(position_get_y, ":y", pos10),
(store_mul,":k",":x",374.4),(store_mul,":k2",":y",1000), (val_add,":k",":k2"),
(try_begin),
(ge,":k",725184),
(assign, reg1, 1),
(else_try),
(assign, reg1, 0),
(try_end),
(set_fixed_point_multiplier, 100),
(store_script_param, ":party", 1),
(party_get_position, pos10, ":party"),
(position_get_x, ":x", pos10),
(position_get_y, ":y", pos10),
#Rafa: calculate the White Mountains y at the party's position's x, let's call that value k
(store_mul,":k",":x",tld_white_mountains_m),
(val_add,":k",tld_white_mountains_n),
#Put y on the same order of magnitude than k
(val_mul,":y",100),
#(store_mul,":k",":x",374.4),(store_mul,":k2",":y",1000), (val_add,":k",":k2"),
(try_begin), # compare y and k
#(ge,":k",725184),
(gt,":y",":k"), #y grows from north to south
(assign, reg0, 1), #South
(else_try),
(assign, reg0, 0), #North
(try_end),
]),

("cf_party_west_of_minas_tirith", [
(set_fixed_point_multiplier, 100),
(store_script_param, ":party", 1),
(party_get_position, pos10, ":party"),
(position_get_x, ":x", pos10),
(gt, ":x", 4631),
(position_get_x, ":x", pos10),
#(gt, ":x", 4631),
(gt, ":x", -4747),
]),

# # script_cf_party_is_south_of_white_mountains
Expand Down
8 changes: 4 additions & 4 deletions _wb/scripts.txt
Expand Up @@ -879,11 +879,11 @@ get_advcamp_pos -1
destroy_center -1
62 23 2 1224979098644774912 1 2204 2 1224979098644774913 1224979098644774912 501 3 1224979098644774912 54 -1 1 2 526 1224979098644774912 4 0 542 3 144115188075855993 154 1224979098644774912 520 3 1224979098644774914 0 50 32 2 1224979098644774914 0 132 1 1224979098644774914 1661 1 1224979098644774914 1 2 518 1224979098644774914 500 3 0 0 50 3 0 4 0 31 2 1224979098644774912 31 31 2 1224979098644774913 5 542 3 5 154 31 2204 2 1224979098644774915 33 31 2 1224979098644774915 5 502 3 5 154 33 1106 1 1585267068834415113 3 0 1695 2 1224979098644774916 1224979098644774912 7 3 1224979098644774917 0 1224979098644774916 1696 3 1224979098644774918 1224979098644774912 1224979098644774917 32 2 1224979098644774918 0 132 1 1224979098644774918 1661 1 1224979098644774918 3 0 4 0 33 3 1224979098644774912 78 96 2270 1 1224979098644774919 502 3 1224979098644774913 162 1224979098644774919 522 3 1224979098644774920 1224979098644774913 159 501 3 1224979098644774912 259 1224979098644774920 6 3 1224979098644774921 181 196 2281 3 1224979098644774922 1224979098644774912 1224979098644774921 2147483680 2 1224979098644774922 1 501 3 1224979098644774921 4 0 3 0 1230 1 1224979098644774912 5 0 501 3 1224979098644774912 260 1 1603 3 1224979098644774912 2114560 1 4 0 541 3 1224979098644774912 258 2 1676 2 1224979098644774912 246 5 0 4 0 2147483679 2 1224979098644774912 18 1677 2 1224979098644774912 246 5 0 1677 2 1224979098644774912 247 3 0 3 0 2330 2 1 1224979098644774912 1669 2 1224979098644774912 1585267068834415114 1620 2 1224979098644774912 26 1678 2 1224979098644774912 45 501 3 1224979098644774912 38 25 3 0 1 2 267 1224979098644774912
get_tld_distance -1
15 23 2 1224979098644774912 1 23 2 1224979098644774913 2 4 0 1 2 441 1224979098644774912 1 2 440 1224979098644774913 2133 2 1224979098644774914 72057594037927936 1 2 440 1224979098644774912 2133 2 1224979098644774915 72057594037927936 2147483679 2 1224979098644774915 1224979098644774914 2281 3 1224979098644774916 1224979098644774912 18 2281 3 72057594037927936 1224979098644774913 18 2105 2 72057594037927936 1224979098644774916 5 0 2281 3 72057594037927936 1224979098644774912 1224979098644774913 3 0
14 23 2 1224979098644774912 1 23 2 1224979098644774913 2 4 0 1 2 440 1224979098644774913 2133 2 1224979098644774914 72057594037927936 1 2 440 1224979098644774912 2133 2 1224979098644774915 72057594037927936 2147483679 2 1224979098644774915 1224979098644774914 2281 3 1224979098644774916 1224979098644774912 18 2281 3 72057594037927936 1224979098644774913 18 2105 2 72057594037927936 1224979098644774916 5 0 2281 3 72057594037927936 1224979098644774912 1224979098644774913 3 0
party_which_side_of_white_mountains -1
14 2124 1 100 23 2 1224979098644774912 1 1625 2 10 1224979098644774912 726 2 1224979098644774913 10 727 2 1224979098644774914 10 2122 3 1224979098644774915 1224979098644774913 374 2122 3 1224979098644774916 1224979098644774914 1000 2105 2 1224979098644774915 1224979098644774916 4 0 30 2 1224979098644774915 725184 2133 2 72057594037927937 1 5 0 2133 2 72057594037927937 0 3 0
14 2124 1 100 23 2 1224979098644774912 1 1625 2 10 1224979098644774912 726 2 1224979098644774913 10 727 2 1224979098644774914 10 2122 3 1224979098644774915 1224979098644774913 -36 2105 2 1224979098644774915 82857 2107 2 1224979098644774914 100 4 0 32 2 1224979098644774914 1224979098644774915 2133 2 72057594037927936 1 5 0 2133 2 72057594037927936 0 3 0
cf_party_west_of_minas_tirith -1
5 2124 1 100 23 2 1224979098644774912 1 1625 2 10 1224979098644774912 726 2 1224979098644774913 10 32 2 1224979098644774913 4631
5 2124 1 100 23 2 1224979098644774912 1 1625 2 10 1224979098644774912 726 2 1224979098644774913 10 32 2 1224979098644774913 -4747
get_advcamp_pos_predefined -1
75 23 2 1224979098644774912 1 522 3 1224979098644774913 1224979098644774912 160 522 3 1224979098644774914 1224979098644774912 159 2133 2 1224979098644774915 186 2133 2 1224979098644774916 191 4 0 31 2 1224979098644774913 8 2133 2 1224979098644774915 181 2133 2 1224979098644774916 186 5 0 31 2 1224979098644774913 1 2133 2 1224979098644774915 191 2133 2 1224979098644774916 196 5 0 31 2 1224979098644774913 4 31 2 1224979098644774914 8 2133 2 1224979098644774915 181 2133 2 1224979098644774916 186 5 0 31 2 1224979098644774913 4 2147483679 2 1224979098644774914 8 2133 2 1224979098644774915 186 2133 2 1224979098644774916 191 5 0 31 2 1224979098644774913 2 31 2 1224979098644774914 1 2133 2 1224979098644774915 191 2133 2 1224979098644774916 196 5 0 31 2 1224979098644774913 2 2147483679 2 1224979098644774914 1 2133 2 1224979098644774915 186 2133 2 1224979098644774916 191 3 0 2133 2 1224979098644774917 1 6 3 1224979098644774918 1224979098644774915 1224979098644774916 31 2 1224979098644774917 1 541 3 1224979098644774918 4 0 501 3 1224979098644774918 4 1 1625 2 1 1224979098644774918 2133 2 1224979098644774917 0 3 0 1625 2 2 1224979098644774915 4 0 31 2 1224979098644774917 1 2133 2 1224979098644774919 5 6 3 1224979098644774920 0 1000 31 2 1224979098644774917 1 1627 3 1 2 1224979098644774919 2133 2 1224979098644774921 0 6 3 1224979098644774918 18 96 31 2 1224979098644774921 0 132 1 1224979098644774918 541 3 1224979098644774918 260 0 2204 2 1224979098644774922 1224979098644774918 2190 3 1224979098644774923 1224979098644774922 1224979098644774912 1625 2 3 1224979098644774918 710 3 1224979098644774924 1 3 4 0 2147483678 2 1224979098644774924 500 3221225502 2 1224979098644774923 0 2147483678 2 1224979098644774924 200 2133 2 1224979098644774921 1 3 0 3 0 4 0 31 2 1224979098644774921 0 2133 2 1224979098644774917 0 5 0 2119 3 1224979098644774925 1224979098644774920 5 31 2 1224979098644774925 4 2105 2 1224979098644774919 1 3 0 3 0 3 0
calculate_decision_numbers -1
Expand Down Expand Up @@ -1035,7 +1035,7 @@ find_closest_enemy_town_or_host_only -1
cf_gain_trait_butcher -1
2 540 3 872 23 0 1 2 335 23
force_faction_center_by_region -1
233 21 1 1224979098644774912 22 1 1224979098644774913 1 2 179 1224979098644774912 2133 2 1224979098644774914 72057594037927937 4 0 1073741855 2 1224979098644774913 1 31 2 1224979098644774913 2 4 0 33 3 1224979098644774914 13 31 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 31 2133 2 72057594037927936 31 5 0 31 2 1224979098644774915 1 132 1 34 2133 2 72057594037927936 34 5 0 31 2 1224979098644774915 2 132 1 37 2133 2 72057594037927936 37 5 0 31 2 1224979098644774915 3 132 1 37 2133 2 72057594037927936 36 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 0 13 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 18 2133 2 72057594037927936 18 5 0 31 2 1224979098644774915 1 132 1 19 2133 2 72057594037927936 19 5 0 31 2 1224979098644774915 2 132 1 20 2133 2 72057594037927936 20 5 0 31 2 1224979098644774915 2 132 1 23 2133 2 72057594037927936 23 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 31 34 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 47 2133 2 72057594037927936 47 5 0 31 2 1224979098644774915 1 132 1 64 2133 2 72057594037927936 64 5 0 31 2 1224979098644774915 2 132 1 55 2133 2 72057594037927936 55 5 0 31 2 1224979098644774915 3 132 1 48 2133 2 72057594037927936 48 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 34 36 2136 3 1224979098644774915 0 3 4 0 31 2 1224979098644774915 0 132 1 50 2133 2 72057594037927936 50 5 0 31 2 1224979098644774915 1 132 1 51 2133 2 72057594037927936 51 5 0 31 2 1224979098644774915 2 132 1 51 2133 2 72057594037927936 52 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 36 37 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 58 2133 2 72057594037927936 58 5 0 31 2 1224979098644774915 1 132 1 76 2133 2 72057594037927936 76 5 0 31 2 1224979098644774915 2 132 1 51 2133 2 72057594037927936 59 5 0 31 2 1224979098644774915 3 132 1 77 2133 2 72057594037927936 77 5 0 1 3 124 0 100 3 0 5 0 4 0 132 1 18 2133 2 72057594037927936 18 5 0 1 3 124 0 100 3 0 3 0 5 0 4 0 33 3 1224979098644774914 13 31 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 43 2133 2 72057594037927936 43 5 0 31 2 1224979098644774915 1 132 1 60 2133 2 72057594037927936 60 5 0 31 2 1224979098644774915 2 132 1 44 2133 2 72057594037927936 44 5 0 31 2 1224979098644774915 3 132 1 44 2133 2 72057594037927936 46 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 0 13 2136 3 1224979098644774915 0 3 4 0 31 2 1224979098644774915 0 132 1 39 2133 2 72057594037927936 39 5 0 31 2 1224979098644774915 1 132 1 63 2133 2 72057594037927936 63 5 0 31 2 1224979098644774915 2 132 1 62 2133 2 72057594037927936 62 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 31 34 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 65 2133 2 72057594037927936 65 5 0 31 2 1224979098644774915 1 132 1 70 2133 2 72057594037927936 70 5 0 31 2 1224979098644774915 2 132 1 56 2133 2 72057594037927936 56 5 0 31 2 1224979098644774915 3 132 1 56 2133 2 72057594037927936 74 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 34 36 2136 3 1224979098644774915 0 3 4 0 31 2 1224979098644774915 0 132 1 75 2133 2 72057594037927936 75 5 0 31 2 1224979098644774915 1 132 1 65 2133 2 72057594037927936 65 5 0 31 2 1224979098644774915 2 132 1 68 2133 2 72057594037927936 68 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 36 37 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 38 2133 2 72057594037927936 38 5 0 31 2 1224979098644774915 1 132 1 67 2133 2 72057594037927936 67 5 0 31 2 1224979098644774915 2 132 1 73 2133 2 72057594037927936 73 5 0 31 2 1224979098644774915 3 132 1 69 2133 2 72057594037927936 69 5 0 1 3 124 0 100 3 0 5 0 4 0 132 1 38 2133 2 72057594037927936 38 5 0 1 3 124 0 100 3 0 3 0 3 0
233 21 1 1224979098644774912 22 1 1224979098644774913 1 2 179 1224979098644774912 2133 2 1224979098644774914 72057594037927937 4 0 1073741855 2 1224979098644774913 1 31 2 1224979098644774913 2 4 0 33 3 1224979098644774914 13 31 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 31 2133 2 72057594037927936 31 5 0 31 2 1224979098644774915 1 132 1 34 2133 2 72057594037927936 34 5 0 31 2 1224979098644774915 2 132 1 37 2133 2 72057594037927936 37 5 0 31 2 1224979098644774915 3 132 1 36 2133 2 72057594037927936 36 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 0 13 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 18 2133 2 72057594037927936 18 5 0 31 2 1224979098644774915 1 132 1 19 2133 2 72057594037927936 19 5 0 31 2 1224979098644774915 2 132 1 20 2133 2 72057594037927936 20 5 0 31 2 1224979098644774915 2 132 1 23 2133 2 72057594037927936 23 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 31 34 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 47 2133 2 72057594037927936 47 5 0 31 2 1224979098644774915 1 132 1 64 2133 2 72057594037927936 64 5 0 31 2 1224979098644774915 2 132 1 55 2133 2 72057594037927936 55 5 0 31 2 1224979098644774915 3 132 1 48 2133 2 72057594037927936 48 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 34 36 2136 3 1224979098644774915 0 3 4 0 31 2 1224979098644774915 0 132 1 50 2133 2 72057594037927936 50 5 0 31 2 1224979098644774915 1 132 1 51 2133 2 72057594037927936 51 5 0 31 2 1224979098644774915 2 132 1 52 2133 2 72057594037927936 52 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 36 37 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 58 2133 2 72057594037927936 58 5 0 31 2 1224979098644774915 1 132 1 76 2133 2 72057594037927936 76 5 0 31 2 1224979098644774915 2 132 1 59 2133 2 72057594037927936 59 5 0 31 2 1224979098644774915 3 132 1 77 2133 2 72057594037927936 77 5 0 1 3 124 0 100 3 0 5 0 4 0 132 1 18 2133 2 72057594037927936 18 5 0 1 3 124 0 100 3 0 3 0 5 0 4 0 33 3 1224979098644774914 13 31 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 43 2133 2 72057594037927936 43 5 0 31 2 1224979098644774915 1 132 1 60 2133 2 72057594037927936 60 5 0 31 2 1224979098644774915 2 132 1 44 2133 2 72057594037927936 44 5 0 31 2 1224979098644774915 3 132 1 46 2133 2 72057594037927936 46 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 0 13 2136 3 1224979098644774915 0 3 4 0 31 2 1224979098644774915 0 132 1 39 2133 2 72057594037927936 39 5 0 31 2 1224979098644774915 1 132 1 63 2133 2 72057594037927936 63 5 0 31 2 1224979098644774915 2 132 1 62 2133 2 72057594037927936 62 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 31 34 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 65 2133 2 72057594037927936 65 5 0 31 2 1224979098644774915 1 132 1 70 2133 2 72057594037927936 70 5 0 31 2 1224979098644774915 2 132 1 56 2133 2 72057594037927936 56 5 0 31 2 1224979098644774915 3 132 1 74 2133 2 72057594037927936 74 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 34 36 2136 3 1224979098644774915 0 3 4 0 31 2 1224979098644774915 0 132 1 75 2133 2 72057594037927936 75 5 0 31 2 1224979098644774915 1 132 1 65 2133 2 72057594037927936 65 5 0 31 2 1224979098644774915 2 132 1 68 2133 2 72057594037927936 68 5 0 1 3 124 0 100 3 0 5 0 33 3 1224979098644774914 36 37 2136 3 1224979098644774915 0 4 4 0 31 2 1224979098644774915 0 132 1 38 2133 2 72057594037927936 38 5 0 31 2 1224979098644774915 1 132 1 67 2133 2 72057594037927936 67 5 0 31 2 1224979098644774915 2 132 1 73 2133 2 72057594037927936 73 5 0 31 2 1224979098644774915 3 132 1 69 2133 2 72057594037927936 69 5 0 1 3 124 0 100 3 0 5 0 4 0 132 1 38 2133 2 72057594037927936 38 5 0 1 3 124 0 100 3 0 3 0 3 0
safe_remove_party -1
19 21 1 1224979098644774912 2330 2 1 1224979098644774912 4 0 31 2 144115188075855982 1 2147483780 1 1224979098644774912 3 0 4 0 33 3 1224979098644774912 0 457 1230 1 1224979098644774912 1120 1 1585267068834415154 4 0 31 2 144115188075855982 1 3 0 5 0 1232 1 1224979098644774912 4 0 31 2 144115188075855982 1 3 0 3 0
remove_party -1
Expand Down

0 comments on commit 5b211d9

Please sign in to comment.