Loader
logo

i keep getting an errorcode

Started by rbn61, January 02, 2024, 09:35:15 PM

Previous topic - Next topic
i keep getting an error code on the world map. the game appears to work fine but after i get the errorcode the text on the bottom left of the screen stops appearing for a seemingly random amount of time or until i reboot the game. this is the errorcode

script error on opcode 520: invalid troop ID: -1; line no: 1:
At script: troop_get_player_relation.
At script: troop_get_player_relation.

is there a way to fix this?

I'm not the developer nor tester. I've never seen it in my environment. Does it appear when you first stand on the map in a new game of v9.*?  Can you show the steps to reproduce?  (If you're trying to load a v8.* savegame into v9.*, that won't work.)

January 05, 2024, 06:20:47 PM #2 Last Edit: January 05, 2024, 06:39:51 PM by rbn61
Quote from: tos1 on January 04, 2024, 05:17:53 PMI'm not the developer nor tester. I've never seen it in my environment. Does it appear when you first stand on the map in a new game of v9.*?  Can you show the steps to reproduce?  (If you're trying to load a v8.* savegame into v9.*, that won't work.)

it appears first when i go into a shop then it continues on the world map. it stops when i restart the game. i am using a new save for 9.0

edit: it happens when i hover over items in the store

Quote from: rbn61 on January 05, 2024, 06:20:47 PMit appears first when i go into a shop then it continues on the world map. it stops when i restart the game. i am using a new save for 9.0

edit: it happens when i hover over items in the store

I don't know the cause or what to do about it, but can provide some information.

The error is occurring in troop_get_player_relation in scripts.txt. The first of the two opcode=520 corresponds to "line no: 1". (The first 43 is the number of opcodes, opcode=21 is the line number 0 and has one parameter.)

---- scripts.txt, AWoIaF v9.1 or v9.0
troop_get_player_relation -1
43 21 1 1224979098644774912 520 3 1224979098644774913 1224979098644774912 52 520 3 1224979098644774914 1224979098644774912 22 2133 2 1224979098644774915 0 4 0 31 2 1224979098644774913 2 <snip>
----

---- scripts.txt, Native
troop_get_player_relation -1
30 21 1 1224979098644774912 520 3 1224979098644774913 1224979098644774912 52 520 3 1224979098644774914 1224979098644774912 22 2133 2 1224979098644774915 0 4 0 31 2 1224979098644774913 2 <snip>
----

Up to that point, it's the same with Native. In the source code of Module system 1.171 for generating Native *.txt, the only parameter passed to this script is stored in ":troop_no", and troop_get_slot (opcode=520) tries to read the slot based on the number.

---- module_scripts.py, Module system 1.171 (I added comments ###)
# script_troop_get_player_relation
# Input: arg1 = troop_no
# Output: reg0 = effective relation (modified by troop reputation, honor, etc.)
("troop_get_player_relation",
  [
    (store_script_param_1, ":troop_no"), ### opcode=21, num of param = 1
    (troop_get_slot, ":reputation", ":troop_no", slot_lord_reputation_type), ### opcode=520, num of param=3
    (troop_get_slot, ":effective_relation", ":troop_no", slot_troop_player_relation), ### opcode=520, num of param=3
    (assign, ":honor_bonus", 0), ### opcode=2133, num of param=2
    (try_begin), ### opcode=4, num of param=0
      (eq,  ":reputation", lrep_quarrelsome), ### opcode=31, num of param=2
----

It seems to be an error that this script is called on mouse hover when buying or selling, or that it is being used without setting troop_id correctly.

Since it does not reproduce in my environment (v9.1 and v9.0_dev7), it may occur only when specific birth selection when creating the player character (i.e. Natural Leader, Warrior, race, gender, etc.) and their combination.

Also, apply the v9.1 patch.

A similar case of "Viking Conquest 2.063" (Note: Its scripts.txt should be different from AWoIaF);
"Viking Conquest 2.063" Mar 15, 2023 on the TaleWorlds forum

This error first starts after you disable static wars.
On hovering mouse over items cause the error code to trigger.