[Fix] Invalid Troop ID: -1 in Character&Companions menu

Users who are viewing this thread

When accessing the 'Character&Companions' menu without being of any faction, it gives the script error "Invalid Troop ID: -1".
Code:
SCRIPT ERROR ON OPCODE 2322: Invalid Troop ID: -1; LINE NO: 52:
At script: generate_extended_troop_relation_information_string.
At script: generate_extended_troop_relation_information_string.
At script: generate_extended_troop_relation_information_string.
SCRIPT ERROR ON OPCODE 520: Invalid Troop ID: -1; LINE NO: 1:
At script: troop_get_player_relation.
At script: troop_get_player_relation.
SCRIPT ERROR ON OPCODE 520: Invalid Troop ID: -1; LINE NO: 2:
At script: troop_get_player_relation.
At script: troop_get_player_relation.

A conditional is needed to verify that the player has joined a faction, otherwise we will make it not show, avoiding Invalid Troop ID: -1.
In module_scripts, generate_extended_troop_relation_information_string
  • add the red code
# Current liege and relation
(try_begin),
  (is_between, "$players_kingdom", kingdoms_begin, kingdoms_end),
  (faction_slot_eq, "$players_kingdom", slot_faction_state, sfs_active),
  #conditions end

  (try_begin),

    (faction_get_slot, ":liege", "$players_kingdom", slot_faction_leader),
    (str_store_troop_name, s46, ":liege"),
    (try_begin),
      (eq, ":liege", ":troop_no"),
      (assign, reg46, 0),
    (else_try),
      (assign, reg46, ":liege"),
      (str_clear, s47),
      (str_clear, s60),

      # Relation to liege
      (call_script, "script_get_troop_relation_to_player_string", s47, ":liege"),
    (try_end),
  (try_end),
(try_end),

