A World of Ice and Fire Forums

Re-Follow-up: Negative values in the "Companion Overview"

Started by tos1, June 16, 2024, 09:40:06 AM

Previous topic - Next topic

tos1

Sorry, the table I mentioned was out of date! I checked v9.4 dev.5 and noticed today that the values for levels 53 and above don't match the values returned by get_level_boundary in the current engine, so the values displayed are a bit off.

Currently, the initial level of troops that can become companions in AWoIaF is at most around 50, so this is not a problem for the time being, but it would be better to fix this before future expansions or spreading to other mods.

For example, a level 62 NPC should assume that the experience points required to reach the next level is 2050460032 and the difference should be calculated based on that, but when using that table it is mistakenly assumed to be 2050460000. When I experimented with v9.4 dev.5, the value displayed was indeed 32 points off from the correct value.



In the first place, this code for jq_xp_to_next_lvl should have been written using a loop like:
----
store_script_param ":cur_lvl" 1
assign ":end1" 64
try_for_range ":i" 0 ":end1"
  get_level_boundary ":bndry" ":i"  # get boundary value of the level, i
  gt ":bndry" ":cur_lvl"  # exceeded the current level
  assign ":end1" 0        # change upper-value of loop to break
try_end
store_sub reg1 ":bndry" ":cur_lvl"
str_store_string s1 "@{reg1}"
----

I confirmed the (hand-disassembled) code above works fine in my hand-patched .txt for at least level 4 and level 62 companions. (It's today that I've just learned the get_level_boundary operation for the first time.)

- Game version (and steam or downloaded):
AWoIaF v9.4-developer_version 5, Warband v1.174 downloaded

Quick Reply

Note: this post will not display until it has been approved by a moderator.

Name:
Email:
Shortcuts: ALT+S post or ALT+P preview