A World of Ice and Fire Forums

AWoIaF Warband => Bugs => V9.0 => Topic started by: tos1 on March 05, 2024, 05:19:27 AM

Title: Follow-up: Negative values in the "Companion Overview"
Post by: tos1 on March 05, 2024, 05:19:27 AM
Related topic (v8.* but inherited to v9.1):
<Negative values in the "Companion Overview" at towns (https://www.aworldoficeandfire.co.uk/forum/v8-0/negative-values-in-the-companion-overview-at-towns/)> by me

I found out the cause and the solution! There is not enough level checking in a script. It checks only level 1 thru 30 (That was enough for Brytenwalda), and does not support AWoIaF's NPCs with higher levels.

My hand-disassembly of current code:

jq_xp_to_next_lvl, script.txt,
----
store_script_param ":L0" 1   # 23 2 1224979098644774912 1
try_begin   # 4 0
  lt ":L0" 600 # 2147483678 2 1224979098644774912 600
  assign ":L1" 600   # 2133 2 1224979098644774913 600
else_try   # 5 0
  lt ":L0" 1360 # 2147483678 2 1224979098644774912 1360
  assign ":L1" 1360   # 2133 2 1224979098644774913 1360
else_try   # 5 0
  lt ":L0" 2296 # 2147483678 2 1224979098644774912 2296
  assign ":L1" 2296   # 2133 2 1224979098644774913 2296
:
else_try   # 5 0
  lt ":L0" 412091 # 2147483678 2 1224979098644774912 412091
  assign ":L1" 412091   # 2133 2 1224979098644774913 412091

###### Add code for level 31 thru 50 here. (*1)

try_end   # 3 0
store_sub reg1 ":L1" ":L0"   # 2121 3 72057594037927937 1224979098644774913 1224979098644774912
str_store_string 1 "@{reg1}"   # 2320 2 1 1585267068834414851
----

*1  The conversion table (perhaps hard-coded) is here:
Modding Q&A [For Quick Questions and Answers] (https://forums.taleworlds.com/index.php?threads/modding-q-a-for-quick-questions-and-answers.6575/page-377#post-4541465), TaleWorlds forums

I checked NPC with max level in troops.txt, experimentally added else_try blocks for level 31 thru 50 to "jq_xp_to_next_lvl" in scripts.txt (and increased the number of operations), and got correct result.

(https://img.atwiki.jp/awoiafwb/attach/1/188/nextlvl1a.jpg)

In addition, the script is called from not only town's market-menu but also [Report]-[Companions Overview].

- How to reproduce it/when/why it happens:
Hire companions who have higher level than 30, Visit a town, select "Trade with locals", select "Companions overview", and see the column "to next lvl".

- Game version (and steam or downloaded):
AWoIaF v9.1, v8.2. Warband v1.174 downloaded