In "scripts.txt" file into de mod folder if you don't use modsys:
look for the next line:
generate_extended_troop_relation_information_string -1
309 23 2 1224979098644774912 1 2319 bla bla bla...
and replace it with this one:
Code:
generate_extended_troop_relation_information_string -1
 309 23 2 1224979098644774912 1 2319 1 1 2319 1 2 2319 1 60 2319 1 42 2319 1 43 2319 1 44 2319 1 45 2319 1 46 2319 1 47 2319 1 48 2319 1 49 2319 1 50 2133 2 72057594037927937 0 2133 2 72057594037927938 0 2133 2 72057594037927976 0 2133 2 72057594037927977 0 2133 2 72057594037927979 0 2133 2 72057594037927980 0 2133 2 72057594037927982 0 2133 2 72057594037927983 0 2133 2 72057594037927984 0 2133 2 72057594037927985 0 2133 2 72057594037927986 0 2133 2 72057594037927987 0 2133 2 72057594037927988 0 4 0 31 2 1224979098644774912 360287970189639680 947 2 144115188075857265 0 2322 2 1 1224979098644774912 520 3 1224979098644774913 1224979098644774912 7 2133 2 72057594037927976 1224979098644774913 520 3 1224979098644774914 1224979098644774912 150 2133 2 72057594037927977 1224979098644774914 2133 2 72057594037927978 144115188075856180 2133 2 72057594037927979 144115188075856031 2120 2 72057594037927981 144115188075856287 4 0 33 3 144115188075856287 432345564227567631 432345564227567638 2335 2 45 144115188075856287 5 0 2133 2 72057594037927981 0 2320 2 45 1585267068834415946 3 0 2133 2 1224979098644774915 144115188075856287 4 0 33 3 1224979098644774915 432345564227567632 432345564227567638 2320 2 44 1585267068834415947 5 0 31 2 1224979098644774915 432345564227567631 2320 2 44 1585267068834415948 5 0 2320 2 44 1585267068834415949 3 0 4 0 33 3 144115188075856287 432345564227567631 432345564227567638 542 3 144115188075856287 21 0 4 0 522 3 1224979098644774916 144115188075856287 11 2322 2 46 1224979098644774916 4 0 31 2 1224979098644774916 1224979098644774912 2133 2 72057594037927982 0 5 0 2133 2 72057594037927982 1224979098644774916 2319 1 47 2319 1 60 1 3 936748722493063897 47 1224979098644774916 3 0 3 0 3 0 1 2 936748722493063898 1224979098644774912 2133 2 1224979098644774917 0 2133 2 1224979098644774918 0 6 3 1224979098644774912 360287970189640549 360287970189640703 1073742364 3 1224979098644774912 2 2 540 3 1224979098644774912 2 9 1 2 936748722493063447 1224979098644774912 2133 2 1224979098644774919 72057594037927936 4 0 32 2 1224979098644774919 19 2105 2 1224979098644774917 1 5 0 2147483678 2 1224979098644774919 -19 2105 2 1224979098644774918 1 3 0 3 0 2133 2 72057594037927937 1224979098644774917 2133 2 72057594037927938 1224979098644774918 2320 2 1 1585267068834415950 5 0 540 3 1224979098644774912 2 2 2322 2 1 1224979098644774912 2319 1 2 2319 1 60 1 3 936748722493063897 2 1224979098644774912 520 3 1224979098644774913 1224979098644774912 7 2133 2 72057594037927976 1224979098644774913 520 3 1224979098644774914 1224979098644774912 150 2133 2 72057594037927977 1224979098644774914 520 3 1224979098644774920 1224979098644774912 52 2133 2 72057594037927978 216172782113785389 2105 2 72057594037927978 1224979098644774920 2320 2 42 72057594037927978 2133 2 72057594037927978 1224979098644774920 520 3 1224979098644774921 1224979098644774912 51 2133 2 72057594037927979 1224979098644774921 2173 2 1224979098644774922 1224979098644774912 520 3 1224979098644774915 1224979098644774912 14 4 0 2106 2 1224979098644774915 432345564227567632 2105 2 1224979098644774915 216172782113785694 2320 2 44 1224979098644774915 3 0 2335 2 45 1224979098644774922 522 3 1224979098644774916 1224979098644774922 11 2322 2 46 1224979098644774916 4 0 33 3 1224979098644774912 360287970189640549 360287970189640571 2133 2 72057594037927982 1 1 3 936748722493063688 1224979098644774912 1224979098644774916 2133 2 72057594037927983 72057594037927936 5 0 4 0 31 2 1224979098644774916 1224979098644774912 2133 2 72057594037927982 0 5 0 2133 2 72057594037927982 1224979098644774916 1 3 936748722493063688 1224979098644774912 1224979098644774916 2133 2 72057594037927983 72057594037927936 3 0 3 0 520 3 72057594037927987 1224979098644774912 47 1 2 936748722493063898 1224979098644774912 2133 2 72057594037927984 0 4 0 560 3 1224979098644774912 8 0 2133 2 72057594037927984 1 520 3 1224979098644774923 1224979098644774912 8 2204 2 1224979098644774924 1224979098644774923 2335 2 48 1224979098644774924 3 0 2270 1 1224979098644774925 520 3 1224979098644774926 1224979098644774912 4 2106 2 1224979098644774925 1224979098644774926 2123 3 72057594037927985 1224979098644774925 24 2320 2 1 1585267068834415951 5 0 33 3 1224979098644774912 360287970189640703 360287970189640824 540 3 1224979098644774912 30 -1 2322 2 1 1224979098644774912 2319 1 2 2319 1 60 1 3 936748722493063897 2 1224979098644774912 520 3 1224979098644774914 1224979098644774912 150 2133 2 72057594037927977 1224979098644774914 520 3 1224979098644774920 1224979098644774912 52 4 0 31 2 1224979098644774920 21 2320 2 42 1585267068834415952 5 0 31 2 1224979098644774920 22 2320 2 42 1585267068834415953 5 0 31 2 1224979098644774920 23 2320 2 42 1585267068834415954 5 0 31 2 1224979098644774920 24 2320 2 42 1585267068834415955 5 0 31 2 1224979098644774920 25 2320 2 42 1585267068834415956 5 0 2133 2 72057594037927978 216172782113785389 2105 2 72057594037927978 1224979098644774920 2320 2 42 72057594037927978 3 0 520 3 1224979098644774927 1224979098644774912 5 4 0 31 2 1224979098644774927 1 2320 2 43 1585267068834415957 5 0 31 2 1224979098644774927 2 2320 2 43 1585267068834415958 5 0 31 2 1224979098644774927 3 2320 2 43 1585267068834415959 5 0 31 2 1224979098644774927 4 2320 2 43 1585267068834415960 5 0 2320 2 43 1585267068834415961 3 0 2173 2 1224979098644774922 1224979098644774912 520 3 1224979098644774915 1224979098644774912 14 4 0 2106 2 1224979098644774915 432345564227567632 2105 2 1224979098644774915 216172782113785700 2320 2 44 1224979098644774915 3 0 2335 2 45 1224979098644774922 2133 2 72057594037927982 0 4 0 560 3 1224979098644774912 31 0 520 3 1224979098644774928 1224979098644774912 31 2133 2 72057594037927982 1 5 0 520 3 1224979098644774928 1224979098644774912 33 3 0 2322 2 46 1224979098644774928 2319 1 47 2319 1 60 1 3 936748722493063897 47 1224979098644774928 4 0 560 3 1224979098644774928 38 1 2133 2 72057594037927981 1 5 0 2133 2 72057594037927981 0 3 0 2133 2 72057594037927984 0 4 0 560 3 1224979098644774912 34 0 520 3 72057594037927984 1224979098644774912 34 2322 2 48 72057594037927984 2133 2 72057594037927984 1 3 0 2270 1 1224979098644774925 520 3 1224979098644774926 1224979098644774912 4 2106 2 1224979098644774925 1224979098644774926 2123 3 72057594037927985 1224979098644774925 24 2133 2 72057594037927986 0 2319 1 50 4 0 540 3 1224979098644774912 74 1 2105 2 72057594037927986 1 2320 2 50 1585267068834415962 3 0 4 0 540 3 1224979098644774912 75 1 2105 2 72057594037927986 1 2320 2 50 1585267068834415963 3 0 4 0 540 3 1224979098644774912 76 1 2105 2 72057594037927986 1 2320 2 50 1585267068834415964 3 0 4 0 540 3 1224979098644774912 77 1 2105 2 72057594037927986 1 2320 2 50 1585267068834415965 3 0 4 0 540 3 1224979098644774912 78 1 2105 2 72057594037927986 1 2320 2 50 1585267068834415966 3 0 2320 2 1 1585267068834415967 5 0 33 3 1224979098644774912 360287970189640549 360287970189640571 947 2 144115188075857265 0 2322 2 1 1224979098644774912 520 3 1224979098644774920 1224979098644774912 52 2133 2 72057594037927978 216172782113785389 2105 2 72057594037927978 1224979098644774920 2320 2 42 72057594037927978 520 3 1224979098644774929 1224979098644774912 60 2330 2 43 1224979098644774929 520 3 1224979098644774930 1224979098644774912 67 2330 2 44 1224979098644774930 2204 2 1224979098644774931 1224979098644774930 2335 2 45 1224979098644774931 2133 2 72057594037927984 0 4 0 560 3 1224979098644774912 8 0 2133 2 72057594037927984 1 520 3 1224979098644774923 1224979098644774912 8 2204 2 1224979098644774924 1224979098644774923 2335 2 48 1224979098644774924 3 0 2270 1 1224979098644774925 520 3 1224979098644774926 1224979098644774912 4 2106 2 1224979098644774925 1224979098644774926 2123 3 72057594037927985 1224979098644774925 24 4 0 540 3 1224979098644774912 151 1 2320 2 50 1585267068834415968 5 0 540 3 1224979098644774912 151 2 520 3 1224979098644774930 1224979098644774912 67 2204 2 1224979098644774931 1224979098644774930 2335 2 66 1224979098644774931 2320 2 50 1585267068834415969 5 0 560 3 1224979098644774912 151 3 2147484208 3 1224979098644774912 151 8 520 3 1224979098644774912 1224979098644774912 152 2335 2 66 1224979098644774922 2320 2 50 1585267068834415970 5 0 31 2 1224979098644774912 144115188075856021 2320 2 50 1585267068834415971 5 0 2320 2 50 1585267068834415972 3 0 520 3 72057594037927986 1224979098644774912 150 2121 3 72057594037927937 72057594037927986 1 2320 2 1 1585267068834415973 3 0
