During the development of a combat script, a strange problem arose. The essence is as follows: I am trying to perform a simple action – obtaining a global variable using GetGameVar() – so that, depending on its value, the script behaves slightly differently.
I know that by default, a string value is returned, so I add 0 to it. As a result, an error appears in the console stating that I am trying to perform an arithmetic operation on a string, and the rest of the script crashes. Similarly, if I multiply this variable by 1.
Then I decided to check if I had somehow named the variable differently in the map script, but no, everything is correct. However, then I decided to continue the battle, call the same code in debug mode, and this time the variable, after adding 0, actually became a number.
Perhaps someone knows what the problem is and how to deal with it? I tried using sleep commands, but it didn't help.
Сценарии:
"Холм мертвецов"
"Священное древо"