This code includes two additional modifications:
  • Fixed the section "Friends:/Enemies:" in the Character&Companions menu. They will now appear correctly, in the original code, for x reasons, not added.
  • Fixed the "Liege:" section for vassals (when forming your own kingdom) in the Known Lords menu. A conditional has been added so that not all the vassals, companions or not, appear as rulers.
If anyone is interested in these additional fixes for the modsys, I will be happy to post them.

Eventually, you can comment on the following lines in module_presentations, jrider_character_relation_report.
  • add the red code
# get extra information from storage
(store_add, ":current_storage_index", "$g_base_character_presentation_storage_index", "$g_latest_character_relation_entry"),
(troop_get_slot, "$character_info_id", "trp_temp_array_c", ":current_storage_index"),
#(this_or_next|eq, "$character_info_id", "trp_player"), #CABA #Floris 2.52 bugfix --rather brute force, but I didn't see any real reason trp_temp_array_c would be giving a -1 from the scripts above
#(is_between, "$character_info_id", heroes_begin, heroes_end), #CABA #Floris 2.52 bugfix

In "presentations.txt" file into de mod folder if you don't use modsys:
look for the next line:
prsnt_jrider_character_relation_report 0 1109 4
-60.000000  197 902 1 999999 2124 1 bla bla bla...
-63.000000  22 2071 1 1224979098644 bla bla bla...
-62.000000  36 2071 1 1224979098644 bla bla bla...
-61.000000  6 4 0 1073741895 1 1 71 bla bla bla...
and replace it with this one:
Code:
prsnt_jrider_character_relation_report 0 1109 4
-60.000000  197 902 1 999999 2124 1 1000 2319 1 0 2319 1 1 4 0 31 2 144115188075857212 0 2320 2 0 1585267068834414821 2133 2 1224979098644774912 160 2133 2 1224979098644774913 480 2133 2 1224979098644774914 0 2133 2 144115188075857261 1000 1 1 936748722493063900 910 3 72057594037927937 1 4 729 2 1 590 730 2 1 55 926 2 72057594037927937 1 729 2 1 750 730 2 1 850 925 2 72057594037927937 1 921 2 72057594037927937 16737996 5 0 31 2 144115188075857212 1 2320 2 0 1585267068834414822 2133 2 1224979098644774912 110 2133 2 1224979098644774913 550 2133 2 1224979098644774914 0 2133 2 144115188075857261 2000 5 0 31 2 144115188075857212 2 2320 2 0 1585267068834414823 2133 2 1224979098644774912 110 2133 2 1224979098644774913 550 2133 2 1224979098644774914 0 2133 2 144115188075857261 3000 2133 2 1224979098644774915 0 729 2 1224979098644774915 400 730 2 1224979098644774915 400 911 2 72057594037927937 1441151880758558786 729 2 1 67 730 2 1 300 926 2 72057594037927937 1 925 2 72057594037927937 1224979098644774915 911 2 72057594037927937 1441151880758558787 729 2 1 450 730 2 1 330 926 2 72057594037927937 1 925 2 72057594037927937 1224979098644774915 3 0 911 2 72057594037927937 1441151880758559839 729 2 1 0 730 2 1 0 926 2 72057594037927937 1 729 2 1 1000 730 2 1 1000 925 2 72057594037927937 1 910 3 72057594037927937 0 16 921 2 72057594037927937 14540253 729 2 1 740 730 2 1 680 926 2 72057594037927937 1 729 2 1 1200 730 2 1 1200 925 2 72057594037927937 1 940 2 144115188075857262 1585267068834414824 729 2 1 290 730 2 1 10 926 2 144115188075857262 1 910 3 144115188075857263 216172782113785914 4 921 2 144115188075857263 16777215 729 2 1 55 730 2 1 60 926 2 144115188075857263 1 729 2 1 700 730 2 1 800 925 2 144115188075857263 1 910 3 144115188075857264 216172782113783809 131072 729 2 1 590 730 2 1 1224979098644774912 926 2 144115188075857264 1 729 2 1 335 730 2 1 1224979098644774913 929 2 144115188075857264 1 916 3 144115188075857265 216172782113783809 0 729 2 1 507 730 2 1 709 926 2 144115188075857265 1 729 2 1 550 730 2 1 650 925 2 144115188075857265 1 931 2 144115188075857265 1585267068834414825 931 2 144115188075857265 1585267068834414826 931 2 144115188075857265 1585267068834414827 931 2 144115188075857265 1585267068834414828 931 2 144115188075857265 1585267068834414829 931 2 144115188075857265 1585267068834414830 931 2 144115188075857265 1585267068834414831 931 2 144115188075857265 1585267068834414832 4 0 1073741855 2 144115188075857211 1 31 2 144115188075857266 -1 2133 2 144115188075857266 -1 927 2 144115188075857265 7 5 0 927 2 144115188075857265 144115188075857266 3 0 2133 2 144115188075857267 0 1 3 936748722493063896 144115188075857212 1224979098644774914 2133 2 144115188075857268 0 32 2 144115188075857267 0 2120 3 1224979098644774916 144115188075857261 144115188075857272 520 3 144115188075857269 360287970189641253 1224979098644774916 1 2 936748722493063899 144115188075857269 920 2 144115188075857263 1 921 2 144115188075857273 4284901119 922 2 144115188075857273 68 938 4 144115188075857270 -1 1729382256910270500 144115188075857269 729 2 2 100 730 2 2 280 926 2 144115188075857270 2 729 2 2 1100 730 2 2 1100 925 2 144115188075857270 2 4 0 2173 2 1224979098644774917 144115188075857269 2147483679 2 1224979098644774917 432345564227567631 33 3 1224979098644774917 432345564227567631 432345564227567638 2121 3 1224979098644774918 1224979098644774917 432345564227567631 2105 2 1224979098644774918 1441151880758558748 911 2 144115188075857271 1224979098644774918 729 2 3 150 730 2 3 600 926 2 144115188075857271 3 729 2 3 250 730 2 3 250 925 2 144115188075857271 3 3 0 4 0 31 2 144115188075857212 2 2133 2 1224979098644774919 452 2133 2 1224979098644774920 536 6 3 1224979098644774921 0 9 1541 3 72057594037927937 144115188075857269 1224979098644774921 4 0 31 2 1224979098644774921 4 2133 2 1224979098644774919 68 2133 2 1224979098644774920 557 3 0 4 0 2147483678 2 72057594037927937 1 4 0 2147483678 2 1224979098644774921 4 2133 2 1224979098644774922 1441151880758558795 5 0 31 2 1224979098644774921 4 2133 2 1224979098644774922 1441151880758558792 5 0 31 2 1224979098644774921 5 2133 2 1224979098644774922 1441151880758558791 5 0 31 2 1224979098644774921 6 2133 2 1224979098644774922 1441151880758558793 5 0 31 2 1224979098644774921 7 2133 2 1224979098644774922 1441151880758558789 5 0 31 2 1224979098644774921 8 2133 2 1224979098644774922 1441151880758558790 3 0 911 2 72057594037927947 1224979098644774922 925 2 72057594037927947 1224979098644774915 729 2 1 1224979098644774919 730 2 1 1224979098644774920 926 2 72057594037927947 1 500 3 360287970189641251 1224979098644774921 -1 2120 3 1224979098644774923 1224979098644774921 10 500 3 360287970189641251 1224979098644774923 -1 5 0 944 2 72057594037927946 72057594037927937 729 2 1 450 730 2 1 450 925 2 72057594037927946 1 2120 3 1224979098644774924 1224979098644774919 25 2120 3 1224979098644774925 1224979098644774920 25 729 2 1 1224979098644774924 730 2 1 1224979098644774925 926 2 72057594037927946 1 500 3 360287970189641251 1224979098644774921 72057594037927946 2120 3 1224979098644774923 1224979098644774921 10 500 3 360287970189641251 1224979098644774923 72057594037927937 3 0 2106 2 1224979098644774920 51 3 0 3 0 4 0 31 2 144115188075857211 1 2133 2 144115188075857211 0 3 0 
-63.000000  22 2071 1 1224979098644774912 2072 1 1224979098644774913 4 0 31 2 144115188075857212 2 4 0 31 2 1224979098644774913 0 6 3 1224979098644774914 0 9 540 3 360287970189641251 1224979098644774914 1224979098644774912 2120 3 1224979098644774915 1224979098644774914 10 520 3 1224979098644774916 360287970189641251 1224979098644774915 2124 1 1000 729 2 0 740 730 2 0 235 970 3 1224979098644774916 0 100 3 0 5 0 6 3 1224979098644774914 0 9 540 3 360287970189641251 1224979098644774914 1224979098644774912 971 0 3 0 3 0 3 0 
-62.000000  36 2071 1 1224979098644774912 2072 1 1224979098644774913 4 0 31 2 1224979098644774912 144115188075857262 4 0 2147483679 2 144115188075857267 0 920 2 144115188075857263 216172782113783809 922 2 144115188075857273 0 3 0 902 1 0 5 0 31 2 1224979098644774912 144115188075857265 4 0 31 2 1224979098644774913 7 2133 2 144115188075857266 -1 5 0 2133 2 144115188075857266 1224979098644774913 3 0 2133 2 144115188075857268 1000 900 1 1513209474796486744 5 0 2147483679 2 1224979098644774912 144115188075857263 2147483679 2 1224979098644774912 144115188075857270 2147483679 2 1224979098644774912 144115188075857264 2120 3 1224979098644774914 1224979098644774912 144115188075857261 520 3 1224979098644774915 360287970189641252 1224979098644774914 922 2 144115188075857273 0 921 2 144115188075857273 14540253 2133 2 144115188075857272 1224979098644774915 2133 2 144115188075857273 1224979098644774912 921 2 144115188075857273 4284901119 922 2 144115188075857273 68 2105 2 1224979098644774915 144115188075857261 520 3 144115188075857269 360287970189641253 1224979098644774915 900 1 1513209474796486744 3 0 
-61.000000  6 4 0 1073741895 1 1 71 1 225 902 1 0 2060 1 864691128455135236 3 0

Happy looting!!
 
If you could be so kind and upload the compiled files so I can drag and drop them that be great.      It will takes hours upon hours learning how to get pyathon up and running and figuring out how to comple the changes :/

Don't got PC Internet atm only phone data. :sad:

Just thought I'd ask! 
 
I have modified some of the original scripts created by the great Jrider, because there are some incompatibilities with the mod floris and I have also adapted them to my own modification, but I will try to compile the original and update the first post so that everyone who does not want to use the modsys can modify it with this little fix.
 
Back
Top Bottom